Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
docs: add spacing for readability (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejdarrow authored Jun 22, 2020
1 parent f16bd6d commit 7dff809
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/v1/language_entities_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ def sample_analyze_entities(text_content):
encoding_type = enums.EncodingType.UTF8

response = client.analyze_entities(document, encoding_type=encoding_type)

# Loop through entitites returned from the API
for entity in response.entities:
print(u"Representative name for the entity: {}".format(entity.name))

# Get entity type, e.g. PERSON, LOCATION, ADDRESS, NUMBER, et al
print(u"Entity type: {}".format(enums.Entity.Type(entity.type).name))

# Get the salience score associated with the entity in the [0, 1.0] range
print(u"Salience score: {}".format(entity.salience))

# Loop over the metadata associated with entity. For many known entities,
# the metadata is a Wikipedia URL (wikipedia_url) and Knowledge Graph MID (mid).
# Some entity types may have additional metadata, e.g. ADDRESS entities
Expand All @@ -72,6 +76,7 @@ def sample_analyze_entities(text_content):
# The API currently supports proper noun mentions.
for mention in entity.mentions:
print(u"Mention text: {}".format(mention.text.content))

# Get the mention type, e.g. PROPER for proper noun
print(
u"Mention type: {}".format(enums.EntityMention.Type(mention.type).name)
Expand Down

0 comments on commit 7dff809

Please sign in to comment.