AnnotateText Processor
Part of the GCP Natural Language processor family
This processor is a convenience-based processor that combines the capabilities of the AnalyzeSyntax, AnalyzeEntities, AnalyzeSentiment, and ClassifyText processors into one unit.
Both the entities and sentences returned from this processor will have a sentiment attached them.
The output of this processor can easily grow to be incredibly large, especially with large pieces of text. Unless you're actually looking for all of this information at once, consider using the processors with a more granular scope.
Properties
This processor does not have any unique properties outside of the common ones.
Data Output
Field Name
Data Type
Description
sentences
array of Sentence
The list of sentences found by the API
entities
array of Entity
The list of entities found by the API
categories
array of Category
The list of categories found by the API
tokens
array of Token
The list of tokens found by the API
overallSentiment
Sentiment
The sentiment of the text as a whole
language
string
The language code of the language the input string is in
Token
TokenField Name
Data Type
Description
text
string
The raw text of this token
beginOffset
int
The number of characters from the beginning of the input string to the beginning of this token
partOfSpeech
PartOfSpeech
A comprehensive list of all of the syntactical information pertaining to this token, such as gender, quantity, person, etcetera.
Sentiment
SentimentField Name
Data Type
Description
score
float
A number ranging from -1.0 (negative sentiment) to 1.0 (positive sentiment)
magnitude
float
A number ranging from 0 to +inf representing the absolute magnitude of the sentiment (regardless of score). This number can be thought of as the strength of the emotion (e.g., something being very positive, or slightly negative)
Sentence
SentenceField Name
Data Type
Description
text
string
The raw text of this sentence
beginOffset
int
The number of characters from the beginning of the input string to the beginning of this sentence
sentiment
Sentiment
The sentiment of this sentence
DependencyEdge
DependencyEdgeField Name
Data Type
Description
headTokenIndex
int
Represents the head of the token in the dependency tree
PartOfSpeech
PartOfSpeechField Name
Data Type
Description
case
string (Case)
The grammatical function performed by a noun or pronoun in a phrase, clause, or sentence
form
string (Form)
Depending on the language, Form can be categorizing different forms of verbs, adjectives, adverbs, etcetera
voice
string (Voice)
The relationship between the action that a verb expresses and the participants identified by its arguments
Category
CategoryField Name
Data Type
Description
confidence
float
How confident the API is in its response
// This example has the tokens field omitted for bevity. For an extensive
// example of the tokens field, view the AnalyzeSyntax processor's example output.
{
"output":{
"overallSentiment":{
"score":0.5,
"magnitude":1.7
},
"tokens": [],
"entities":[
{
"metadata":{
"wikipedia_url":"https:\/\/en.wikipedia.org\/wiki\/James_Adams_(entrepreneur)",
"mid":"\/m\/0136zb57"
},
"mentions":[
{
"sentiment":{
"score":0.9,
"magnitude":0.9
},
"text":"James Adams",
"type":"PROPER",
"beginOffset":-1
},
{
"sentiment":{
"score":0.9,
"magnitude":0.9
},
"text":"developer",
"type":"COMMON",
"beginOffset":-1
}
],
"type":"PERSON"
},
{
"metadata":{
},
"mentions":[
{
"sentiment":{
"score":0.0,
"magnitude":0.0
},
"text":"scene",
"type":"COMMON",
"beginOffset":-1
}
],
"type":"LOCATION"
},
{
"metadata":{
},
"mentions":[
{
"sentiment":{
"score":0.9,
"magnitude":0.9
},
"text":"attitude",
"type":"COMMON",
"beginOffset":-1
}
],
"type":"OTHER"
},
{
"metadata":{
},
"mentions":[
{
"sentiment":{
"score":0.9,
"magnitude":0.9
},
"text":"work ethic",
"type":"COMMON",
"beginOffset":-1
}
],
"type":"OTHER"
},
{
"metadata":{
},
"mentions":[
{
"sentiment":{
"score":0.0,
"magnitude":0.0
},
"text":"company",
"type":"COMMON",
"beginOffset":-1
}
],
"type":"ORGANIZATION"
},
{
"metadata":{
},
"mentions":[
{
"sentiment":{
"score":0.5,
"magnitude":0.5
},
"text":"character",
"type":"COMMON",
"beginOffset":-1
}
],
"type":"PERSON"
}
],
"sentences":[
{
"sentiment":{
"score":0.6,
"magnitude":0.6
},
"text":"James Adams is a fantastic developer who has been on the scene for over ten years.",
"beginOffset":-1
},
{
"sentiment":{
"score":0.9,
"magnitude":0.9
},
"text":"His excellent attitude and steady work ethic contribute to his character.",
"beginOffset":-1
},
{
"sentiment":{
"score":0.2,
"magnitude":0.2
},
"text":"May he stay with our company for many years to come.",
"beginOffset":-1
}
],
"language":"en",
"categories":[
{
"confidence":0.81,
"name":"\/Arts & Entertainment"
}
]
},
"raw-input":"James Adams is a fantastic developer who has been on the scene for over ten years. His excellent attitude and steady work ethic contribute to his character. May he stay with our company for many years to come."
}Last updated
Was this helpful?