def sample_analyze_entities(gcs_content_uri):
    '\n    Analyzing Entities in text file stored in Cloud Storage\n\n    Args:\n      gcs_content_uri Google Cloud Storage URI where the file content is located.\n      e.g. gs://[Your Bucket]/[Path to File]\n    '
    client = language_v1.LanguageServiceClient()
    type_ = enums.Document.Type.PLAIN_TEXT
    language = 'en'
    document = {'gcs_content_uri': gcs_content_uri, 'type': type_, 'language': language}
    encoding_type = enums.EncodingType.UTF8
    response = client.analyze_entities(document, encoding_type=encoding_type)
    for entity in response.entities:
        print(u'Representative name for the entity: {}'.format(entity.name))
        print(u'Entity type: {}'.format(enums.Entity.Type(entity.type).name))
        print(u'Salience score: {}'.format(entity.salience))
        for (metadata_name, metadata_value) in entity.metadata.items():
            print(u'{}: {}'.format(metadata_name, metadata_value))
        for mention in entity.mentions:
            print(u'Mention text: {}'.format(mention.text.content))
            print(u'Mention type: {}'.format(enums.EntityMention.Type(mention.type).name))
    print(u'Language of the text: {}'.format(response.language))
Analyzing Entities in text file stored in Cloud Storage

Args:
  gcs_content_uri Google Cloud Storage URI where the file content is located.
  e.g. gs://[Your Bucket]/[Path to File]
def sample_analyze_entities(gcs_content_uri):
    '\n    Analyzing Entities in text file stored in Cloud Storage\n\n    Args:\n      gcs_content_uri Google Cloud Storage URI where the file content is located.\n      e.g. gs://[Your Bucket]/[Path to File]\n    '
    client = language_v1.LanguageServiceClient()
    type_ = enums.Document.Type.PLAIN_TEXT
    language = 'en'
    document = {'gcs_content_uri': gcs_content_uri, 'type': type_, 'language': language}
    encoding_type = enums.EncodingType.UTF8
    response = client.analyze_entities(document, encoding_type=encoding_type)
    for entity in response.entities:
        print(u'Representative name for the entity: {}'.format(entity.name))
        print(u'Entity type: {}'.format(enums.Entity.Type(entity.type).name))
        print(u'Salience score: {}'.format(entity.salience))
        for (metadata_name, metadata_value) in entity.metadata.items():
            print(u'{}: {}'.format(metadata_name, metadata_value))
        for mention in entity.mentions:
            print(u'Mention text: {}'.format(mention.text.content))
            print(u'Mention type: {}'.format(enums.EntityMention.Type(mention.type).name))
    print(u'Language of the text: {}'.format(response.language))