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 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
| 108 | "document": { # ################################################################ # # Required. Input document. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [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 | "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright |
| 116 | # declarations, banners) should be handled for this document. If not |
| 117 | # specified, boilerplate will be treated the same as content. |
| 118 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 119 | # returns an `INVALID_ARGUMENT` error. |
| 120 | "content": "A String", # The content of the input in string format. |
| 121 | # Cloud audit logging exempt since it is based on user data. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 122 | "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for |
| 123 | # fetching the content, but as a hint for analyzing the document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 124 | "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] | 125 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 126 | # accepted.<br> |
| 127 | # [Language |
| 128 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 129 | # currently supported languages for each API method. If the language (either |
| 130 | # specified by the caller or automatically detected) is not supported by the |
| 131 | # called API method, an `INVALID_ARGUMENT` error is returned. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 132 | }, |
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 | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 151 | "name": "A String", # The representative name for the entity. |
| 152 | "type": "A String", # The entity type. |
| 153 | "metadata": { # Metadata associated with the entity. |
| 154 | # |
| 155 | # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) |
| 156 | # and Knowledge Graph MID (`mid`), if they are available. For the metadata |
| 157 | # associated with other entity types, see the Type table below. |
| 158 | "a_key": "A String", |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 159 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 160 | "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] | 161 | # |
| 162 | # The salience score for an entity provides information about the |
| 163 | # importance or centrality of that entity to the entire document text. |
| 164 | # Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 165 | # salient. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 166 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if |
| 167 | # AnnotateTextRequest.Features.extract_entity_sentiment is set to |
| 168 | # true, this field will contain the aggregate sentiment expressed for this |
| 169 | # entity in the provided document. |
| 170 | # the text. |
| 171 | # Next ID: 6 |
| 172 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 173 | # (positive sentiment). |
| 174 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 175 | # the absolute magnitude of sentiment regardless of score (positive or |
| 176 | # negative). |
| 177 | }, |
| 178 | "mentions": [ # The mentions of this entity in the input document. The API currently |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 179 | # supports proper noun mentions. |
| 180 | { # Represents a mention for an entity in the text. Currently, proper noun |
| 181 | # mentions are supported. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 182 | "text": { # Represents an output piece of text. # The mention text. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 183 | "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] | 184 | # document according to the EncodingType specified in the API request. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 185 | "content": "A String", # The content of the output text. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 186 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 187 | "type": "A String", # The type of the entity mention. |
| 188 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 189 | # AnnotateTextRequest.Features.extract_entity_sentiment is set to |
| 190 | # true, this field will contain the sentiment expressed for this mention of |
| 191 | # the entity in the provided document. |
| 192 | # the text. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 193 | # Next ID: 6 |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 194 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 195 | # (positive sentiment). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 196 | "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] | 197 | # the absolute magnitude of sentiment regardless of score (positive or |
| 198 | # negative). |
| 199 | }, |
| 200 | }, |
| 201 | ], |
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 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
| 218 | "document": { # ################################################################ # # Required. Input document. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 219 | # |
| 220 | # Represents the input to API methods. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 221 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 222 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 223 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 224 | # NOTE: Cloud Storage object versioning is not supported. |
| 225 | "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright |
| 226 | # declarations, banners) should be handled for this document. If not |
| 227 | # specified, boilerplate will be treated the same as content. |
| 228 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 229 | # returns an `INVALID_ARGUMENT` error. |
| 230 | "content": "A String", # The content of the input in string format. |
| 231 | # Cloud audit logging exempt since it is based on user data. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 232 | "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for |
| 233 | # fetching the content, but as a hint for analyzing the document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 234 | "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] | 235 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 236 | # accepted.<br> |
| 237 | # [Language |
| 238 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 239 | # currently supported languages for each API method. If the language (either |
| 240 | # specified by the caller or automatically detected) is not supported by the |
| 241 | # called API method, an `INVALID_ARGUMENT` error is returned. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 242 | }, |
| 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 | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 258 | "name": "A String", # The representative name for the entity. |
| 259 | "type": "A String", # The entity type. |
| 260 | "metadata": { # Metadata associated with the entity. |
| 261 | # |
| 262 | # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) |
| 263 | # and Knowledge Graph MID (`mid`), if they are available. For the metadata |
| 264 | # associated with other entity types, see the Type table below. |
| 265 | "a_key": "A String", |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 266 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 267 | "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] | 268 | # |
| 269 | # The salience score for an entity provides information about the |
| 270 | # importance or centrality of that entity to the entire document text. |
| 271 | # Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 272 | # salient. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 273 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if |
| 274 | # AnnotateTextRequest.Features.extract_entity_sentiment is set to |
| 275 | # true, this field will contain the aggregate sentiment expressed for this |
| 276 | # entity in the provided document. |
| 277 | # the text. |
| 278 | # Next ID: 6 |
| 279 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 280 | # (positive sentiment). |
| 281 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 282 | # the absolute magnitude of sentiment regardless of score (positive or |
| 283 | # negative). |
| 284 | }, |
| 285 | "mentions": [ # The mentions of this entity in the input document. The API currently |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 286 | # supports proper noun mentions. |
| 287 | { # Represents a mention for an entity in the text. Currently, proper noun |
| 288 | # mentions are supported. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 289 | "text": { # Represents an output piece of text. # The mention text. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 290 | "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] | 291 | # document according to the EncodingType specified in the API request. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 292 | "content": "A String", # The content of the output text. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 293 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 294 | "type": "A String", # The type of the entity mention. |
| 295 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 296 | # AnnotateTextRequest.Features.extract_entity_sentiment is set to |
| 297 | # true, this field will contain the sentiment expressed for this mention of |
| 298 | # the entity in the provided document. |
| 299 | # the text. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 300 | # Next ID: 6 |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 301 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 302 | # (positive sentiment). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 303 | "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] | 304 | # the absolute magnitude of sentiment regardless of score (positive or |
| 305 | # negative). |
| 306 | }, |
| 307 | }, |
| 308 | ], |
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 | "encodingType": "A String", # The encoding type used by the API to calculate sentence offsets for the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 327 | # sentence sentiment. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 328 | "document": { # ################################################################ # # Required. Input document. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 329 | # |
| 330 | # Represents the input to API methods. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 331 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 332 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 333 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 334 | # NOTE: Cloud Storage object versioning is not supported. |
| 335 | "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright |
| 336 | # declarations, banners) should be handled for this document. If not |
| 337 | # specified, boilerplate will be treated the same as content. |
| 338 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 339 | # returns an `INVALID_ARGUMENT` error. |
| 340 | "content": "A String", # The content of the input in string format. |
| 341 | # Cloud audit logging exempt since it is based on user data. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 342 | "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for |
| 343 | # fetching the content, but as a hint for analyzing the document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 344 | "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] | 345 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 346 | # accepted.<br> |
| 347 | # [Language |
| 348 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 349 | # currently supported languages for each API method. If the language (either |
| 350 | # specified by the caller or automatically detected) is not supported by the |
| 351 | # called API method, an `INVALID_ARGUMENT` error is returned. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 352 | }, |
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 | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 364 | "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment of the input document. |
| 365 | # the text. |
| 366 | # Next ID: 6 |
| 367 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 368 | # (positive sentiment). |
| 369 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 370 | # the absolute magnitude of sentiment regardless of score (positive or |
| 371 | # negative). |
| 372 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 373 | "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] | 374 | # in the request or, if not specified, the automatically-detected language. |
| 375 | # See Document.language field for more details. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 376 | "sentences": [ # The sentiment for all the sentences in the document. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 377 | { # Represents a sentence in the input document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 378 | "text": { # Represents an output piece of text. # The sentence text. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 379 | "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] | 380 | # document according to the EncodingType specified in the API request. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 381 | "content": "A String", # The content of the output text. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 382 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 383 | "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] | 384 | # AnnotateTextRequest.Features.extract_document_sentiment is set to |
| 385 | # true, this field will contain the sentiment for the sentence. |
| 386 | # the text. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 387 | # Next ID: 6 |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 388 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 389 | # (positive sentiment). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 390 | "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] | 391 | # the absolute magnitude of sentiment regardless of score (positive or |
| 392 | # negative). |
| 393 | }, |
| 394 | }, |
| 395 | ], |
| 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 | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 414 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 415 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 416 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 417 | # NOTE: Cloud Storage object versioning is not supported. |
| 418 | "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright |
| 419 | # declarations, banners) should be handled for this document. If not |
| 420 | # specified, boilerplate will be treated the same as content. |
| 421 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 422 | # returns an `INVALID_ARGUMENT` error. |
| 423 | "content": "A String", # The content of the input in string format. |
| 424 | # Cloud audit logging exempt since it is based on user data. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 425 | "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for |
| 426 | # fetching the content, but as a hint for analyzing the document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 427 | "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] | 428 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 429 | # accepted.<br> |
| 430 | # [Language |
| 431 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 432 | # currently supported languages for each API method. If the language (either |
| 433 | # specified by the caller or automatically detected) is not supported by the |
| 434 | # called API method, an `INVALID_ARGUMENT` error is returned. |
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 | "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] | 448 | # in the request or, if not specified, the automatically-detected language. |
| 449 | # See Document.language field for more details. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 450 | "sentences": [ # Sentences in the input document. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 451 | { # Represents a sentence in the input document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 452 | "text": { # Represents an output piece of text. # The sentence text. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 453 | "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] | 454 | # document according to the EncodingType specified in the API request. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 455 | "content": "A String", # The content of the output text. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 456 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 457 | "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] | 458 | # AnnotateTextRequest.Features.extract_document_sentiment is set to |
| 459 | # true, this field will contain the sentiment for the sentence. |
| 460 | # the text. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 461 | # Next ID: 6 |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 462 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 463 | # (positive sentiment). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 464 | "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] | 465 | # the absolute magnitude of sentiment regardless of score (positive or |
| 466 | # negative). |
| 467 | }, |
| 468 | }, |
| 469 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 470 | "tokens": [ # Tokens, along with their syntactic information, in the input document. |
| 471 | { # Represents the smallest syntactic building block of the text. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 472 | "text": { # Represents an output piece of text. # The token text. |
| 473 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 474 | # document according to the EncodingType specified in the API request. |
| 475 | "content": "A String", # The content of the output text. |
| 476 | }, |
| 477 | "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token. |
| 478 | "headTokenIndex": 42, # Represents the head of this token in the dependency tree. |
| 479 | # This is the index of the token which has an arc going to this token. |
| 480 | # The index is the position of the token in the array of tokens returned |
| 481 | # by the API method. If this token is a root token, then the |
| 482 | # `head_token_index` is its own index. |
| 483 | "label": "A String", # The parse label for the token. |
| 484 | }, |
| 485 | "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 486 | "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token. |
| 487 | "tense": "A String", # The grammatical tense. |
| 488 | "reciprocity": "A String", # The grammatical reciprocity. |
| 489 | "form": "A String", # The grammatical form. |
| 490 | "number": "A String", # The grammatical number. |
| 491 | "voice": "A String", # The grammatical voice. |
| 492 | "aspect": "A String", # The grammatical aspect. |
| 493 | "mood": "A String", # The grammatical mood. |
| 494 | "tag": "A String", # The part of speech tag. |
| 495 | "gender": "A String", # The grammatical gender. |
| 496 | "person": "A String", # The grammatical person. |
| 497 | "proper": "A String", # The grammatical properness. |
| 498 | "case": "A String", # The grammatical case. |
| 499 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 500 | }, |
| 501 | ], |
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 | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 516 | "features": { # All available features for sentiment, syntax, and semantic analysis. # Required. The enabled features. |
| 517 | # Setting each one to true will enable that specific analysis for the input. |
| 518 | # Next ID: 10 |
| 519 | "extractEntities": True or False, # Extract entities. |
| 520 | "classifyText": True or False, # Classify the full document into categories. If this is true, |
| 521 | # the API will use the default model which classifies into a |
| 522 | # [predefined |
| 523 | # taxonomy](https://cloud.google.com/natural-language/docs/categories). |
| 524 | "extractSyntax": True or False, # Extract syntax information. |
| 525 | "extractDocumentSentiment": True or False, # Extract document-level sentiment. |
| 526 | "extractEntitySentiment": True or False, # Extract entities and their associated sentiment. |
| 527 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 528 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
| 529 | "document": { # ################################################################ # # Required. Input document. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 530 | # |
| 531 | # Represents the input to API methods. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 532 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 533 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 534 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 535 | # NOTE: Cloud Storage object versioning is not supported. |
| 536 | "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright |
| 537 | # declarations, banners) should be handled for this document. If not |
| 538 | # specified, boilerplate will be treated the same as content. |
| 539 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 540 | # returns an `INVALID_ARGUMENT` error. |
| 541 | "content": "A String", # The content of the input in string format. |
| 542 | # Cloud audit logging exempt since it is based on user data. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 543 | "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for |
| 544 | # fetching the content, but as a hint for analyzing the document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 545 | "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] | 546 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 547 | # accepted.<br> |
| 548 | # [Language |
| 549 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 550 | # currently supported languages for each API method. If the language (either |
| 551 | # specified by the caller or automatically detected) is not supported by the |
| 552 | # called API method, an `INVALID_ARGUMENT` error is returned. |
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 | "tokens": [ # Tokens, along with their syntactic 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_syntax. |
| 568 | { # Represents the smallest syntactic building block of the text. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 569 | "text": { # Represents an output piece of text. # The token text. |
| 570 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 571 | # document according to the EncodingType specified in the API request. |
| 572 | "content": "A String", # The content of the output text. |
| 573 | }, |
| 574 | "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token. |
| 575 | "headTokenIndex": 42, # Represents the head of this token in the dependency tree. |
| 576 | # This is the index of the token which has an arc going to this token. |
| 577 | # The index is the position of the token in the array of tokens returned |
| 578 | # by the API method. If this token is a root token, then the |
| 579 | # `head_token_index` is its own index. |
| 580 | "label": "A String", # The parse label for the token. |
| 581 | }, |
| 582 | "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 583 | "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token. |
| 584 | "tense": "A String", # The grammatical tense. |
| 585 | "reciprocity": "A String", # The grammatical reciprocity. |
| 586 | "form": "A String", # The grammatical form. |
| 587 | "number": "A String", # The grammatical number. |
| 588 | "voice": "A String", # The grammatical voice. |
| 589 | "aspect": "A String", # The grammatical aspect. |
| 590 | "mood": "A String", # The grammatical mood. |
| 591 | "tag": "A String", # The part of speech tag. |
| 592 | "gender": "A String", # The grammatical gender. |
| 593 | "person": "A String", # The grammatical person. |
| 594 | "proper": "A String", # The grammatical properness. |
| 595 | "case": "A String", # The grammatical case. |
| 596 | }, |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 597 | }, |
| 598 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 599 | "categories": [ # Categories identified in the input document. |
| 600 | { # Represents a category returned from the text classifier. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 601 | "confidence": 3.14, # The classifier's confidence of the category. Number represents how certain |
| 602 | # the classifier is that this category represents the given text. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 603 | "name": "A String", # The name of the category representing the document, from the [predefined |
| 604 | # taxonomy](https://cloud.google.com/natural-language/docs/categories). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 605 | }, |
| 606 | ], |
| 607 | "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment for the document. Populated if the user enables |
| 608 | # AnnotateTextRequest.Features.extract_document_sentiment. |
| 609 | # the text. |
| 610 | # Next ID: 6 |
| 611 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 612 | # (positive sentiment). |
| 613 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 614 | # the absolute magnitude of sentiment regardless of score (positive or |
| 615 | # negative). |
| 616 | }, |
| 617 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 618 | # in the request or, if not specified, the automatically-detected language. |
| 619 | # See Document.language field for more details. |
| 620 | "entities": [ # Entities, along with their semantic information, in the input document. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 621 | # Populated if the user enables |
| 622 | # AnnotateTextRequest.Features.extract_entities. |
| 623 | { # Represents a phrase in the text that is a known entity, such as |
| 624 | # a person, an organization, or location. The API associates information, such |
| 625 | # as salience and mentions, with entities. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 626 | "name": "A String", # The representative name for the entity. |
| 627 | "type": "A String", # The entity type. |
| 628 | "metadata": { # Metadata associated with the entity. |
| 629 | # |
| 630 | # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) |
| 631 | # and Knowledge Graph MID (`mid`), if they are available. For the metadata |
| 632 | # associated with other entity types, see the Type table below. |
| 633 | "a_key": "A String", |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 634 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 635 | "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] | 636 | # |
| 637 | # The salience score for an entity provides information about the |
| 638 | # importance or centrality of that entity to the entire document text. |
| 639 | # Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 640 | # salient. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 641 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if |
| 642 | # AnnotateTextRequest.Features.extract_entity_sentiment is set to |
| 643 | # true, this field will contain the aggregate sentiment expressed for this |
| 644 | # entity in the provided document. |
| 645 | # the text. |
| 646 | # Next ID: 6 |
| 647 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 648 | # (positive sentiment). |
| 649 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 650 | # the absolute magnitude of sentiment regardless of score (positive or |
| 651 | # negative). |
| 652 | }, |
| 653 | "mentions": [ # The mentions of this entity in the input document. The API currently |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 654 | # supports proper noun mentions. |
| 655 | { # Represents a mention for an entity in the text. Currently, proper noun |
| 656 | # mentions are supported. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 657 | "text": { # Represents an output piece of text. # The mention text. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 658 | "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] | 659 | # document according to the EncodingType specified in the API request. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 660 | "content": "A String", # The content of the output text. |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 661 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 662 | "type": "A String", # The type of the entity mention. |
| 663 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 664 | # AnnotateTextRequest.Features.extract_entity_sentiment is set to |
| 665 | # true, this field will contain the sentiment expressed for this mention of |
| 666 | # the entity in the provided document. |
| 667 | # the text. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 668 | # Next ID: 6 |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 669 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
Sai Cheemalapati | 4ba8c23 | 2017-06-06 18:46:08 -0400 | [diff] [blame] | 670 | # (positive sentiment). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 671 | "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] | 672 | # the absolute magnitude of sentiment regardless of score (positive or |
| 673 | # negative). |
| 674 | }, |
| 675 | }, |
| 676 | ], |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 677 | }, |
| 678 | ], |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 679 | "sentences": [ # Sentences in the input document. Populated if the user enables |
| 680 | # AnnotateTextRequest.Features.extract_syntax. |
| 681 | { # Represents a sentence in the input document. |
| 682 | "text": { # Represents an output piece of text. # The sentence text. |
| 683 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 684 | # document according to the EncodingType specified in the API request. |
| 685 | "content": "A String", # The content of the output text. |
| 686 | }, |
| 687 | "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if |
| 688 | # AnnotateTextRequest.Features.extract_document_sentiment is set to |
| 689 | # true, this field will contain the sentiment for the sentence. |
| 690 | # the text. |
| 691 | # Next ID: 6 |
| 692 | "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 |
| 693 | # (positive sentiment). |
| 694 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 695 | # the absolute magnitude of sentiment regardless of score (positive or |
| 696 | # negative). |
| 697 | }, |
| 698 | }, |
| 699 | ], |
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 | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 715 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 716 | # This URI must be of the form: gs://bucket_name/object_name. For more |
| 717 | # details, see https://cloud.google.com/storage/docs/reference-uris. |
| 718 | # NOTE: Cloud Storage object versioning is not supported. |
| 719 | "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright |
| 720 | # declarations, banners) should be handled for this document. If not |
| 721 | # specified, boilerplate will be treated the same as content. |
| 722 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 723 | # returns an `INVALID_ARGUMENT` error. |
| 724 | "content": "A String", # The content of the input in string format. |
| 725 | # Cloud audit logging exempt since it is based on user data. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 726 | "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for |
| 727 | # fetching the content, but as a hint for analyzing the document. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 728 | "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] | 729 | # automatically detected). Both ISO and BCP-47 language codes are |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 730 | # accepted.<br> |
| 731 | # [Language |
| 732 | # Support](https://cloud.google.com/natural-language/docs/languages) lists |
| 733 | # currently supported languages for each API method. If the language (either |
| 734 | # specified by the caller or automatically detected) is not supported by the |
| 735 | # called API method, an `INVALID_ARGUMENT` error is returned. |
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 | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 750 | "confidence": 3.14, # The classifier's confidence of the category. Number represents how certain |
| 751 | # the classifier is that this category represents the given text. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 752 | "name": "A String", # The name of the category representing the document, from the [predefined |
| 753 | # taxonomy](https://cloud.google.com/natural-language/docs/categories). |
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> |