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