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 | |
| 75 | <h1><a href="language_v1beta1.html">Google Cloud Natural Language API</a> . <a href="language_v1beta1.documents.html">documents</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
| 78 | <code><a href="#analyzeEntities">analyzeEntities(body, x__xgafv=None)</a></code></p> |
| 79 | <p class="firstline">Finds named entities (currently finds proper names) in the text,</p> |
| 80 | <p class="toc_element"> |
| 81 | <code><a href="#analyzeSentiment">analyzeSentiment(body, x__xgafv=None)</a></code></p> |
| 82 | <p class="firstline">Analyzes the sentiment of the provided text.</p> |
| 83 | <p class="toc_element"> |
| 84 | <code><a href="#annotateText">annotateText(body, x__xgafv=None)</a></code></p> |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame^] | 85 | <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] | 86 | <h3>Method Details</h3> |
| 87 | <div class="method"> |
| 88 | <code class="details" id="analyzeEntities">analyzeEntities(body, x__xgafv=None)</code> |
| 89 | <pre>Finds named entities (currently finds proper names) in the text, |
| 90 | entity types, salience, mentions for each entity, and other properties. |
| 91 | |
| 92 | Args: |
| 93 | body: object, The request body. (required) |
| 94 | The object takes the form of: |
| 95 | |
| 96 | { # The entity analysis request message. |
| 97 | "document": { # ################################################################ # # Input document. |
| 98 | # |
| 99 | # Represents the input to API methods. |
| 100 | "content": "A String", # The content of the input in string format. |
| 101 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 102 | # returns an `INVALID_ARGUMENT` error. |
| 103 | "language": "A String", # The language of the document (if not specified, the language is |
| 104 | # automatically detected). Both ISO and BCP-47 language codes are |
| 105 | # accepted.<br> |
| 106 | # **Current Language Restrictions:** |
| 107 | # |
| 108 | # * Only English, Spanish, and Japanese textual content |
| 109 | # are supported, with the following additional restriction: |
| 110 | # * `analyzeSentiment` only supports English text. |
| 111 | # If the language (either specified by the caller or automatically detected) |
| 112 | # is not supported by the called API method, an `INVALID_ARGUMENT` error |
| 113 | # is returned. |
| 114 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 115 | }, |
| 116 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
| 117 | } |
| 118 | |
| 119 | x__xgafv: string, V1 error format. |
| 120 | Allowed values |
| 121 | 1 - v1 error format |
| 122 | 2 - v2 error format |
| 123 | |
| 124 | Returns: |
| 125 | An object of the form: |
| 126 | |
| 127 | { # The entity analysis response message. |
| 128 | "entities": [ # The recognized entities in the input document. |
| 129 | { # Represents a phrase in the text that is a known entity, such as |
| 130 | # a person, an organization, or location. The API associates information, such |
| 131 | # as salience and mentions, with entities. |
| 132 | "type": "A String", # The entity type. |
| 133 | "mentions": [ # The mentions of this entity in the input document. The API currently |
| 134 | # supports proper noun mentions. |
| 135 | { # Represents a mention for an entity in the text. Currently, proper noun |
| 136 | # mentions are supported. |
| 137 | "text": { # Represents an output piece of text. # The mention text. |
| 138 | "content": "A String", # The content of the output text. |
| 139 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 140 | # document according to the EncodingType specified in the API request. |
| 141 | }, |
| 142 | }, |
| 143 | ], |
| 144 | "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range. |
| 145 | # |
| 146 | # The salience score for an entity provides information about the |
| 147 | # importance or centrality of that entity to the entire document text. |
| 148 | # Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 149 | # salient. |
| 150 | "name": "A String", # The representative name for the entity. |
| 151 | "metadata": { # Metadata associated with the entity. |
| 152 | # |
| 153 | # Currently, only Wikipedia URLs are provided, if available. |
| 154 | # The associated key is "wikipedia_url". |
| 155 | "a_key": "A String", |
| 156 | }, |
| 157 | }, |
| 158 | ], |
| 159 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 160 | # in the request or, if not specified, the automatically-detected language. |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame^] | 161 | # See Document.language field for more details. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 162 | }</pre> |
| 163 | </div> |
| 164 | |
| 165 | <div class="method"> |
| 166 | <code class="details" id="analyzeSentiment">analyzeSentiment(body, x__xgafv=None)</code> |
| 167 | <pre>Analyzes the sentiment of the provided text. |
| 168 | |
| 169 | Args: |
| 170 | body: object, The request body. (required) |
| 171 | The object takes the form of: |
| 172 | |
| 173 | { # The sentiment analysis request message. |
| 174 | "document": { # ################################################################ # # Input document. Currently, `analyzeSentiment` only supports English text |
| 175 | # (Document.language="EN"). |
| 176 | # |
| 177 | # Represents the input to API methods. |
| 178 | "content": "A String", # The content of the input in string format. |
| 179 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 180 | # returns an `INVALID_ARGUMENT` error. |
| 181 | "language": "A String", # The language of the document (if not specified, the language is |
| 182 | # automatically detected). Both ISO and BCP-47 language codes are |
| 183 | # accepted.<br> |
| 184 | # **Current Language Restrictions:** |
| 185 | # |
| 186 | # * Only English, Spanish, and Japanese textual content |
| 187 | # are supported, with the following additional restriction: |
| 188 | # * `analyzeSentiment` only supports English text. |
| 189 | # If the language (either specified by the caller or automatically detected) |
| 190 | # is not supported by the called API method, an `INVALID_ARGUMENT` error |
| 191 | # is returned. |
| 192 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 193 | }, |
| 194 | } |
| 195 | |
| 196 | x__xgafv: string, V1 error format. |
| 197 | Allowed values |
| 198 | 1 - v1 error format |
| 199 | 2 - v2 error format |
| 200 | |
| 201 | Returns: |
| 202 | An object of the form: |
| 203 | |
| 204 | { # The sentiment analysis response message. |
| 205 | "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment of the input document. |
| 206 | # the text. |
| 207 | "polarity": 3.14, # Polarity of the sentiment in the [-1.0, 1.0] range. Larger numbers |
| 208 | # represent more positive sentiments. |
| 209 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 210 | # the absolute magnitude of sentiment regardless of polarity (positive or |
| 211 | # negative). |
| 212 | }, |
| 213 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 214 | # in the request or, if not specified, the automatically-detected language. |
| 215 | }</pre> |
| 216 | </div> |
| 217 | |
| 218 | <div class="method"> |
| 219 | <code class="details" id="annotateText">annotateText(body, x__xgafv=None)</code> |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame^] | 220 | <pre>A convenience method that provides all the features that analyzeSentiment, |
| 221 | analyzeEntities, and analyzeSyntax provide in one call. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 222 | |
| 223 | Args: |
| 224 | body: object, The request body. (required) |
| 225 | The object takes the form of: |
| 226 | |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame^] | 227 | { # The request message for the text annotation API, which can perform multiple |
| 228 | # analysis types (sentiment, entities, and syntax) in one call. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 229 | "document": { # ################################################################ # # Input document. |
| 230 | # |
| 231 | # Represents the input to API methods. |
| 232 | "content": "A String", # The content of the input in string format. |
| 233 | "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`, |
| 234 | # returns an `INVALID_ARGUMENT` error. |
| 235 | "language": "A String", # The language of the document (if not specified, the language is |
| 236 | # automatically detected). Both ISO and BCP-47 language codes are |
| 237 | # accepted.<br> |
| 238 | # **Current Language Restrictions:** |
| 239 | # |
| 240 | # * Only English, Spanish, and Japanese textual content |
| 241 | # are supported, with the following additional restriction: |
| 242 | # * `analyzeSentiment` only supports English text. |
| 243 | # If the language (either specified by the caller or automatically detected) |
| 244 | # is not supported by the called API method, an `INVALID_ARGUMENT` error |
| 245 | # is returned. |
| 246 | "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located. |
| 247 | }, |
| 248 | "encodingType": "A String", # The encoding type used by the API to calculate offsets. |
| 249 | "features": { # All available features for sentiment, syntax, and semantic analysis. # The enabled features. |
| 250 | # Setting each one to true will enable that specific analysis for the input. |
| 251 | "extractSyntax": True or False, # Extract syntax information. |
| 252 | "extractEntities": True or False, # Extract entities. |
| 253 | "extractDocumentSentiment": True or False, # Extract document-level sentiment. |
| 254 | }, |
| 255 | } |
| 256 | |
| 257 | x__xgafv: string, V1 error format. |
| 258 | Allowed values |
| 259 | 1 - v1 error format |
| 260 | 2 - v2 error format |
| 261 | |
| 262 | Returns: |
| 263 | An object of the form: |
| 264 | |
| 265 | { # The text annotations response message. |
| 266 | "tokens": [ # Tokens, along with their syntactic information, in the input document. |
| 267 | # Populated if the user enables |
| 268 | # AnnotateTextRequest.Features.extract_syntax. |
| 269 | { # Represents the smallest syntactic building block of the text. |
| 270 | "text": { # Represents an output piece of text. # The token text. |
| 271 | "content": "A String", # The content of the output text. |
| 272 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 273 | # document according to the EncodingType specified in the API request. |
| 274 | }, |
| 275 | "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token. |
| 276 | "headTokenIndex": 42, # Represents the head of this token in the dependency tree. |
| 277 | # This is the index of the token which has an arc going to this token. |
| 278 | # The index is the position of the token in the array of tokens returned |
| 279 | # by the API method. If this token is a root token, then the |
| 280 | # `head_token_index` is its own index. |
| 281 | "label": "A String", # The parse label for the token. |
| 282 | }, |
| 283 | "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token. |
| 284 | "tag": "A String", # The part of speech tag. |
| 285 | }, |
| 286 | "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_(morphology)) |
| 287 | # of the token. |
| 288 | }, |
| 289 | ], |
| 290 | "entities": [ # Entities, along with their semantic information, in the input document. |
| 291 | # Populated if the user enables |
| 292 | # AnnotateTextRequest.Features.extract_entities. |
| 293 | { # Represents a phrase in the text that is a known entity, such as |
| 294 | # a person, an organization, or location. The API associates information, such |
| 295 | # as salience and mentions, with entities. |
| 296 | "type": "A String", # The entity type. |
| 297 | "mentions": [ # The mentions of this entity in the input document. The API currently |
| 298 | # supports proper noun mentions. |
| 299 | { # Represents a mention for an entity in the text. Currently, proper noun |
| 300 | # mentions are supported. |
| 301 | "text": { # Represents an output piece of text. # The mention text. |
| 302 | "content": "A String", # The content of the output text. |
| 303 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 304 | # document according to the EncodingType specified in the API request. |
| 305 | }, |
| 306 | }, |
| 307 | ], |
| 308 | "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range. |
| 309 | # |
| 310 | # The salience score for an entity provides information about the |
| 311 | # importance or centrality of that entity to the entire document text. |
| 312 | # Scores closer to 0 are less salient, while scores closer to 1.0 are highly |
| 313 | # salient. |
| 314 | "name": "A String", # The representative name for the entity. |
| 315 | "metadata": { # Metadata associated with the entity. |
| 316 | # |
| 317 | # Currently, only Wikipedia URLs are provided, if available. |
| 318 | # The associated key is "wikipedia_url". |
| 319 | "a_key": "A String", |
| 320 | }, |
| 321 | }, |
| 322 | ], |
| 323 | "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment for the document. Populated if the user enables |
| 324 | # AnnotateTextRequest.Features.extract_document_sentiment. |
| 325 | # the text. |
| 326 | "polarity": 3.14, # Polarity of the sentiment in the [-1.0, 1.0] range. Larger numbers |
| 327 | # represent more positive sentiments. |
| 328 | "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents |
| 329 | # the absolute magnitude of sentiment regardless of polarity (positive or |
| 330 | # negative). |
| 331 | }, |
| 332 | "language": "A String", # The language of the text, which will be the same as the language specified |
| 333 | # in the request or, if not specified, the automatically-detected language. |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame^] | 334 | # See Document.language field for more details. |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 335 | "sentences": [ # Sentences in the input document. Populated if the user enables |
| 336 | # AnnotateTextRequest.Features.extract_syntax. |
| 337 | { # Represents a sentence in the input document. |
| 338 | "text": { # Represents an output piece of text. # The sentence text. |
| 339 | "content": "A String", # The content of the output text. |
| 340 | "beginOffset": 42, # The API calculates the beginning offset of the content in the original |
| 341 | # document according to the EncodingType specified in the API request. |
| 342 | }, |
| 343 | }, |
| 344 | ], |
| 345 | }</pre> |
| 346 | </div> |
| 347 | |
| 348 | </body></html> |