77def dominant_entity_lookup (subscription_key ):
88 """DominantEntityLookup.
99
10- This will look up a single entity (tom cruise ) and print out a short description about them.
10+ This will look up a single entity (Satya Nadella ) and print out a short description about them.
1111 """
1212 client = EntitySearchAPI (CognitiveServicesCredentials (subscription_key ))
1313
1414 try :
15- entity_data = client .entities .search (query = "tom cruise " )
15+ entity_data = client .entities .search (query = "satya nadella " )
1616
1717 if entity_data .entities .value :
1818 # find the entity that represents the dominant one
@@ -21,10 +21,10 @@ def dominant_entity_lookup(subscription_key):
2121 if entity .entity_presentation_info .entity_scenario == "DominantEntity" ]
2222
2323 if main_entities :
24- print ('Searched for "Tom Cruise " and found a dominant entity with this description:' )
24+ print ('Searched for "Satya Nadella " and found a dominant entity with this description:' )
2525 print (main_entities [0 ].description )
2626 else :
27- print ("Couldn't find main entity tom cruise !" )
27+ print ("Couldn't find main entity Satya Nadella !" )
2828
2929 else :
3030 print ("Didn't see any data.." )
@@ -35,12 +35,12 @@ def dominant_entity_lookup(subscription_key):
3535def handling_disambiguation (subscription_key ):
3636 """HandlingDisambiguation.
3737
38- "This will handle disambiguation results for an ambiguous query (harry potter )".
38+ "This will handle disambiguation results for an ambiguous query (William Gates )".
3939 """
4040 client = EntitySearchAPI (CognitiveServicesCredentials (subscription_key ))
4141
4242 try :
43- entity_data = client .entities .search (query = "harry potter " )
43+ entity_data = client .entities .search (query = "william gates " )
4444
4545 if entity_data .entities .value :
4646 # find the entity that represents the dominant one
@@ -55,11 +55,11 @@ def handling_disambiguation(subscription_key):
5555 main_entity = main_entities [0 ]
5656 type_hint = main_entity .entity_presentation_info .entity_type_display_hint
5757
58- print ('Searched for "harry potter " and found a dominant entity {}with this description:' .format (
58+ print ('Searched for "William Gates " and found a dominant entity {}with this description:' .format (
5959 '"with type hint "{}" ' .format (type_hint ) if type_hint else '' ))
6060 print (main_entity .description )
6161 else :
62- print ("Couldn't find a reliable dominant entity for harry potter !" )
62+ print ("Couldn't find a reliable dominant entity for William Gates !" )
6363
6464 if disambig_entities :
6565 print ("\n This query is pretty ambiguous and can be referring to multiple things. Did you mean one of these:" )
@@ -68,7 +68,7 @@ def handling_disambiguation(subscription_key):
6868 suggestions .append ("{} the {}" .format (disambig_entity .name , disambig_entity .entity_presentation_info .entity_type_display_hint ))
6969 print (", or " .join (suggestions ))
7070 else :
71- print ("We didn't find any disambiguation items for harry potter , so we must be certain what you're talking about!" )
71+ print ("We didn't find any disambiguation items for William Gates , so we must be certain what you're talking about!" )
7272
7373 else :
7474 print ("Didn't see any data.." )
@@ -185,4 +185,4 @@ def error(subscription_key):
185185 import sys , os .path
186186 sys .path .append (os .path .abspath (os .path .join (__file__ , ".." , ".." )))
187187 from tools import execute_samples
188- execute_samples (globals (), SUBSCRIPTION_KEY_ENV_NAME )
188+ execute_samples (globals (), SUBSCRIPTION_KEY_ENV_NAME )
0 commit comments