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