Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [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_v1beta1.html">Cloud Natural Language API</a> . <a href="language_v1beta1.documents.html">documents</a></h1> |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [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 | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 80 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 81 | <code><a href="#analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</a></code></p> |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 82 | <p class="firstline">Analyzes the sentiment of the provided text.</p> |
| 83 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 84 | <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] | 85 | <p class="firstline">Analyzes the syntax of the text and provides sentence boundaries and</p> |
| 86 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 87 | <code><a href="#annotateText">annotateText(body=None, x__xgafv=None)</a></code></p> |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 88 | <p class="firstline">A convenience method that provides all the features that analyzeSentiment,</p> |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 89 | <h3>Method Details</h3> |
| 90 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 91 | <code class="details" id="analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</code> |
Sai Cheemalapati | e833b79 | 2017-03-24 15:06:46 -0700 | [diff] [blame] | 92 | <pre>Finds named entities (currently proper names and common nouns) in the text |
| 93 | along with entity types, salience, mentions for each entity, and |
| 94 | other properties. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 95 | |
| 96 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 97 | body: object, The request body. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 98 | The object takes the form of: |
| 99 | |
| 100 | { # The entity analysis request message. |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 101 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 102 | "document": { # ################################################################ # # Input document. |
| 103 | # |
| 104 | # Represents the input to API methods. |
| 105 | "content": "A String", # The content of the input in string format. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 106 | # Cloud audit logging exempt since it is based on user data. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 107 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 108 | # returns an `INVALID_ARGUMENT` error. |
| 109 | "language": "A String", # The language of the document (if not specified, the language is |
| 110 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 111 | # accepted.<br> |
| 112 | # [Language |
| 113 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 114 | # currently supported languages for each API method. If the language (either |
| 115 | # specified by the caller or automatically detected) is not supported by the |
| 116 | # called API method, an `INVALID_ARGUMENT` error is returned. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 117 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 118 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 119 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 120 | # NOTE: Cloud Storage object versioning is not supported. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 121 | }, |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | x__xgafv: string, V1 error format. |
| 125 | Allowed values |
| 126 | 1 - v1 error format |
| 127 | 2 - v2 error format |
| 128 | |
| 129 | Returns: |
| 130 | An object of the form: |
| 131 | |
| 132 | { # The entity analysis response message. |
| 133 | "entities": [ # The recognized entities in the input document. |
| 134 | { # Represents a phrase in the text that is a known entity, such as |
| 135 | # a person, an organization, or location. The API associates information, such |
| 136 | # as salience and mentions, with entities. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 137 | "mentions": [ # The mentions of this entity in the input document. The API currently |
| 138 | # supports proper noun mentions. |
| 139 | { # Represents a mention for an entity in the text. Currently, proper noun |
| 140 | # mentions are supported. |
| 141 | "text": { # Represents an output piece of text. # The mention text. |
| 142 | "content": "A String", # The content of the output text. |
| 143 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 144 | # document according to the EncodingType specified in the API request. |
| 145 | }, |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 146 | "type": "A String", # The type of the entity mention. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 147 | }, |
| 148 | ], |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 149 | "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range. |
| 150 | # |
| 151 | # The salience score for an entity provides information about the |
| 152 | # importance or centrality of that entity to the entire document text. |
| 153 | # Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 154 | # salient. |
Sai Cheemalapati | c30d2b5 | 2017-03-13 12:12:03 -0400 | [diff] [blame] | 155 | "type": "A String", # The entity type. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 156 | "name": "A String", # The representative name for the entity. |
| 157 | "metadata": { # Metadata associated with the entity. |
| 158 | # |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 159 | # Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if |
| 160 | # available. The associated keys are "wikipedia_url" and "mid", respectively. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 161 | "a_key": "A String", |
| 162 | }, |
| 163 | }, |
| 164 | ], |
| 165 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 166 | # in the request or, if not specified, the automatically-detected language. |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 167 | # See Document.language field for more details. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 168 | }</pre> |
| 169 | </div> |
| 170 | |
| 171 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 172 | <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code> |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 173 | <pre>Analyzes the sentiment of the provided text. |
| 174 | |
| 175 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 176 | body: object, The request body. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 177 | The object takes the form of: |
| 178 | |
| 179 | { # The sentiment analysis request message. |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 180 | "encodingType": "A String", # The encoding type used by the API to calculate sentence offsets for the |
| 181 | # sentence sentiment. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 182 | "document": { # ################################################################ # # Input document. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 183 | # |
| 184 | # Represents the input to API methods. |
| 185 | "content": "A String", # The content of the input in string format. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 186 | # Cloud audit logging exempt since it is based on user data. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 187 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 188 | # returns an `INVALID_ARGUMENT` error. |
| 189 | "language": "A String", # The language of the document (if not specified, the language is |
| 190 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 191 | # accepted.<br> |
| 192 | # [Language |
| 193 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 194 | # currently supported languages for each API method. If the language (either |
| 195 | # specified by the caller or automatically detected) is not supported by the |
| 196 | # called API method, an `INVALID_ARGUMENT` error is returned. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 197 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 198 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 199 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 200 | # NOTE: Cloud Storage object versioning is not supported. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 201 | }, |
| 202 | } |
| 203 | |
| 204 | x__xgafv: string, V1 error format. |
| 205 | Allowed values |
| 206 | 1 - v1 error format |
| 207 | 2 - v2 error format |
| 208 | |
| 209 | Returns: |
| 210 | An object of the form: |
| 211 | |
| 212 | { # The sentiment analysis response message. |
| 213 | "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment of the input document. |
| 214 | # the text. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 215 | "polarity": 3.14, # DEPRECATED FIELD - This field is being deprecated in |
| 216 | # favor of score. Please refer to our documentation at |
| 217 | # https://cloud.google.com/natural-language/docs for more information. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 218 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 219 | # (positive sentiment). |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 220 | "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] | 221 | # the absolute magnitude of sentiment regardless of score (positive or |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 222 | # negative). |
| 223 | }, |
| 224 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 225 | # in the request or, if not specified, the automatically-detected language. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 226 | # See Document.language field for more details. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 227 | "sentences": [ # The sentiment for all the sentences in the document. |
| 228 | { # Represents a sentence in the input document. |
| 229 | "text": { # Represents an output piece of text. # The sentence text. |
| 230 | "content": "A String", # The content of the output text. |
| 231 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 232 | # document according to the EncodingType specified in the API request. |
| 233 | }, |
| 234 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if |
| 235 | # AnnotateTextRequest.Features.extract_document_sentiment is set to |
| 236 | # true, this field will contain the sentiment for the sentence. |
| 237 | # the text. |
| 238 | "polarity": 3.14, # DEPRECATED FIELD - This field is being deprecated in |
| 239 | # favor of score. Please refer to our documentation at |
| 240 | # https://cloud.google.com/natural-language/docs for more information. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 241 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 242 | # (positive sentiment). |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 243 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 244 | # the absolute magnitude of sentiment regardless of score (positive or |
| 245 | # negative). |
| 246 | }, |
| 247 | }, |
| 248 | ], |
| 249 | }</pre> |
| 250 | </div> |
| 251 | |
| 252 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 253 | <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] | 254 | <pre>Analyzes the syntax of the text and provides sentence boundaries and |
| 255 | tokenization along with part of speech tags, dependency trees, and other |
| 256 | properties. |
| 257 | |
| 258 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 259 | body: object, The request body. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 260 | The object takes the form of: |
| 261 | |
| 262 | { # The syntax analysis request message. |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 263 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 264 | "document": { # ################################################################ # # Input document. |
| 265 | # |
| 266 | # Represents the input to API methods. |
| 267 | "content": "A String", # The content of the input in string format. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 268 | # Cloud audit logging exempt since it is based on user data. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 269 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 270 | # returns an `INVALID_ARGUMENT` error. |
| 271 | "language": "A String", # The language of the document (if not specified, the language is |
| 272 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 273 | # accepted.<br> |
| 274 | # [Language |
| 275 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 276 | # currently supported languages for each API method. If the language (either |
| 277 | # specified by the caller or automatically detected) is not supported by the |
| 278 | # called API method, an `INVALID_ARGUMENT` error is returned. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 279 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 280 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 281 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 282 | # NOTE: Cloud Storage object versioning is not supported. |
| 283 | }, |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | x__xgafv: string, V1 error format. |
| 287 | Allowed values |
| 288 | 1 - v1 error format |
| 289 | 2 - v2 error format |
| 290 | |
| 291 | Returns: |
| 292 | An object of the form: |
| 293 | |
| 294 | { # The syntax analysis response message. |
| 295 | "tokens": [ # Tokens, along with their syntactic information, in the input document. |
| 296 | { # Represents the smallest syntactic building block of the text. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 297 | "text": { # Represents an output piece of text. # The token text. |
| 298 | "content": "A String", # The content of the output text. |
| 299 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 300 | # document according to the EncodingType specified in the API request. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 301 | }, |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 302 | "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token. |
| 303 | "headTokenIndex": 42, # Represents the head of this token in the dependency tree. |
| 304 | # This is the index of the token which has an arc going to this token. |
| 305 | # The index is the position of the token in the array of tokens returned |
| 306 | # by the API method. If this token is a root token, then the |
| 307 | # `head_token_index` is its own index. |
| 308 | "label": "A String", # The parse label for the token. |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 309 | }, |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 310 | "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token. |
| 311 | "case": "A String", # The grammatical case. |
| 312 | "reciprocity": "A String", # The grammatical reciprocity. |
| 313 | "mood": "A String", # The grammatical mood. |
| 314 | "form": "A String", # The grammatical form. |
| 315 | "gender": "A String", # The grammatical gender. |
| 316 | "number": "A String", # The grammatical number. |
| 317 | "person": "A String", # The grammatical person. |
| 318 | "tag": "A String", # The part of speech tag. |
| 319 | "tense": "A String", # The grammatical tense. |
| 320 | "aspect": "A String", # The grammatical aspect. |
| 321 | "proper": "A String", # The grammatical properness. |
| 322 | "voice": "A String", # The grammatical voice. |
| 323 | }, |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 324 | "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 325 | }, |
| 326 | ], |
| 327 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 328 | # in the request or, if not specified, the automatically-detected language. |
| 329 | # See Document.language field for more details. |
| 330 | "sentences": [ # Sentences in the input document. |
| 331 | { # Represents a sentence in the input document. |
| 332 | "text": { # Represents an output piece of text. # The sentence text. |
| 333 | "content": "A String", # The content of the output text. |
| 334 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 335 | # document according to the EncodingType specified in the API request. |
| 336 | }, |
| 337 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if |
| 338 | # AnnotateTextRequest.Features.extract_document_sentiment is set to |
| 339 | # true, this field will contain the sentiment for the sentence. |
| 340 | # the text. |
| 341 | "polarity": 3.14, # DEPRECATED FIELD - This field is being deprecated in |
| 342 | # favor of score. Please refer to our documentation at |
| 343 | # https://cloud.google.com/natural-language/docs for more information. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 344 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 345 | # (positive sentiment). |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 346 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 347 | # the absolute magnitude of sentiment regardless of score (positive or |
| 348 | # negative). |
| 349 | }, |
| 350 | }, |
| 351 | ], |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 352 | }</pre> |
| 353 | </div> |
| 354 | |
| 355 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 356 | <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code> |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 357 | <pre>A convenience method that provides all the features that analyzeSentiment, |
| 358 | analyzeEntities, and analyzeSyntax provide in one call. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 359 | |
| 360 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 361 | body: object, The request body. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 362 | The object takes the form of: |
| 363 | |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 364 | { # The request message for the text annotation API, which can perform multiple |
| 365 | # analysis types (sentiment, entities, and syntax) in one call. |
Sai Cheemalapati | c30d2b5 | 2017-03-13 12:12:03 -0400 | [diff] [blame] | 366 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 367 | "document": { # ################################################################ # # Input document. |
| 368 | # |
| 369 | # Represents the input to API methods. |
| 370 | "content": "A String", # The content of the input in string format. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 371 | # Cloud audit logging exempt since it is based on user data. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 372 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 373 | # returns an `INVALID_ARGUMENT` error. |
| 374 | "language": "A String", # The language of the document (if not specified, the language is |
| 375 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 376 | # accepted.<br> |
| 377 | # [Language |
| 378 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 379 | # currently supported languages for each API method. If the language (either |
| 380 | # specified by the caller or automatically detected) is not supported by the |
| 381 | # called API method, an `INVALID_ARGUMENT` error is returned. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 382 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 383 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 384 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 385 | # NOTE: Cloud Storage object versioning is not supported. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 386 | }, |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 387 | "features": { # All available features for sentiment, syntax, and semantic analysis. # The enabled features. |
| 388 | # Setting each one to true will enable that specific analysis for the input. |
| 389 | "extractDocumentSentiment": True or False, # Extract document-level sentiment. |
| 390 | "extractEntities": True or False, # Extract entities. |
| 391 | "extractSyntax": True or False, # Extract syntax information. |
| 392 | }, |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 393 | } |
| 394 | |
| 395 | x__xgafv: string, V1 error format. |
| 396 | Allowed values |
| 397 | 1 - v1 error format |
| 398 | 2 - v2 error format |
| 399 | |
| 400 | Returns: |
| 401 | An object of the form: |
| 402 | |
| 403 | { # The text annotations response message. |
| 404 | "tokens": [ # Tokens, along with their syntactic information, in the input document. |
| 405 | # Populated if the user enables |
| 406 | # AnnotateTextRequest.Features.extract_syntax. |
| 407 | { # Represents the smallest syntactic building block of the text. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 408 | "text": { # Represents an output piece of text. # The token text. |
| 409 | "content": "A String", # The content of the output text. |
| 410 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 411 | # document according to the EncodingType specified in the API request. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 412 | }, |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 413 | "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token. |
| 414 | "headTokenIndex": 42, # Represents the head of this token in the dependency tree. |
| 415 | # This is the index of the token which has an arc going to this token. |
| 416 | # The index is the position of the token in the array of tokens returned |
| 417 | # by the API method. If this token is a root token, then the |
| 418 | # `head_token_index` is its own index. |
| 419 | "label": "A String", # The parse label for the token. |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 420 | }, |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 421 | "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token. |
| 422 | "case": "A String", # The grammatical case. |
| 423 | "reciprocity": "A String", # The grammatical reciprocity. |
| 424 | "mood": "A String", # The grammatical mood. |
| 425 | "form": "A String", # The grammatical form. |
| 426 | "gender": "A String", # The grammatical gender. |
| 427 | "number": "A String", # The grammatical number. |
| 428 | "person": "A String", # The grammatical person. |
| 429 | "tag": "A String", # The part of speech tag. |
| 430 | "tense": "A String", # The grammatical tense. |
| 431 | "aspect": "A String", # The grammatical aspect. |
| 432 | "proper": "A String", # The grammatical properness. |
| 433 | "voice": "A String", # The grammatical voice. |
| 434 | }, |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 435 | "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 436 | }, |
| 437 | ], |
| 438 | "entities": [ # Entities, along with their semantic information, in the input document. |
| 439 | # Populated if the user enables |
| 440 | # AnnotateTextRequest.Features.extract_entities. |
| 441 | { # Represents a phrase in the text that is a known entity, such as |
| 442 | # a person, an organization, or location. The API associates information, such |
| 443 | # as salience and mentions, with entities. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 444 | "mentions": [ # The mentions of this entity in the input document. The API currently |
| 445 | # supports proper noun mentions. |
| 446 | { # Represents a mention for an entity in the text. Currently, proper noun |
| 447 | # mentions are supported. |
| 448 | "text": { # Represents an output piece of text. # The mention text. |
| 449 | "content": "A String", # The content of the output text. |
| 450 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 451 | # document according to the EncodingType specified in the API request. |
| 452 | }, |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 453 | "type": "A String", # The type of the entity mention. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 454 | }, |
| 455 | ], |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 456 | "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range. |
| 457 | # |
| 458 | # The salience score for an entity provides information about the |
| 459 | # importance or centrality of that entity to the entire document text. |
| 460 | # Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 461 | # salient. |
Sai Cheemalapati | c30d2b5 | 2017-03-13 12:12:03 -0400 | [diff] [blame] | 462 | "type": "A String", # The entity type. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 463 | "name": "A String", # The representative name for the entity. |
| 464 | "metadata": { # Metadata associated with the entity. |
| 465 | # |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 466 | # Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if |
| 467 | # available. The associated keys are "wikipedia_url" and "mid", respectively. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 468 | "a_key": "A String", |
| 469 | }, |
| 470 | }, |
| 471 | ], |
| 472 | "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment for the document. Populated if the user enables |
| 473 | # AnnotateTextRequest.Features.extract_document_sentiment. |
| 474 | # the text. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 475 | "polarity": 3.14, # DEPRECATED FIELD - This field is being deprecated in |
| 476 | # favor of score. Please refer to our documentation at |
| 477 | # https://cloud.google.com/natural-language/docs for more information. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 478 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 479 | # (positive sentiment). |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 480 | "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] | 481 | # the absolute magnitude of sentiment regardless of score (positive or |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 482 | # negative). |
| 483 | }, |
| 484 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 485 | # in the request or, if not specified, the automatically-detected language. |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 486 | # See Document.language field for more details. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 487 | "sentences": [ # Sentences in the input document. Populated if the user enables |
| 488 | # AnnotateTextRequest.Features.extract_syntax. |
| 489 | { # Represents a sentence in the input document. |
| 490 | "text": { # Represents an output piece of text. # The sentence text. |
| 491 | "content": "A String", # The content of the output text. |
| 492 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 493 | # document according to the EncodingType specified in the API request. |
| 494 | }, |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 495 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if |
| 496 | # AnnotateTextRequest.Features.extract_document_sentiment is set to |
| 497 | # true, this field will contain the sentiment for the sentence. |
| 498 | # the text. |
| 499 | "polarity": 3.14, # DEPRECATED FIELD - This field is being deprecated in |
| 500 | # favor of score. Please refer to our documentation at |
| 501 | # https://cloud.google.com/natural-language/docs for more information. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 502 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 503 | # (positive sentiment). |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 504 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 505 | # the absolute magnitude of sentiment regardless of score (positive or |
| 506 | # negative). |
| 507 | }, |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 508 | }, |
| 509 | ], |
| 510 | }</pre> |
| 511 | </div> |
| 512 | |
| 513 | </body></html> |