@@ -132,8 +132,8 @@ Create a new function called `sentiment_analysis_example()` that takes the clien
132
132
``` python
133
133
def sentiment_analysis_example (client ):
134
134
135
- document = [" I had the best day of my life. I wish you were there with me." ]
136
- response = client.analyze_sentiment(documents = document )[0 ]
135
+ documents = [" I had the best day of my life. I wish you were there with me." ]
136
+ response = client.analyze_sentiment(documents = documents )[0 ]
137
137
print (" Document Sentiment: {} " .format(response.sentiment))
138
138
print (" Overall scores: positive={0:.2f } ; neutral={1:.2f } ; negative={2:.2f } \n " .format(
139
139
response.confidence_scores.positive,
@@ -202,8 +202,8 @@ Create a new function called `language_detection_example()` that takes the clien
202
202
``` python
203
203
def language_detection_example (client ):
204
204
try :
205
- document = [" Ce document est rédigé en Français." ]
206
- response = client.detect_language(documents = document , country_hint = ' us' )[0 ]
205
+ documents = [" Ce document est rédigé en Français." ]
206
+ response = client.detect_language(documents = documents , country_hint = ' us' )[0 ]
207
207
print (" Language: " , response.primary_language.name)
208
208
209
209
except Exception as err:
@@ -249,8 +249,8 @@ Create a new function called `entity_recognition_example` that takes the client
249
249
def entity_recognition_example (client ):
250
250
251
251
try :
252
- document = [" I had a wonderful trip to Seattle last week." ]
253
- result = client.recognize_entities(documents = document )[0 ]
252
+ documents = [" I had a wonderful trip to Seattle last week." ]
253
+ result = client.recognize_entities(documents = documents )[0 ]
254
254
255
255
print (" Named Entities:\n " )
256
256
for entity in result.entities:
@@ -282,12 +282,12 @@ Create a new function called `entity_linking_example()` that takes the client as
282
282
def entity_linking_example (client ):
283
283
284
284
try :
285
- document = [""" Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975,
285
+ documents = [""" Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975,
286
286
to develop and sell BASIC interpreters for the Altair 8800.
287
287
During his career at Microsoft, Gates held the positions of chairman,
288
288
chief executive officer, president and chief software architect,
289
289
while also being the largest individual shareholder until May 2014.""" ]
290
- result = client.recognize_linked_entities(documents = document )[0 ]
290
+ result = client.recognize_linked_entities(documents = documents )[0 ]
291
291
292
292
print (" Linked Entities:\n " )
293
293
for entity in result.entities:
@@ -412,9 +412,9 @@ Create a new function called `key_phrase_extraction_example()` that takes the cl
412
412
def key_phrase_extraction_example (client ):
413
413
414
414
try :
415
- document = [" My cat might need to see a veterinarian." ]
415
+ documents = [" My cat might need to see a veterinarian." ]
416
416
417
- response = client.extract_key_phrases(documents = document )[0 ]
417
+ response = client.extract_key_phrases(documents = documents )[0 ]
418
418
419
419
if not response.is_error:
420
420
print (" \t Key Phrases:" )
0 commit comments