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