Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3012b5e

Browse filesBrowse files
authored
Using HTTPS wikipedia links in language system tests. (googleapis#3732)
Fixes googleapis#3731. Also relaxing the sentiment score expected range for "Jogging is fun" (the same backend update that changed HTTP to HTTPS changed the score from 0.5 to 0.7). Also updating the language usage doc with the correct (and HTTPS) URLs for the 3 examples.
1 parent e835957 commit 3012b5e
Copy full SHA for 3012b5e

2 files changed

+7-7Lines changed: 7 additions & 7 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/language/usage.rst‎

Copy file name to clipboardExpand all lines: docs/language/usage.rst
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,17 @@ returns a :class:`~.language_v1.types.AnalyzeEntitiesResponse`.
144144
====================
145145
name: Michelangelo Caravaggio
146146
type: PERSON
147-
metadata: {'wikipedia_url': 'http://en.wikipedia.org/wiki/Caravaggio'}
147+
metadata: {'wikipedia_url': 'https://en.wikipedia.org/wiki/Caravaggio'}
148148
salience: 0.7615959
149149
====================
150150
name: Italian
151151
type: LOCATION
152-
metadata: {'wikipedia_url': 'http://en.wikipedia.org/wiki/Caravaggio'}
152+
metadata: {'wikipedia_url': 'https://en.wikipedia.org/wiki/Italy'}
153153
salience: 0.19960518
154154
====================
155155
name: The Calling of Saint Matthew
156156
type: EVENT
157-
metadata: {'wikipedia_url': 'http://en.wikipedia.org/wiki/Caravaggio'}
157+
metadata: {'wikipedia_url': 'https://en.wikipedia.org/wiki/The_Calling_of_St_Matthew_(Caravaggio)'}
158158
salience: 0.038798928
159159
160160
.. note::
Collapse file

‎language/tests/system.py‎

Copy file name to clipboardExpand all lines: language/tests/system.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,23 @@ def _check_analyze_entities_result(self, entities):
7777
# Other mentions may occur, e.g. "painter".
7878
self.assertIn(entity1.name, [str(i) for i in entity1.mentions])
7979
self.assertEqual(entity1.metadata['wikipedia_url'],
80-
'http://en.wikipedia.org/wiki/Caravaggio')
80+
'https://en.wikipedia.org/wiki/Caravaggio')
8181
self.assertIsInstance(entity1.metadata, dict)
8282
# Verify entity 2.
8383
self.assertEqual(entity2.name, self.NAME2)
8484
self.assertEqual(entity2.entity_type, EntityType.LOCATION)
8585
self.assertGreater(entity2.salience, 0.0)
8686
self.assertEqual([str(i) for i in entity2.mentions], [entity2.name])
8787
self.assertEqual(entity2.metadata['wikipedia_url'],
88-
'http://en.wikipedia.org/wiki/Italy')
88+
'https://en.wikipedia.org/wiki/Italy')
8989
self.assertIsInstance(entity2.metadata, dict)
9090
# Verify entity 3.
9191
self.assertEqual(entity3.name, self.NAME3)
9292
choices = (EntityType.EVENT, EntityType.WORK_OF_ART)
9393
self.assertIn(entity3.entity_type, choices)
9494
self.assertGreater(entity3.salience, 0.0)
9595
self.assertEqual([str(i) for i in entity3.mentions], [entity3.name])
96-
wiki_url = ('http://en.wikipedia.org/wiki/'
96+
wiki_url = ('https://en.wikipedia.org/wiki/'
9797
'The_Calling_of_St_Matthew_(Caravaggio)')
9898
self.assertEqual(entity3.metadata['wikipedia_url'], wiki_url)
9999
self.assertIsInstance(entity3.metadata, dict)
@@ -122,7 +122,7 @@ def test_analyze_sentiment(self):
122122
positive_msg = 'Jogging is fun'
123123
document = Config.CLIENT.document_from_text(positive_msg)
124124
sentiment = document.analyze_sentiment().sentiment
125-
self.assertEqual(sentiment.score, 0.5)
125+
self.assertTrue(0.0 < sentiment.score < 1.0)
126126
self.assertTrue(0.0 < sentiment.magnitude < 1.5)
127127

128128
def _verify_token(self, token, text_content, part_of_speech, lemma):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.