1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="language_v1beta2.html">Cloud Natural Language API</a> . <a href="language_v1beta2.documents.html">documents</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</a></code></p> 79<p class="firstline">Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.</p> 80<p class="toc_element"> 81 <code><a href="#analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</a></code></p> 82<p class="firstline">Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.</p> 83<p class="toc_element"> 84 <code><a href="#analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</a></code></p> 85<p class="firstline">Analyzes the sentiment of the provided text.</p> 86<p class="toc_element"> 87 <code><a href="#analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</a></code></p> 88<p class="firstline">Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.</p> 89<p class="toc_element"> 90 <code><a href="#annotateText">annotateText(body=None, x__xgafv=None)</a></code></p> 91<p class="firstline">A convenience method that provides all syntax, sentiment, entity, and classification features in one call.</p> 92<p class="toc_element"> 93 <code><a href="#classifyText">classifyText(body=None, x__xgafv=None)</a></code></p> 94<p class="firstline">Classifies a document into categories.</p> 95<p class="toc_element"> 96 <code><a href="#close">close()</a></code></p> 97<p class="firstline">Close httplib2 connections.</p> 98<h3>Method Details</h3> 99<div class="method"> 100 <code class="details" id="analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</code> 101 <pre>Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties. 102 103Args: 104 body: object, The request body. 105 The object takes the form of: 106 107{ # The entity analysis request message. 108 "document": { # ################################################################ # Represents the input to API methods. # Required. Input document. 109 "boilerplateHandling": "A String", # 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. 110 "content": "A String", # The content of the input in string format. Cloud audit logging exempt since it is based on user data. 111 "gcsContentUri": "A String", # 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. 112 "language": "A String", # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned. 113 "referenceWebUri": "A String", # 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. 114 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. 115 }, 116 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 117} 118 119 x__xgafv: string, V1 error format. 120 Allowed values 121 1 - v1 error format 122 2 - v2 error format 123 124Returns: 125 An object of the form: 126 127 { # The entity analysis response message. 128 "entities": [ # The recognized entities in the input document. 129 { # 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. 130 "mentions": [ # The mentions of this entity in the input document. The API currently supports proper noun mentions. 131 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported. 132 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of the entity in the provided document. 133 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 134 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 135 }, 136 "text": { # Represents an output piece of text. # The mention text. 137 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 138 "content": "A String", # The content of the output text. 139 }, 140 "type": "A String", # The type of the entity mention. 141 }, 142 ], 143 "metadata": { # Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the metadata associated with other entity types, see the Type table below. 144 "a_key": "A String", 145 }, 146 "name": "A String", # The representative name for the entity. 147 "salience": 3.14, # 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. 148 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document. 149 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 150 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 151 }, 152 "type": "A String", # The entity type. 153 }, 154 ], 155 "language": "A String", # 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 Document.language field for more details. 156}</pre> 157</div> 158 159<div class="method"> 160 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</code> 161 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions. 162 163Args: 164 body: object, The request body. 165 The object takes the form of: 166 167{ # The entity-level sentiment analysis request message. 168 "document": { # ################################################################ # Represents the input to API methods. # Required. Input document. 169 "boilerplateHandling": "A String", # 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. 170 "content": "A String", # The content of the input in string format. Cloud audit logging exempt since it is based on user data. 171 "gcsContentUri": "A String", # 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. 172 "language": "A String", # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned. 173 "referenceWebUri": "A String", # 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. 174 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. 175 }, 176 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 177} 178 179 x__xgafv: string, V1 error format. 180 Allowed values 181 1 - v1 error format 182 2 - v2 error format 183 184Returns: 185 An object of the form: 186 187 { # The entity-level sentiment analysis response message. 188 "entities": [ # The recognized entities in the input document with associated sentiments. 189 { # 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. 190 "mentions": [ # The mentions of this entity in the input document. The API currently supports proper noun mentions. 191 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported. 192 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of the entity in the provided document. 193 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 194 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 195 }, 196 "text": { # Represents an output piece of text. # The mention text. 197 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 198 "content": "A String", # The content of the output text. 199 }, 200 "type": "A String", # The type of the entity mention. 201 }, 202 ], 203 "metadata": { # Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the metadata associated with other entity types, see the Type table below. 204 "a_key": "A String", 205 }, 206 "name": "A String", # The representative name for the entity. 207 "salience": 3.14, # 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. 208 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document. 209 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 210 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 211 }, 212 "type": "A String", # The entity type. 213 }, 214 ], 215 "language": "A String", # 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 Document.language field for more details. 216}</pre> 217</div> 218 219<div class="method"> 220 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code> 221 <pre>Analyzes the sentiment of the provided text. 222 223Args: 224 body: object, The request body. 225 The object takes the form of: 226 227{ # The sentiment analysis request message. 228 "document": { # ################################################################ # Represents the input to API methods. # Required. Input document. 229 "boilerplateHandling": "A String", # 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. 230 "content": "A String", # The content of the input in string format. Cloud audit logging exempt since it is based on user data. 231 "gcsContentUri": "A String", # 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. 232 "language": "A String", # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned. 233 "referenceWebUri": "A String", # 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. 234 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. 235 }, 236 "encodingType": "A String", # The encoding type used by the API to calculate sentence offsets for the sentence sentiment. 237} 238 239 x__xgafv: string, V1 error format. 240 Allowed values 241 1 - v1 error format 242 2 - v2 error format 243 244Returns: 245 An object of the form: 246 247 { # The sentiment analysis response message. 248 "documentSentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # The overall sentiment of the input document. 249 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 250 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 251 }, 252 "language": "A String", # 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 Document.language field for more details. 253 "sentences": [ # The sentiment for all the sentences in the document. 254 { # Represents a sentence in the input document. 255 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence. 256 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 257 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 258 }, 259 "text": { # Represents an output piece of text. # The sentence text. 260 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 261 "content": "A String", # The content of the output text. 262 }, 263 }, 264 ], 265}</pre> 266</div> 267 268<div class="method"> 269 <code class="details" id="analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</code> 270 <pre>Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties. 271 272Args: 273 body: object, The request body. 274 The object takes the form of: 275 276{ # The syntax analysis request message. 277 "document": { # ################################################################ # Represents the input to API methods. # Required. Input document. 278 "boilerplateHandling": "A String", # 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. 279 "content": "A String", # The content of the input in string format. Cloud audit logging exempt since it is based on user data. 280 "gcsContentUri": "A String", # 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. 281 "language": "A String", # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned. 282 "referenceWebUri": "A String", # 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. 283 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. 284 }, 285 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 286} 287 288 x__xgafv: string, V1 error format. 289 Allowed values 290 1 - v1 error format 291 2 - v2 error format 292 293Returns: 294 An object of the form: 295 296 { # The syntax analysis response message. 297 "language": "A String", # 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 Document.language field for more details. 298 "sentences": [ # Sentences in the input document. 299 { # Represents a sentence in the input document. 300 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence. 301 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 302 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 303 }, 304 "text": { # Represents an output piece of text. # The sentence text. 305 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 306 "content": "A String", # The content of the output text. 307 }, 308 }, 309 ], 310 "tokens": [ # Tokens, along with their syntactic information, in the input document. 311 { # Represents the smallest syntactic building block of the text. 312 "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token. 313 "headTokenIndex": 42, # 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 `head_token_index` is its own index. 314 "label": "A String", # The parse label for the token. 315 }, 316 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. 317 "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token. 318 "aspect": "A String", # The grammatical aspect. 319 "case": "A String", # The grammatical case. 320 "form": "A String", # The grammatical form. 321 "gender": "A String", # The grammatical gender. 322 "mood": "A String", # The grammatical mood. 323 "number": "A String", # The grammatical number. 324 "person": "A String", # The grammatical person. 325 "proper": "A String", # The grammatical properness. 326 "reciprocity": "A String", # The grammatical reciprocity. 327 "tag": "A String", # The part of speech tag. 328 "tense": "A String", # The grammatical tense. 329 "voice": "A String", # The grammatical voice. 330 }, 331 "text": { # Represents an output piece of text. # The token text. 332 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 333 "content": "A String", # The content of the output text. 334 }, 335 }, 336 ], 337}</pre> 338</div> 339 340<div class="method"> 341 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code> 342 <pre>A convenience method that provides all syntax, sentiment, entity, and classification features in one call. 343 344Args: 345 body: object, The request body. 346 The object takes the form of: 347 348{ # The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call. 349 "document": { # ################################################################ # Represents the input to API methods. # Required. Input document. 350 "boilerplateHandling": "A String", # 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. 351 "content": "A String", # The content of the input in string format. Cloud audit logging exempt since it is based on user data. 352 "gcsContentUri": "A String", # 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. 353 "language": "A String", # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned. 354 "referenceWebUri": "A String", # 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. 355 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. 356 }, 357 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 358 "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: 10 # Required. The enabled features. 359 "classifyText": True or False, # Classify the full document into categories. If this is true, the API will use the default model which classifies into a [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories). 360 "extractDocumentSentiment": True or False, # Extract document-level sentiment. 361 "extractEntities": True or False, # Extract entities. 362 "extractEntitySentiment": True or False, # Extract entities and their associated sentiment. 363 "extractSyntax": True or False, # Extract syntax information. 364 }, 365} 366 367 x__xgafv: string, V1 error format. 368 Allowed values 369 1 - v1 error format 370 2 - v2 error format 371 372Returns: 373 An object of the form: 374 375 { # The text annotations response message. 376 "categories": [ # Categories identified in the input document. 377 { # Represents a category returned from the text classifier. 378 "confidence": 3.14, # The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text. 379 "name": "A String", # The name of the category representing the document, from the [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories). 380 }, 381 ], 382 "documentSentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # The overall sentiment for the document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment. 383 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 384 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 385 }, 386 "entities": [ # Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities. 387 { # 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. 388 "mentions": [ # The mentions of this entity in the input document. The API currently supports proper noun mentions. 389 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported. 390 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of the entity in the provided document. 391 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 392 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 393 }, 394 "text": { # Represents an output piece of text. # The mention text. 395 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 396 "content": "A String", # The content of the output text. 397 }, 398 "type": "A String", # The type of the entity mention. 399 }, 400 ], 401 "metadata": { # Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the metadata associated with other entity types, see the Type table below. 402 "a_key": "A String", 403 }, 404 "name": "A String", # The representative name for the entity. 405 "salience": 3.14, # 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. 406 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document. 407 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 408 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 409 }, 410 "type": "A String", # The entity type. 411 }, 412 ], 413 "language": "A String", # 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 Document.language field for more details. 414 "sentences": [ # Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax. 415 { # Represents a sentence in the input document. 416 "sentiment": { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence. 417 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). 418 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). 419 }, 420 "text": { # Represents an output piece of text. # The sentence text. 421 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 422 "content": "A String", # The content of the output text. 423 }, 424 }, 425 ], 426 "tokens": [ # Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax. 427 { # Represents the smallest syntactic building block of the text. 428 "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token. 429 "headTokenIndex": 42, # 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 `head_token_index` is its own index. 430 "label": "A String", # The parse label for the token. 431 }, 432 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. 433 "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token. 434 "aspect": "A String", # The grammatical aspect. 435 "case": "A String", # The grammatical case. 436 "form": "A String", # The grammatical form. 437 "gender": "A String", # The grammatical gender. 438 "mood": "A String", # The grammatical mood. 439 "number": "A String", # The grammatical number. 440 "person": "A String", # The grammatical person. 441 "proper": "A String", # The grammatical properness. 442 "reciprocity": "A String", # The grammatical reciprocity. 443 "tag": "A String", # The part of speech tag. 444 "tense": "A String", # The grammatical tense. 445 "voice": "A String", # The grammatical voice. 446 }, 447 "text": { # Represents an output piece of text. # The token text. 448 "beginOffset": 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request. 449 "content": "A String", # The content of the output text. 450 }, 451 }, 452 ], 453}</pre> 454</div> 455 456<div class="method"> 457 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code> 458 <pre>Classifies a document into categories. 459 460Args: 461 body: object, The request body. 462 The object takes the form of: 463 464{ # The document classification request message. 465 "document": { # ################################################################ # Represents the input to API methods. # Required. Input document. 466 "boilerplateHandling": "A String", # 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. 467 "content": "A String", # The content of the input in string format. Cloud audit logging exempt since it is based on user data. 468 "gcsContentUri": "A String", # 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. 469 "language": "A String", # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned. 470 "referenceWebUri": "A String", # 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. 471 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. 472 }, 473} 474 475 x__xgafv: string, V1 error format. 476 Allowed values 477 1 - v1 error format 478 2 - v2 error format 479 480Returns: 481 An object of the form: 482 483 { # The document classification response message. 484 "categories": [ # Categories representing the input document. 485 { # Represents a category returned from the text classifier. 486 "confidence": 3.14, # The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text. 487 "name": "A String", # The name of the category representing the document, from the [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories). 488 }, 489 ], 490}</pre> 491</div> 492 493<div class="method"> 494 <code class="details" id="close">close()</code> 495 <pre>Close httplib2 connections.</pre> 496</div> 497 498</body></html>