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_v1.html">Cloud Natural Language API</a> . <a href="language_v1.documents.html">documents</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#analyzeEntities">analyzeEntities(body, x__xgafv=None)</a></code></p> 79<p class="firstline">Finds named entities (currently proper names and common nouns) in the text</p> 80<p class="toc_element"> 81 <code><a href="#analyzeEntitySentiment">analyzeEntitySentiment(body, x__xgafv=None)</a></code></p> 82<p class="firstline">Finds entities, similar to AnalyzeEntities in the text and analyzes</p> 83<p class="toc_element"> 84 <code><a href="#analyzeSentiment">analyzeSentiment(body, 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, x__xgafv=None)</a></code></p> 88<p class="firstline">Analyzes the syntax of the text and provides sentence boundaries and</p> 89<p class="toc_element"> 90 <code><a href="#annotateText">annotateText(body, x__xgafv=None)</a></code></p> 91<p class="firstline">A convenience method that provides all the features that analyzeSentiment,</p> 92<p class="toc_element"> 93 <code><a href="#classifyText">classifyText(body, x__xgafv=None)</a></code></p> 94<p class="firstline">Classifies a document into categories.</p> 95<h3>Method Details</h3> 96<div class="method"> 97 <code class="details" id="analyzeEntities">analyzeEntities(body, x__xgafv=None)</code> 98 <pre>Finds named entities (currently proper names and common nouns) in the text 99along with entity types, salience, mentions for each entity, and 100other properties. 101 102Args: 103 body: object, The request body. (required) 104 The object takes the form of: 105 106{ # The entity analysis request message. 107 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 108 "document": { # ################################################################ # # Input document. 109 # 110 # Represents the input to API methods. 111 "content": "A String", # The content of the input in string format. 112 # Cloud audit logging exempt since it is based on user data. 113 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, 114 # returns an `INVALID_ARGUMENT` error. 115 "language": "A String", # The language of the document (if not specified, the language is 116 # automatically detected). Both ISO and BCP-47 language codes are 117 # accepted.<br> 118 # [Language Support](/natural-language/docs/languages) 119 # lists currently supported languages for each API method. 120 # If the language (either specified by the caller or automatically detected) 121 # is not supported by the called API method, an `INVALID_ARGUMENT` error 122 # is returned. 123 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. 124 # This URI must be of the form: gs://bucket_name/object_name. For more 125 # details, see https://cloud.google.com/storage/docs/reference-uris. 126 # NOTE: Cloud Storage object versioning is not supported. 127 }, 128 } 129 130 x__xgafv: string, V1 error format. 131 Allowed values 132 1 - v1 error format 133 2 - v2 error format 134 135Returns: 136 An object of the form: 137 138 { # The entity analysis response message. 139 "entities": [ # The recognized entities in the input document. 140 { # Represents a phrase in the text that is a known entity, such as 141 # a person, an organization, or location. The API associates information, such 142 # as salience and mentions, with entities. 143 "name": "A String", # The representative name for the entity. 144 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if 145 # AnnotateTextRequest.Features.extract_entity_sentiment is set to 146 # true, this field will contain the aggregate sentiment expressed for this 147 # entity in the provided document. 148 # the text. 149 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 150 # (positive sentiment). 151 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 152 # the absolute magnitude of sentiment regardless of score (positive or 153 # negative). 154 }, 155 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range. 156 # 157 # The salience score for an entity provides information about the 158 # importance or centrality of that entity to the entire document text. 159 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly 160 # salient. 161 "mentions": [ # The mentions of this entity in the input document. The API currently 162 # supports proper noun mentions. 163 { # Represents a mention for an entity in the text. Currently, proper noun 164 # mentions are supported. 165 "text": { # Represents an output piece of text. # The mention text. 166 "content": "A String", # The content of the output text. 167 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 168 # document according to the EncodingType specified in the API request. 169 }, 170 "type": "A String", # The type of the entity mention. 171 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if 172 # AnnotateTextRequest.Features.extract_entity_sentiment is set to 173 # true, this field will contain the sentiment expressed for this mention of 174 # the entity in the provided document. 175 # the text. 176 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 177 # (positive sentiment). 178 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 179 # the absolute magnitude of sentiment regardless of score (positive or 180 # negative). 181 }, 182 }, 183 ], 184 "type": "A String", # The entity type. 185 "metadata": { # Metadata associated with the entity. 186 # 187 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 188 # and Knowledge Graph MID (`mid`), if they are available. For the metadata 189 # associated with other entity types, see the Type table below. 190 "a_key": "A String", 191 }, 192 }, 193 ], 194 "language": "A String", # The language of the text, which will be the same as the language specified 195 # in the request or, if not specified, the automatically-detected language. 196 # See Document.language field for more details. 197 }</pre> 198</div> 199 200<div class="method"> 201 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body, x__xgafv=None)</code> 202 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes 203sentiment associated with each entity and its mentions. 204 205Args: 206 body: object, The request body. (required) 207 The object takes the form of: 208 209{ # The entity-level sentiment analysis request message. 210 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 211 "document": { # ################################################################ # # Input document. 212 # 213 # Represents the input to API methods. 214 "content": "A String", # The content of the input in string format. 215 # Cloud audit logging exempt since it is based on user data. 216 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, 217 # returns an `INVALID_ARGUMENT` error. 218 "language": "A String", # The language of the document (if not specified, the language is 219 # automatically detected). Both ISO and BCP-47 language codes are 220 # accepted.<br> 221 # [Language Support](/natural-language/docs/languages) 222 # lists currently supported languages for each API method. 223 # If the language (either specified by the caller or automatically detected) 224 # is not supported by the called API method, an `INVALID_ARGUMENT` error 225 # is returned. 226 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. 227 # This URI must be of the form: gs://bucket_name/object_name. For more 228 # details, see https://cloud.google.com/storage/docs/reference-uris. 229 # NOTE: Cloud Storage object versioning is not supported. 230 }, 231 } 232 233 x__xgafv: string, V1 error format. 234 Allowed values 235 1 - v1 error format 236 2 - v2 error format 237 238Returns: 239 An object of the form: 240 241 { # The entity-level sentiment analysis response message. 242 "entities": [ # The recognized entities in the input document with associated sentiments. 243 { # Represents a phrase in the text that is a known entity, such as 244 # a person, an organization, or location. The API associates information, such 245 # as salience and mentions, with entities. 246 "name": "A String", # The representative name for the entity. 247 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if 248 # AnnotateTextRequest.Features.extract_entity_sentiment is set to 249 # true, this field will contain the aggregate sentiment expressed for this 250 # entity in the provided document. 251 # the text. 252 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 253 # (positive sentiment). 254 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 255 # the absolute magnitude of sentiment regardless of score (positive or 256 # negative). 257 }, 258 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range. 259 # 260 # The salience score for an entity provides information about the 261 # importance or centrality of that entity to the entire document text. 262 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly 263 # salient. 264 "mentions": [ # The mentions of this entity in the input document. The API currently 265 # supports proper noun mentions. 266 { # Represents a mention for an entity in the text. Currently, proper noun 267 # mentions are supported. 268 "text": { # Represents an output piece of text. # The mention text. 269 "content": "A String", # The content of the output text. 270 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 271 # document according to the EncodingType specified in the API request. 272 }, 273 "type": "A String", # The type of the entity mention. 274 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if 275 # AnnotateTextRequest.Features.extract_entity_sentiment is set to 276 # true, this field will contain the sentiment expressed for this mention of 277 # the entity in the provided document. 278 # the text. 279 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 280 # (positive sentiment). 281 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 282 # the absolute magnitude of sentiment regardless of score (positive or 283 # negative). 284 }, 285 }, 286 ], 287 "type": "A String", # The entity type. 288 "metadata": { # Metadata associated with the entity. 289 # 290 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 291 # and Knowledge Graph MID (`mid`), if they are available. For the metadata 292 # associated with other entity types, see the Type table below. 293 "a_key": "A String", 294 }, 295 }, 296 ], 297 "language": "A String", # The language of the text, which will be the same as the language specified 298 # in the request or, if not specified, the automatically-detected language. 299 # See Document.language field for more details. 300 }</pre> 301</div> 302 303<div class="method"> 304 <code class="details" id="analyzeSentiment">analyzeSentiment(body, x__xgafv=None)</code> 305 <pre>Analyzes the sentiment of the provided text. 306 307Args: 308 body: object, The request body. (required) 309 The object takes the form of: 310 311{ # The sentiment analysis request message. 312 "document": { # ################################################################ # # Input document. 313 # 314 # Represents the input to API methods. 315 "content": "A String", # The content of the input in string format. 316 # Cloud audit logging exempt since it is based on user data. 317 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, 318 # returns an `INVALID_ARGUMENT` error. 319 "language": "A String", # The language of the document (if not specified, the language is 320 # automatically detected). Both ISO and BCP-47 language codes are 321 # accepted.<br> 322 # [Language Support](/natural-language/docs/languages) 323 # lists currently supported languages for each API method. 324 # If the language (either specified by the caller or automatically detected) 325 # is not supported by the called API method, an `INVALID_ARGUMENT` error 326 # is returned. 327 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. 328 # This URI must be of the form: gs://bucket_name/object_name. For more 329 # details, see https://cloud.google.com/storage/docs/reference-uris. 330 # NOTE: Cloud Storage object versioning is not supported. 331 }, 332 "encodingType": "A String", # The encoding type used by the API to calculate sentence offsets. 333 } 334 335 x__xgafv: string, V1 error format. 336 Allowed values 337 1 - v1 error format 338 2 - v2 error format 339 340Returns: 341 An object of the form: 342 343 { # The sentiment analysis response message. 344 "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment of the input document. 345 # the text. 346 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 347 # (positive sentiment). 348 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 349 # the absolute magnitude of sentiment regardless of score (positive or 350 # negative). 351 }, 352 "language": "A String", # The language of the text, which will be the same as the language specified 353 # in the request or, if not specified, the automatically-detected language. 354 # See Document.language field for more details. 355 "sentences": [ # The sentiment for all the sentences in the document. 356 { # Represents a sentence in the input document. 357 "text": { # Represents an output piece of text. # The sentence text. 358 "content": "A String", # The content of the output text. 359 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 360 # document according to the EncodingType specified in the API request. 361 }, 362 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if 363 # AnnotateTextRequest.Features.extract_document_sentiment is set to 364 # true, this field will contain the sentiment for the sentence. 365 # the text. 366 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 367 # (positive sentiment). 368 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 369 # the absolute magnitude of sentiment regardless of score (positive or 370 # negative). 371 }, 372 }, 373 ], 374 }</pre> 375</div> 376 377<div class="method"> 378 <code class="details" id="analyzeSyntax">analyzeSyntax(body, x__xgafv=None)</code> 379 <pre>Analyzes the syntax of the text and provides sentence boundaries and 380tokenization along with part of speech tags, dependency trees, and other 381properties. 382 383Args: 384 body: object, The request body. (required) 385 The object takes the form of: 386 387{ # The syntax analysis request message. 388 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 389 "document": { # ################################################################ # # Input document. 390 # 391 # Represents the input to API methods. 392 "content": "A String", # The content of the input in string format. 393 # Cloud audit logging exempt since it is based on user data. 394 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, 395 # returns an `INVALID_ARGUMENT` error. 396 "language": "A String", # The language of the document (if not specified, the language is 397 # automatically detected). Both ISO and BCP-47 language codes are 398 # accepted.<br> 399 # [Language Support](/natural-language/docs/languages) 400 # lists currently supported languages for each API method. 401 # If the language (either specified by the caller or automatically detected) 402 # is not supported by the called API method, an `INVALID_ARGUMENT` error 403 # is returned. 404 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. 405 # This URI must be of the form: gs://bucket_name/object_name. For more 406 # details, see https://cloud.google.com/storage/docs/reference-uris. 407 # NOTE: Cloud Storage object versioning is not supported. 408 }, 409 } 410 411 x__xgafv: string, V1 error format. 412 Allowed values 413 1 - v1 error format 414 2 - v2 error format 415 416Returns: 417 An object of the form: 418 419 { # The syntax analysis response message. 420 "tokens": [ # Tokens, along with their syntactic information, in the input document. 421 { # Represents the smallest syntactic building block of the text. 422 "text": { # Represents an output piece of text. # The token text. 423 "content": "A String", # The content of the output text. 424 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 425 # document according to the EncodingType specified in the API request. 426 }, 427 "dependencyEdge": { # Represents dependency parse tree information for a token. (For more # Dependency tree parse for this token. 428 # information on dependency labels, see 429 # http://www.aclweb.org/anthology/P13-2017 430 "headTokenIndex": 42, # Represents the head of this token in the dependency tree. 431 # This is the index of the token which has an arc going to this token. 432 # The index is the position of the token in the array of tokens returned 433 # by the API method. If this token is a root token, then the 434 # `head_token_index` is its own index. 435 "label": "A String", # The parse label for the token. 436 }, 437 "partOfSpeech": { # Represents part of speech information for a token. Parts of speech # Parts of speech tag for this token. 438 # are as defined in 439 # http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf 440 "case": "A String", # The grammatical case. 441 "aspect": "A String", # The grammatical aspect. 442 "form": "A String", # The grammatical form. 443 "gender": "A String", # The grammatical gender. 444 "number": "A String", # The grammatical number. 445 "person": "A String", # The grammatical person. 446 "tag": "A String", # The part of speech tag. 447 "tense": "A String", # The grammatical tense. 448 "reciprocity": "A String", # The grammatical reciprocity. 449 "proper": "A String", # The grammatical properness. 450 "voice": "A String", # The grammatical voice. 451 "mood": "A String", # The grammatical mood. 452 }, 453 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. 454 }, 455 ], 456 "language": "A String", # The language of the text, which will be the same as the language specified 457 # in the request or, if not specified, the automatically-detected language. 458 # See Document.language field for more details. 459 "sentences": [ # Sentences in the input document. 460 { # Represents a sentence in the input document. 461 "text": { # Represents an output piece of text. # The sentence text. 462 "content": "A String", # The content of the output text. 463 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 464 # document according to the EncodingType specified in the API request. 465 }, 466 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if 467 # AnnotateTextRequest.Features.extract_document_sentiment is set to 468 # true, this field will contain the sentiment for the sentence. 469 # the text. 470 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 471 # (positive sentiment). 472 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 473 # the absolute magnitude of sentiment regardless of score (positive or 474 # negative). 475 }, 476 }, 477 ], 478 }</pre> 479</div> 480 481<div class="method"> 482 <code class="details" id="annotateText">annotateText(body, x__xgafv=None)</code> 483 <pre>A convenience method that provides all the features that analyzeSentiment, 484analyzeEntities, and analyzeSyntax provide in one call. 485 486Args: 487 body: object, The request body. (required) 488 The object takes the form of: 489 490{ # The request message for the text annotation API, which can perform multiple 491 # analysis types (sentiment, entities, and syntax) in one call. 492 "encodingType": "A String", # The encoding type used by the API to calculate offsets. 493 "features": { # All available features for sentiment, syntax, and semantic analysis. # The enabled features. 494 # Setting each one to true will enable that specific analysis for the input. 495 "classifyText": True or False, # Classify the full document into categories. 496 "extractEntitySentiment": True or False, # Extract entities and their associated sentiment. 497 "extractDocumentSentiment": True or False, # Extract document-level sentiment. 498 "extractEntities": True or False, # Extract entities. 499 "extractSyntax": True or False, # Extract syntax information. 500 }, 501 "document": { # ################################################################ # # Input document. 502 # 503 # Represents the input to API methods. 504 "content": "A String", # The content of the input in string format. 505 # Cloud audit logging exempt since it is based on user data. 506 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, 507 # returns an `INVALID_ARGUMENT` error. 508 "language": "A String", # The language of the document (if not specified, the language is 509 # automatically detected). Both ISO and BCP-47 language codes are 510 # accepted.<br> 511 # [Language Support](/natural-language/docs/languages) 512 # lists currently supported languages for each API method. 513 # If the language (either specified by the caller or automatically detected) 514 # is not supported by the called API method, an `INVALID_ARGUMENT` error 515 # is returned. 516 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. 517 # This URI must be of the form: gs://bucket_name/object_name. For more 518 # details, see https://cloud.google.com/storage/docs/reference-uris. 519 # NOTE: Cloud Storage object versioning is not supported. 520 }, 521 } 522 523 x__xgafv: string, V1 error format. 524 Allowed values 525 1 - v1 error format 526 2 - v2 error format 527 528Returns: 529 An object of the form: 530 531 { # The text annotations response message. 532 "language": "A String", # The language of the text, which will be the same as the language specified 533 # in the request or, if not specified, the automatically-detected language. 534 # See Document.language field for more details. 535 "tokens": [ # Tokens, along with their syntactic information, in the input document. 536 # Populated if the user enables 537 # AnnotateTextRequest.Features.extract_syntax. 538 { # Represents the smallest syntactic building block of the text. 539 "text": { # Represents an output piece of text. # The token text. 540 "content": "A String", # The content of the output text. 541 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 542 # document according to the EncodingType specified in the API request. 543 }, 544 "dependencyEdge": { # Represents dependency parse tree information for a token. (For more # Dependency tree parse for this token. 545 # information on dependency labels, see 546 # http://www.aclweb.org/anthology/P13-2017 547 "headTokenIndex": 42, # Represents the head of this token in the dependency tree. 548 # This is the index of the token which has an arc going to this token. 549 # The index is the position of the token in the array of tokens returned 550 # by the API method. If this token is a root token, then the 551 # `head_token_index` is its own index. 552 "label": "A String", # The parse label for the token. 553 }, 554 "partOfSpeech": { # Represents part of speech information for a token. Parts of speech # Parts of speech tag for this token. 555 # are as defined in 556 # http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf 557 "case": "A String", # The grammatical case. 558 "aspect": "A String", # The grammatical aspect. 559 "form": "A String", # The grammatical form. 560 "gender": "A String", # The grammatical gender. 561 "number": "A String", # The grammatical number. 562 "person": "A String", # The grammatical person. 563 "tag": "A String", # The part of speech tag. 564 "tense": "A String", # The grammatical tense. 565 "reciprocity": "A String", # The grammatical reciprocity. 566 "proper": "A String", # The grammatical properness. 567 "voice": "A String", # The grammatical voice. 568 "mood": "A String", # The grammatical mood. 569 }, 570 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. 571 }, 572 ], 573 "entities": [ # Entities, along with their semantic information, in the input document. 574 # Populated if the user enables 575 # AnnotateTextRequest.Features.extract_entities. 576 { # Represents a phrase in the text that is a known entity, such as 577 # a person, an organization, or location. The API associates information, such 578 # as salience and mentions, with entities. 579 "name": "A String", # The representative name for the entity. 580 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if 581 # AnnotateTextRequest.Features.extract_entity_sentiment is set to 582 # true, this field will contain the aggregate sentiment expressed for this 583 # entity in the provided document. 584 # the text. 585 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 586 # (positive sentiment). 587 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 588 # the absolute magnitude of sentiment regardless of score (positive or 589 # negative). 590 }, 591 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range. 592 # 593 # The salience score for an entity provides information about the 594 # importance or centrality of that entity to the entire document text. 595 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly 596 # salient. 597 "mentions": [ # The mentions of this entity in the input document. The API currently 598 # supports proper noun mentions. 599 { # Represents a mention for an entity in the text. Currently, proper noun 600 # mentions are supported. 601 "text": { # Represents an output piece of text. # The mention text. 602 "content": "A String", # The content of the output text. 603 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 604 # document according to the EncodingType specified in the API request. 605 }, 606 "type": "A String", # The type of the entity mention. 607 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if 608 # AnnotateTextRequest.Features.extract_entity_sentiment is set to 609 # true, this field will contain the sentiment expressed for this mention of 610 # the entity in the provided document. 611 # the text. 612 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 613 # (positive sentiment). 614 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 615 # the absolute magnitude of sentiment regardless of score (positive or 616 # negative). 617 }, 618 }, 619 ], 620 "type": "A String", # The entity type. 621 "metadata": { # Metadata associated with the entity. 622 # 623 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 624 # and Knowledge Graph MID (`mid`), if they are available. For the metadata 625 # associated with other entity types, see the Type table below. 626 "a_key": "A String", 627 }, 628 }, 629 ], 630 "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment for the document. Populated if the user enables 631 # AnnotateTextRequest.Features.extract_document_sentiment. 632 # the text. 633 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 634 # (positive sentiment). 635 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 636 # the absolute magnitude of sentiment regardless of score (positive or 637 # negative). 638 }, 639 "sentences": [ # Sentences in the input document. Populated if the user enables 640 # AnnotateTextRequest.Features.extract_syntax. 641 { # Represents a sentence in the input document. 642 "text": { # Represents an output piece of text. # The sentence text. 643 "content": "A String", # The content of the output text. 644 "beginOffset": 42, # The API calculates the beginning offset of the content in the original 645 # document according to the EncodingType specified in the API request. 646 }, 647 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if 648 # AnnotateTextRequest.Features.extract_document_sentiment is set to 649 # true, this field will contain the sentiment for the sentence. 650 # the text. 651 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 652 # (positive sentiment). 653 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents 654 # the absolute magnitude of sentiment regardless of score (positive or 655 # negative). 656 }, 657 }, 658 ], 659 "categories": [ # Categories identified in the input document. 660 { # Represents a category returned from the text classifier. 661 "confidence": 3.14, # The classifier's confidence of the category. Number represents how certain 662 # the classifier is that this category represents the given text. 663 "name": "A String", # The name of the category representing the document, from the [predefined 664 # taxonomy](/natural-language/docs/categories). 665 }, 666 ], 667 }</pre> 668</div> 669 670<div class="method"> 671 <code class="details" id="classifyText">classifyText(body, x__xgafv=None)</code> 672 <pre>Classifies a document into categories. 673 674Args: 675 body: object, The request body. (required) 676 The object takes the form of: 677 678{ # The document classification request message. 679 "document": { # ################################################################ # # Input document. 680 # 681 # Represents the input to API methods. 682 "content": "A String", # The content of the input in string format. 683 # Cloud audit logging exempt since it is based on user data. 684 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, 685 # returns an `INVALID_ARGUMENT` error. 686 "language": "A String", # The language of the document (if not specified, the language is 687 # automatically detected). Both ISO and BCP-47 language codes are 688 # accepted.<br> 689 # [Language Support](/natural-language/docs/languages) 690 # lists currently supported languages for each API method. 691 # If the language (either specified by the caller or automatically detected) 692 # is not supported by the called API method, an `INVALID_ARGUMENT` error 693 # is returned. 694 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. 695 # This URI must be of the form: gs://bucket_name/object_name. For more 696 # details, see https://cloud.google.com/storage/docs/reference-uris. 697 # NOTE: Cloud Storage object versioning is not supported. 698 }, 699 } 700 701 x__xgafv: string, V1 error format. 702 Allowed values 703 1 - v1 error format 704 2 - v2 error format 705 706Returns: 707 An object of the form: 708 709 { # The document classification response message. 710 "categories": [ # Categories representing the input document. 711 { # Represents a category returned from the text classifier. 712 "confidence": 3.14, # The classifier's confidence of the category. Number represents how certain 713 # the classifier is that this category represents the given text. 714 "name": "A String", # The name of the category representing the document, from the [predefined 715 # taxonomy](/natural-language/docs/categories). 716 }, 717 ], 718 }</pre> 719</div> 720 721</body></html>