Index
LanguageService
(interface)AnalyzeEntitiesRequest
(message)AnalyzeEntitiesResponse
(message)AnalyzeEntitySentimentRequest
(message)AnalyzeEntitySentimentResponse
(message)AnalyzeSentimentRequest
(message)AnalyzeSentimentResponse
(message)AnalyzeSyntaxRequest
(message)AnalyzeSyntaxResponse
(message)AnnotateTextRequest
(message)AnnotateTextRequest.Features
(message)AnnotateTextResponse
(message)ClassificationCategory
(message)ClassificationModelOptions
(message)ClassificationModelOptions.V1Model
(message)ClassificationModelOptions.V2Model
(message)ClassificationModelOptions.V2Model.ContentCategoriesVersion
(enum)ClassifyTextRequest
(message)ClassifyTextResponse
(message)DependencyEdge
(message)DependencyEdge.Label
(enum)Document
(message)Document.BoilerplateHandling
(enum)Document.Type
(enum)EncodingType
(enum)Entity
(message)Entity.Type
(enum)EntityMention
(message)EntityMention.Type
(enum)ModerateTextRequest
(message)ModerateTextResponse
(message)PartOfSpeech
(message)PartOfSpeech.Aspect
(enum)PartOfSpeech.Case
(enum)PartOfSpeech.Form
(enum)PartOfSpeech.Gender
(enum)PartOfSpeech.Mood
(enum)PartOfSpeech.Number
(enum)PartOfSpeech.Person
(enum)PartOfSpeech.Proper
(enum)PartOfSpeech.Reciprocity
(enum)PartOfSpeech.Tag
(enum)PartOfSpeech.Tense
(enum)PartOfSpeech.Voice
(enum)Sentence
(message)Sentiment
(message)TextSpan
(message)Token
(message)
LanguageService
Provides text analysis operations such as sentiment analysis and entity recognition.
AnalyzeEntities |
---|
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
|
AnalyzeEntitySentiment |
---|
Finds entities, similar to
|
AnalyzeSentiment |
---|
Analyzes the sentiment of the provided text.
|
AnalyzeSyntax |
---|
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
|
AnnotateText |
---|
A convenience method that provides all syntax, sentiment, entity, and classification features in one call.
|
ClassifyText |
---|
Classifies a document into categories.
|
ModerateText |
---|
Moderates a document for harmful and sensitive categories.
|
AnalyzeEntitiesRequest
The entity analysis request message.
Fields | |
---|---|
document |
Required. Input document. |
encoding_type |
The encoding type used by the API to calculate offsets. |
AnalyzeEntitiesResponse
The entity analysis response message.
Fields | |
---|---|
entities[] |
The recognized entities in the input document. |
language |
The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See |
AnalyzeEntitySentimentRequest
The entity-level sentiment analysis request message.
Fields | |
---|---|
document |
Required. Input document. |
encoding_type |
The encoding type used by the API to calculate offsets. |
AnalyzeEntitySentimentResponse
The entity-level sentiment analysis response message.
Fields | |
---|---|
entities[] |
The recognized entities in the input document with associated sentiments. |
language |
The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See |
AnalyzeSentimentRequest
The sentiment analysis request message.
Fields | |
---|---|
document |
Required. Input document. |
encoding_type |
The encoding type used by the API to calculate sentence offsets for the sentence sentiment. |
AnalyzeSentimentResponse
The sentiment analysis response message.
Fields | |
---|---|
document_sentiment |
The overall sentiment of the input document. |
language |
The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See |
sentences[] |
The sentiment for all the sentences in the document. |
AnalyzeSyntaxRequest
The syntax analysis request message.
Fields | |
---|---|
document |
Required. Input document. |
encoding_type |
The encoding type used by the API to calculate offsets. |
AnalyzeSyntaxResponse
The syntax analysis response message.
Fields | |
---|---|
sentences[] |
Sentences in the input document. |
tokens[] |
Tokens, along with their syntactic information, in the input document. |
language |
The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See |
AnnotateTextRequest
The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call.
Fields | |
---|---|
document |
Required. Input document. |
features |
Required. The enabled features. |
encoding_type |
The encoding type used by the API to calculate offsets. |
Features
All available features for sentiment, syntax, and semantic analysis. Setting each one to true will enable that specific analysis for the input. Next ID: 12
Fields | |
---|---|
extract_syntax |
Extract syntax information. |
extract_entities |
Extract entities. |
extract_document_sentiment |
Extract document-level sentiment. |
extract_entity_sentiment |
Extract entities and their associated sentiment. |
classify_text |
Classify the full document into categories. If this is true, the API will use the default model which classifies into a predefined taxonomy. |
moderate_text |
Moderate the document for harmful and sensitive categories. |
classification_model_options |
The model options to use for classification. Defaults to v1 options if not specified. Only used if |
AnnotateTextResponse
The text annotations response message.
Fields | |
---|---|
sentences[] |
Sentences in the input document. Populated if the user enables |
tokens[] |
Tokens, along with their syntactic information, in the input document. Populated if the user enables |
entities[] |
Entities, along with their semantic information, in the input document. Populated if the user enables |
document_sentiment |
The overall sentiment for the document. Populated if the user enables |
language |
The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See |
categories[] |
Categories identified in the input document. |
moderation_categories[] |
Harmful and sensitive categories identified in the input document. |
ClassificationCategory
Represents a category returned from the text classifier.
Fields | |
---|---|
name |
The name of the category representing the document. |
confidence |
The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text. |
ClassificationModelOptions
Model options available for classification requests.
Fields | |
---|---|
Union field model_type . If this field is not set, then the v1_model will be used by default. model_type can be only one of the following: |
|
v1_model |
Setting this field will use the V1 model and V1 content categories version. The V1 model is a legacy model; support for this will be discontinued in the future. |
v2_model |
Setting this field will use the V2 model with the appropriate content categories version. The V2 model is a better performing model. |
V1Model
This type has no fields.
Options for the V1 model.
V2Model
Options for the V2 model.
Fields | |
---|---|
content_categories_version |
The content categories used for classification. |
ContentCategoriesVersion
The content categories used for classification.
Enums | |
---|---|
CONTENT_CATEGORIES_VERSION_UNSPECIFIED |
If ContentCategoriesVersion is not specified, this option will default to V1 . |
V1 |
Legacy content categories of our initial launch in 2017. |
V2 |
Updated content categories in 2022. |
ClassifyTextRequest
The document classification request message.
Fields | |
---|---|
document |
Required. Input document. |
classification_model_options |
Model options to use for classification. Defaults to v1 options if not specified. |
ClassifyTextResponse
The document classification response message.
Fields | |
---|---|
categories[] |
Categories representing the input document. |
DependencyEdge
Represents dependency parse tree information for a token.
Fields | |
---|---|
head_token_index |
Represents the head of this token in the dependency tree. This is the index of the token which has an arc going to this token. The index is the position of the token in the array of tokens returned by the API method. If this token is a root token, then the |
label |
The parse label for the token. |
Label
The parse label enum for the token.
Enums | |
---|---|
UNKNOWN |
Unknown |
ABBREV |
Abbreviation modifier |
ACOMP |
Adjectival complement |
ADVCL |
Adverbial clause modifier |
ADVMOD |
Adverbial modifier |
AMOD |
Adjectival modifier of an NP |
APPOS |
Appositional modifier of an NP |
ATTR |
Attribute dependent of a copular verb |
AUX |
Auxiliary (non-main) verb |
AUXPASS |
Passive auxiliary |
CC |
Coordinating conjunction |
CCOMP |
Clausal complement of a verb or adjective |
CONJ |
Conjunct |
CSUBJ |
Clausal subject |
CSUBJPASS |
Clausal passive subject |
DEP |
Dependency (unable to determine) |
DET |
Determiner |
DISCOURSE |
Discourse |
DOBJ |
Direct object |
EXPL |
Expletive |
GOESWITH |
Goes with (part of a word in a text not well edited) |
IOBJ |
Indirect object |
MARK |
Marker (word introducing a subordinate clause) |
MWE |
Multi-word expression |
MWV |
Multi-word verbal expression |
NEG |
Negation modifier |
NN |
Noun compound modifier |
NPADVMOD |
Noun phrase used as an adverbial modifier |
NSUBJ |
Nominal subject |
NSUBJPASS |
Passive nominal subject |
NUM |
Numeric modifier of a noun |
NUMBER |
Element of compound number |
P |
Punctuation mark |
PARATAXIS |
Parataxis relation |
PARTMOD |
Participial modifier |
PCOMP |
The complement of a preposition is a clause |
POBJ |
Object of a preposition |
POSS |
Possession modifier |
POSTNEG |
Postverbal negative particle |
PRECOMP |
Predicate complement |
PRECONJ |
Preconjunt |
PREDET |
Predeterminer |
PREF |
Prefix |
PREP |
Prepositional modifier |
PRONL |
The relationship between a verb and verbal morpheme |
PRT |
Particle |
PS |
Associative or possessive marker |
QUANTMOD |
Quantifier phrase modifier |
RCMOD |
Relative clause modifier |
RCMODREL |
Complementizer in relative clause |
RDROP |
Ellipsis without a preceding predicate |
REF |
Referent |
REMNANT |
Remnant |
REPARANDUM |
Reparandum |
ROOT |
Root |
SNUM |
Suffix specifying a unit of number |
SUFF |
Suffix |
TMOD |
Temporal modifier |
TOPIC |
Topic marker |
VMOD |
Clause headed by an infinite form of the verb that modifies a noun |
VOCATIVE |
Vocative |
XCOMP |
Open clausal complement |
SUFFIX |
Name suffix |
TITLE |
Name title |
ADVPHMOD |
Adverbial phrase modifier |
AUXCAUS |
Causative auxiliary |
AUXVV |
Helper auxiliary |
DTMOD |
Rentaishi (Prenominal modifier) |
FOREIGN |
Foreign words |
KW |
Keyword |
LIST |
List for chains of comparable items |
NOMC |
Nominalized clause |
NOMCSUBJ |
Nominalized clausal subject |
NOMCSUBJPASS |
Nominalized clausal passive |
NUMC |
Compound of numeric modifier |
COP |
Copula |
DISLOCATED |
Dislocated relation (for fronted/topicalized elements) |
ASP |
Aspect marker |
GMOD |
Genitive modifier |
GOBJ |
Genitive object |
INFMOD |
Infinitival modifier |
MES |
Measure |
NCOMP |
Nominal complement of a noun |
Document
Represents the input to API methods.
Fields | |
---|---|
type |
Required. If the type is not set or is |
language |
The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. |
reference_web_uri |
The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document. |
boilerplate_handling |
Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content. |
Union field source . The source of the document: a string containing the content or a Google Cloud Storage URI. source can be only one of the following: |
|
content |
The content of the input in string format. Cloud audit logging exempt since it is based on user data. |
gcs_content_uri |
The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported. |
BoilerplateHandling
Ways of handling boilerplate detected in the document
Enums | |
---|---|
BOILERPLATE_HANDLING_UNSPECIFIED |
The boilerplate handling is not specified. |
SKIP_BOILERPLATE |
Do not analyze detected boilerplate. Reference web URI is required for detecting boilerplate. |
KEEP_BOILERPLATE |
Treat boilerplate the same as content. |
Type
The document types enum.
Enums | |
---|---|
TYPE_UNSPECIFIED |
The content type is not specified. |
PLAIN_TEXT |
Plain text |
HTML |
HTML |
EncodingType
Represents the text encoding that the caller uses to process the output. Providing an EncodingType
is recommended because the API provides the beginning offsets for various outputs, such as tokens and mentions, and languages that natively use different text encodings may access offsets differently.
Enums | |
---|---|
NONE |
If EncodingType is not specified, encoding-dependent information (such as begin_offset ) will be set at -1 . |
UTF8 |
Encoding-dependent information (such as begin_offset ) is calculated based on the UTF-8 encoding of the input. C++ and Go are examples of languages that use this encoding natively. |
UTF16 |
Encoding-dependent information (such as begin_offset ) is calculated based on the UTF-16 encoding of the input. Java and JavaScript are examples of languages that use this encoding natively. |
UTF32 |
Encoding-dependent information (such as begin_offset ) is calculated based on the UTF-32 encoding of the input. Python is an example of a language that uses this encoding natively. |
Entity
Represents a phrase in the text that is a known entity, such as a person, an organization, or location. The API associates information, such as salience and mentions, with entities.
Fields | |
---|---|
name |
The representative name for the entity. |
type |
The entity type. |
metadata |
Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL ( |
salience |
The salience score associated with the entity in the [0, 1.0] range. The salience score for an entity provides information about the importance or centrality of that entity to the entire document text. Scores closer to 0 are less salient, while scores closer to 1.0 are highly salient. |
mentions[] |
The mentions of this entity in the input document. The API currently supports proper noun mentions. |
sentiment |
For calls to [AnalyzeEntitySentiment][] or if |
Type
The type of the entity. For most entity types, the associated metadata is a Wikipedia URL (wikipedia_url
) and Knowledge Graph MID (mid
). The table below lists the associated fields for entities that have different metadata.
Enums | |
---|---|
UNKNOWN |
Unknown |
PERSON |
Person |
LOCATION |
Location |
ORGANIZATION |
Organization |
EVENT |
Event |
WORK_OF_ART |
Artwork |
CONSUMER_GOOD |
Consumer product |
OTHER |
Other types of entities |
PHONE_NUMBER |
Phone number The metadata lists the phone number, formatted according to local convention, plus whichever additional elements appear in the text:
|
ADDRESS |
Address The metadata identifies the street number and locality plus whichever additional elements appear in the text:
|
DATE |
Date The metadata identifies the components of the date:
|
NUMBER |
Number The metadata is the number itself. |
PRICE |
Price The metadata identifies the |
EntityMention
Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
Fields | |
---|---|
text |
The mention text. |
type |
The type of the entity mention. |
sentiment |
For calls to [AnalyzeEntitySentiment][] or if |
Type
The supported types of mentions.
Enums | |
---|---|
TYPE_UNKNOWN |
Unknown |
PROPER |
Proper name |
COMMON |
Common noun (or noun compound) |
ModerateTextRequest
The document moderation request message.
Fields | |
---|---|
document |
Required. Input document. |
ModerateTextResponse
The document moderation response message.
Fields | |
---|---|
moderation_categories[] |
Harmful and sensitive categories representing the input document. |
PartOfSpeech
Represents part of speech information for a token.
Fields | |
---|---|
tag |
The part of speech tag. |
aspect |
The grammatical aspect. |
case |
The grammatical case. |
form |
The grammatical form. |
gender |
The grammatical gender. |
mood |
The grammatical mood. |
number |
The grammatical number. |
person |
The grammatical person. |
proper |
The grammatical properness. |
reciprocity |
The grammatical reciprocity. |
tense |
The grammatical tense. |
voice |
The grammatical voice. |
Aspect
The characteristic of a verb that expresses time flow during an event.
Enums | |
---|---|
ASPECT_UNKNOWN |
Aspect is not applicable in the analyzed language or is not predicted. |
PERFECTIVE |
Perfective |
IMPERFECTIVE |
Imperfective |
PROGRESSIVE |
Progressive |
Case
The grammatical function performed by a noun or pronoun in a phrase, clause, or sentence. In some languages, other parts of speech, such as adjective and determiner, take case inflection in agreement with the noun.
Enums | |
---|---|
CASE_UNKNOWN |
Case is not applicable in the analyzed language or is not predicted. |
ACCUSATIVE |
Accusative |
ADVERBIAL |
Adverbial |
COMPLEMENTIVE |
Complementive |
DATIVE |
Dative |
GENITIVE |
Genitive |
INSTRUMENTAL |
Instrumental |
LOCATIVE |
Locative |
NOMINATIVE |
Nominative |
OBLIQUE |
Oblique |
PARTITIVE |
Partitive |
PREPOSITIONAL |
Prepositional |
REFLEXIVE_CASE |
Reflexive |
RELATIVE_CASE |
Relative |
VOCATIVE |
Vocative |
Form
Depending on the language, Form can be categorizing different forms of verbs, adjectives, adverbs, etc. For example, categorizing inflected endings of verbs and adjectives or distinguishing between short and long forms of adjectives and participles
Enums | |
---|---|
FORM_UNKNOWN |
Form is not applicable in the analyzed language or is not predicted. |
ADNOMIAL |
Adnomial |
AUXILIARY |
Auxiliary |
COMPLEMENTIZER |
Complementizer |
FINAL_ENDING |
Final ending |
GERUND |
Gerund |
REALIS |
Realis |
IRREALIS |
Irrealis |
SHORT |
Short form |
LONG |
Long form |
ORDER |
Order form |
SPECIFIC |
Specific form |
Gender
Gender classes of nouns reflected in the behaviour of associated words.
Enums | |
---|---|
GENDER_UNKNOWN |
Gender is not applicable in the analyzed language or is not predicted. |
FEMININE |
Feminine |
MASCULINE |
Masculine |
NEUTER |
Neuter |
Mood
The grammatical feature of verbs, used for showing modality and attitude.
Enums | |
---|---|
MOOD_UNKNOWN |
Mood is not applicable in the analyzed language or is not predicted. |
CONDITIONAL_MOOD |
Conditional |
IMPERATIVE |
Imperative |
INDICATIVE |
Indicative |
INTERROGATIVE |
Interrogative |
JUSSIVE |
Jussive |
SUBJUNCTIVE |
Subjunctive |
Number
Count distinctions.
Enums | |
---|---|
NUMBER_UNKNOWN |
Number is not applicable in the analyzed language or is not predicted. |
SINGULAR |
Singular |
PLURAL |
Plural |
DUAL |
Dual |
Person
The distinction between the speaker, second person, third person, etc.
Enums | |
---|---|
PERSON_UNKNOWN |
Person is not applicable in the analyzed language or is not predicted. |
FIRST |
First |
SECOND |
Second |
THIRD |
Third |
REFLEXIVE_PERSON |
Reflexive |
Proper
This category shows if the token is part of a proper name.
Enums | |
---|---|
PROPER_UNKNOWN |
Proper is not applicable in the analyzed language or is not predicted. |
PROPER |
Proper |
NOT_PROPER |
Not proper |
Reciprocity
Reciprocal features of a pronoun.
Enums | |
---|---|
RECIPROCITY_UNKNOWN |
Reciprocity is not applicable in the analyzed language or is not predicted. |
RECIPROCAL |
Reciprocal |
NON_RECIPROCAL |
Non-reciprocal |
Tag
The part of speech tags enum.
Enums | |
---|---|
UNKNOWN |
Unknown |
ADJ |
Adjective |
ADP |
Adposition (preposition and postposition) |
ADV |
Adverb |
CONJ |
Conjunction |
DET |
Determiner |
NOUN |
Noun (common and proper) |
NUM |
Cardinal number |
PRON |
Pronoun |
PRT |
Particle or other function word |
PUNCT |
Punctuation |
VERB |
Verb (all tenses and modes) |
X |
Other: foreign words, typos, abbreviations |
AFFIX |
Affix |
Tense
Time reference.
Enums | |
---|---|
TENSE_UNKNOWN |
Tense is not applicable in the analyzed language or is not predicted. |
CONDITIONAL_TENSE |
Conditional |
FUTURE |
Future |
PAST |
Past |
PRESENT |
Present |
IMPERFECT |
Imperfect |
PLUPERFECT |
Pluperfect |
Voice
The relationship between the action that a verb expresses and the participants identified by its arguments.
Enums | |
---|---|
VOICE_UNKNOWN |
Voice is not applicable in the analyzed language or is not predicted. |
ACTIVE |
Active |
CAUSATIVE |
Causative |
PASSIVE |
Passive |
Sentence
Represents a sentence in the input document.
Fields | |
---|---|
text |
The sentence text. |
sentiment |
For calls to [AnalyzeSentiment][] or if |
Sentiment
Represents the feeling associated with the entire text or entities in the text. Next ID: 6
Fields | |
---|---|
magnitude |
A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). |
score |
Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). |
TextSpan
Represents a text span in the input document.
Fields | |
---|---|
content |
The content of the text span, which is a substring of the document. |
begin_offset |
The API calculates the beginning offset of the content in the original document according to the |
Token
Represents the smallest syntactic building block of the text.
Fields | |
---|---|
text |
The token text. |
part_of_speech |
Parts of speech tag for this token. |
dependency_edge |
Dependency tree parse for this token. |
lemma |
Lemma of the token. |