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