blob: b5e734cc58c031f609aa5059b556b66595cdaef5 [file] [log] [blame]
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -04001<html><body>
2<style>
3
4body, 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
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, 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 Kim715bd7f2019-06-14 16:50:42 -070075<h1><a href="language_v1beta2.html">Cloud Natural Language API</a> . <a href="language_v1beta2.documents.html">documents</a></h1>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040076<h2>Instance Methods</h2>
77<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070078 <code><a href="#analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040079<p class="firstline">Finds named entities (currently proper names and common nouns) in the text</p>
80<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070081 <code><a href="#analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040082<p class="firstline">Finds entities, similar to AnalyzeEntities in the text and analyzes</p>
83<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070084 <code><a href="#analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040085<p class="firstline">Analyzes the sentiment of the provided text.</p>
86<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070087 <code><a href="#analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040088<p class="firstline">Analyzes the syntax of the text and provides sentence boundaries and</p>
89<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070090 <code><a href="#annotateText">annotateText(body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040091<p class="firstline">A convenience method that provides all syntax, sentiment, entity, and</p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070092<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070093 <code><a href="#classifyText">classifyText(body=None, x__xgafv=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070094<p class="firstline">Classifies a document into categories.</p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040095<h3>Method Details</h3>
96<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -070097 <code class="details" id="analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040098 <pre>Finds named entities (currently proper names and common nouns) in the text
99along with entity types, salience, mentions for each entity, and
100other properties.
101
102Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700103 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400104 The object takes the form of:
105
106{ # The entity analysis request message.
Dan O'Mearadd494642020-05-01 07:42:23 -0700107 "encodingType": "A String", # The encoding type used by the API to calculate offsets.
108 "document": { # ################################################################ # # Required. Input document.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400109 #
110 # Represents the input to API methods.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400111 "language": "A String", # The language of the document (if not specified, the language is
112 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700113 # accepted.&lt;br&gt;
114 # [Language
115 # Support](https://cloud.google.com/natural-language/docs/languages) lists
116 # currently supported languages for each API method. If the language (either
117 # specified by the caller or automatically detected) is not supported by the
118 # called API method, an `INVALID_ARGUMENT` error is returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400119 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
120 # This URI must be of the form: gs://bucket_name/object_name. For more
121 # details, see https://cloud.google.com/storage/docs/reference-uris.
122 # NOTE: Cloud Storage object versioning is not supported.
Dan O'Mearadd494642020-05-01 07:42:23 -0700123 "content": "A String", # The content of the input in string format.
124 # Cloud audit logging exempt since it is based on user data.
125 "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for
126 # fetching the content, but as a hint for analyzing the document.
127 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
128 # returns an `INVALID_ARGUMENT` error.
129 "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright
130 # declarations, banners) should be handled for this document. If not
131 # specified, boilerplate will be treated the same as content.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400132 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400133 }
134
135 x__xgafv: string, V1 error format.
136 Allowed values
137 1 - v1 error format
138 2 - v2 error format
139
140Returns:
141 An object of the form:
142
143 { # The entity analysis response message.
144 "entities": [ # The recognized entities in the input document.
145 { # Represents a phrase in the text that is a known entity, such as
146 # a person, an organization, or location. The API associates information, such
147 # as salience and mentions, with entities.
148 "name": "A String", # The representative name for the entity.
149 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
150 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
151 # true, this field will contain the aggregate sentiment expressed for this
152 # entity in the provided document.
153 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700154 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400155 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
156 # (positive sentiment).
157 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
158 # the absolute magnitude of sentiment regardless of score (positive or
159 # negative).
160 },
161 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range.
162 #
163 # The salience score for an entity provides information about the
164 # importance or centrality of that entity to the entire document text.
165 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
166 # salient.
167 "mentions": [ # The mentions of this entity in the input document. The API currently
168 # supports proper noun mentions.
169 { # Represents a mention for an entity in the text. Currently, proper noun
170 # mentions are supported.
171 "text": { # Represents an output piece of text. # The mention text.
172 "content": "A String", # The content of the output text.
173 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
174 # document according to the EncodingType specified in the API request.
175 },
176 "type": "A String", # The type of the entity mention.
177 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
178 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
179 # true, this field will contain the sentiment expressed for this mention of
180 # the entity in the provided document.
181 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700182 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400183 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
184 # (positive sentiment).
185 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
186 # the absolute magnitude of sentiment regardless of score (positive or
187 # negative).
188 },
189 },
190 ],
191 "type": "A String", # The entity type.
192 "metadata": { # Metadata associated with the entity.
193 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700194 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
195 # and Knowledge Graph MID (`mid`), if they are available. For the metadata
196 # associated with other entity types, see the Type table below.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400197 "a_key": "A String",
198 },
199 },
200 ],
201 "language": "A String", # The language of the text, which will be the same as the language specified
202 # in the request or, if not specified, the automatically-detected language.
203 # See Document.language field for more details.
204 }</pre>
205</div>
206
207<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700208 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400209 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes
210sentiment associated with each entity and its mentions.
211
212Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700213 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400214 The object takes the form of:
215
216{ # The entity-level sentiment analysis request message.
217 "encodingType": "A String", # The encoding type used by the API to calculate offsets.
Dan O'Mearadd494642020-05-01 07:42:23 -0700218 "document": { # ################################################################ # # Required. Input document.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400219 #
220 # Represents the input to API methods.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400221 "language": "A String", # The language of the document (if not specified, the language is
222 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700223 # accepted.&lt;br&gt;
224 # [Language
225 # Support](https://cloud.google.com/natural-language/docs/languages) lists
226 # currently supported languages for each API method. If the language (either
227 # specified by the caller or automatically detected) is not supported by the
228 # called API method, an `INVALID_ARGUMENT` error is returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400229 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
230 # This URI must be of the form: gs://bucket_name/object_name. For more
231 # details, see https://cloud.google.com/storage/docs/reference-uris.
232 # NOTE: Cloud Storage object versioning is not supported.
Dan O'Mearadd494642020-05-01 07:42:23 -0700233 "content": "A String", # The content of the input in string format.
234 # Cloud audit logging exempt since it is based on user data.
235 "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for
236 # fetching the content, but as a hint for analyzing the document.
237 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
238 # returns an `INVALID_ARGUMENT` error.
239 "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright
240 # declarations, banners) should be handled for this document. If not
241 # specified, boilerplate will be treated the same as content.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400242 },
243 }
244
245 x__xgafv: string, V1 error format.
246 Allowed values
247 1 - v1 error format
248 2 - v2 error format
249
250Returns:
251 An object of the form:
252
253 { # The entity-level sentiment analysis response message.
254 "entities": [ # The recognized entities in the input document with associated sentiments.
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.
258 "name": "A String", # The representative name for the entity.
259 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
260 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
261 # true, this field will contain the aggregate sentiment expressed for this
262 # entity in the provided document.
263 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700264 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400265 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
266 # (positive sentiment).
267 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
268 # the absolute magnitude of sentiment regardless of score (positive or
269 # negative).
270 },
271 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range.
272 #
273 # The salience score for an entity provides information about the
274 # importance or centrality of that entity to the entire document text.
275 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
276 # salient.
277 "mentions": [ # The mentions of this entity in the input document. The API currently
278 # supports proper noun mentions.
279 { # Represents a mention for an entity in the text. Currently, proper noun
280 # mentions are supported.
281 "text": { # Represents an output piece of text. # The mention text.
282 "content": "A String", # The content of the output text.
283 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
284 # document according to the EncodingType specified in the API request.
285 },
286 "type": "A String", # The type of the entity mention.
287 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
288 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
289 # true, this field will contain the sentiment expressed for this mention of
290 # the entity in the provided document.
291 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700292 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400293 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
294 # (positive sentiment).
295 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
296 # the absolute magnitude of sentiment regardless of score (positive or
297 # negative).
298 },
299 },
300 ],
301 "type": "A String", # The entity type.
302 "metadata": { # Metadata associated with the entity.
303 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700304 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
305 # and Knowledge Graph MID (`mid`), if they are available. For the metadata
306 # associated with other entity types, see the Type table below.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400307 "a_key": "A String",
308 },
309 },
310 ],
311 "language": "A String", # The language of the text, which will be the same as the language specified
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'Mearadd494642020-05-01 07:42:23 -0700318 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400319 <pre>Analyzes the sentiment of the provided text.
320
321Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700322 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400323 The object takes the form of:
324
325{ # The sentiment analysis request message.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700326 "encodingType": "A String", # The encoding type used by the API to calculate sentence offsets for the
327 # sentence sentiment.
Dan O'Mearadd494642020-05-01 07:42:23 -0700328 "document": { # ################################################################ # # Required. Input document.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400329 #
330 # Represents the input to API methods.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400331 "language": "A String", # The language of the document (if not specified, the language is
332 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700333 # accepted.&lt;br&gt;
334 # [Language
335 # Support](https://cloud.google.com/natural-language/docs/languages) lists
336 # currently supported languages for each API method. If the language (either
337 # specified by the caller or automatically detected) is not supported by the
338 # called API method, an `INVALID_ARGUMENT` error is returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400339 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
340 # This URI must be of the form: gs://bucket_name/object_name. For more
341 # details, see https://cloud.google.com/storage/docs/reference-uris.
342 # NOTE: Cloud Storage object versioning is not supported.
Dan O'Mearadd494642020-05-01 07:42:23 -0700343 "content": "A String", # The content of the input in string format.
344 # Cloud audit logging exempt since it is based on user data.
345 "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for
346 # fetching the content, but as a hint for analyzing the document.
347 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
348 # returns an `INVALID_ARGUMENT` error.
349 "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright
350 # declarations, banners) should be handled for this document. If not
351 # specified, boilerplate will be treated the same as content.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400352 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400353 }
354
355 x__xgafv: string, V1 error format.
356 Allowed values
357 1 - v1 error format
358 2 - v2 error format
359
360Returns:
361 An object of the form:
362
363 { # The sentiment analysis response message.
364 "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment of the input document.
365 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700366 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400367 "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 },
373 "language": "A String", # The language of the text, which will be the same as the language specified
374 # in the request or, if not specified, the automatically-detected language.
375 # See Document.language field for more details.
376 "sentences": [ # The sentiment for all the sentences in the document.
377 { # Represents a sentence in the input document.
378 "text": { # Represents an output piece of text. # The sentence text.
379 "content": "A String", # The content of the output text.
380 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
381 # document according to the EncodingType specified in the API request.
382 },
383 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
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 Kim715bd7f2019-06-14 16:50:42 -0700387 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400388 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
389 # (positive sentiment).
390 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
391 # the absolute magnitude of sentiment regardless of score (positive or
392 # negative).
393 },
394 },
395 ],
396 }</pre>
397</div>
398
399<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700400 <code class="details" id="analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400401 <pre>Analyzes the syntax of the text and provides sentence boundaries and
402tokenization along with part of speech tags, dependency trees, and other
403properties.
404
405Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700406 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400407 The object takes the form of:
408
409{ # The syntax analysis request message.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700410 "encodingType": "A String", # The encoding type used by the API to calculate offsets.
Dan O'Mearadd494642020-05-01 07:42:23 -0700411 "document": { # ################################################################ # # Required. Input document.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400412 #
413 # Represents the input to API methods.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400414 "language": "A String", # The language of the document (if not specified, the language is
415 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700416 # accepted.&lt;br&gt;
417 # [Language
418 # Support](https://cloud.google.com/natural-language/docs/languages) lists
419 # currently supported languages for each API method. If the language (either
420 # specified by the caller or automatically detected) is not supported by the
421 # called API method, an `INVALID_ARGUMENT` error is returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400422 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
423 # This URI must be of the form: gs://bucket_name/object_name. For more
424 # details, see https://cloud.google.com/storage/docs/reference-uris.
425 # NOTE: Cloud Storage object versioning is not supported.
Dan O'Mearadd494642020-05-01 07:42:23 -0700426 "content": "A String", # The content of the input in string format.
427 # Cloud audit logging exempt since it is based on user data.
428 "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for
429 # fetching the content, but as a hint for analyzing the document.
430 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
431 # returns an `INVALID_ARGUMENT` error.
432 "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright
433 # declarations, banners) should be handled for this document. If not
434 # specified, boilerplate will be treated the same as content.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400435 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400436 }
437
438 x__xgafv: string, V1 error format.
439 Allowed values
440 1 - v1 error format
441 2 - v2 error format
442
443Returns:
444 An object of the form:
445
446 { # The syntax analysis response message.
447 "tokens": [ # Tokens, along with their syntactic information, in the input document.
448 { # Represents the smallest syntactic building block of the text.
Dan O'Mearadd494642020-05-01 07:42:23 -0700449 "text": { # Represents an output piece of text. # The token text.
450 "content": "A String", # The content of the output text.
451 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
452 # document according to the EncodingType specified in the API request.
453 },
454 "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token.
455 "case": "A String", # The grammatical case.
456 "reciprocity": "A String", # The grammatical reciprocity.
457 "mood": "A String", # The grammatical mood.
458 "form": "A String", # The grammatical form.
459 "gender": "A String", # The grammatical gender.
460 "number": "A String", # The grammatical number.
461 "person": "A String", # The grammatical person.
462 "tag": "A String", # The part of speech tag.
463 "tense": "A String", # The grammatical tense.
464 "aspect": "A String", # The grammatical aspect.
465 "proper": "A String", # The grammatical properness.
466 "voice": "A String", # The grammatical voice.
467 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400468 "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token.
469 "headTokenIndex": 42, # Represents the head of this token in the dependency tree.
470 # This is the index of the token which has an arc going to this token.
471 # The index is the position of the token in the array of tokens returned
472 # by the API method. If this token is a root token, then the
473 # `head_token_index` is its own index.
474 "label": "A String", # The parse label for the token.
475 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700476 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400477 },
478 ],
479 "language": "A String", # The language of the text, which will be the same as the language specified
480 # in the request or, if not specified, the automatically-detected language.
481 # See Document.language field for more details.
482 "sentences": [ # Sentences in the input document.
483 { # Represents a sentence in the input document.
484 "text": { # Represents an output piece of text. # The sentence text.
485 "content": "A String", # The content of the output text.
486 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
487 # document according to the EncodingType specified in the API request.
488 },
489 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
490 # AnnotateTextRequest.Features.extract_document_sentiment is set to
491 # true, this field will contain the sentiment for the sentence.
492 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700493 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400494 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
495 # (positive sentiment).
496 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
497 # the absolute magnitude of sentiment regardless of score (positive or
498 # negative).
499 },
500 },
501 ],
502 }</pre>
503</div>
504
505<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700506 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400507 <pre>A convenience method that provides all syntax, sentiment, entity, and
508classification features in one call.
509
510Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700511 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400512 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.
516 "encodingType": "A String", # The encoding type used by the API to calculate offsets.
Dan O'Mearadd494642020-05-01 07:42:23 -0700517 "document": { # ################################################################ # # Required. Input document.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400518 #
519 # Represents the input to API methods.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400520 "language": "A String", # The language of the document (if not specified, the language is
521 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700522 # accepted.&lt;br&gt;
523 # [Language
524 # Support](https://cloud.google.com/natural-language/docs/languages) lists
525 # currently supported languages for each API method. If the language (either
526 # specified by the caller or automatically detected) is not supported by the
527 # called API method, an `INVALID_ARGUMENT` error is returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400528 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
529 # This URI must be of the form: gs://bucket_name/object_name. For more
530 # details, see https://cloud.google.com/storage/docs/reference-uris.
531 # NOTE: Cloud Storage object versioning is not supported.
Dan O'Mearadd494642020-05-01 07:42:23 -0700532 "content": "A String", # The content of the input in string format.
533 # Cloud audit logging exempt since it is based on user data.
534 "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for
535 # fetching the content, but as a hint for analyzing the document.
536 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
537 # returns an `INVALID_ARGUMENT` error.
538 "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright
539 # declarations, banners) should be handled for this document. If not
540 # specified, boilerplate will be treated the same as content.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400541 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700542 "features": { # All available features for sentiment, syntax, and semantic analysis. # Required. The enabled features.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400543 # Setting each one to true will enable that specific analysis for the input.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700544 # Next ID: 10
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700545 "extractEntitySentiment": True or False, # Extract entities and their associated sentiment.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400546 "extractSyntax": True or False, # Extract syntax information.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700547 "extractEntities": True or False, # Extract entities.
Dan O'Mearadd494642020-05-01 07:42:23 -0700548 "extractDocumentSentiment": True or False, # Extract document-level sentiment.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700549 "classifyText": True or False, # Classify the full document into categories. If this is true,
550 # the API will use the default model which classifies into a
Dan O'Mearadd494642020-05-01 07:42:23 -0700551 # [predefined
552 # taxonomy](https://cloud.google.com/natural-language/docs/categories).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400553 },
554 }
555
556 x__xgafv: string, V1 error format.
557 Allowed values
558 1 - v1 error format
559 2 - v2 error format
560
561Returns:
562 An object of the form:
563
564 { # The text annotations response message.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700565 "language": "A String", # The language of the text, which will be the same as the language specified
566 # in the request or, if not specified, the automatically-detected language.
567 # See Document.language field for more details.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400568 "tokens": [ # Tokens, along with their syntactic information, in the input document.
569 # Populated if the user enables
570 # AnnotateTextRequest.Features.extract_syntax.
571 { # Represents the smallest syntactic building block of the text.
Dan O'Mearadd494642020-05-01 07:42:23 -0700572 "text": { # Represents an output piece of text. # The token text.
573 "content": "A String", # The content of the output text.
574 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
575 # document according to the EncodingType specified in the API request.
576 },
577 "partOfSpeech": { # Represents part of speech information for a token. # Parts of speech tag for this token.
578 "case": "A String", # The grammatical case.
579 "reciprocity": "A String", # The grammatical reciprocity.
580 "mood": "A String", # The grammatical mood.
581 "form": "A String", # The grammatical form.
582 "gender": "A String", # The grammatical gender.
583 "number": "A String", # The grammatical number.
584 "person": "A String", # The grammatical person.
585 "tag": "A String", # The part of speech tag.
586 "tense": "A String", # The grammatical tense.
587 "aspect": "A String", # The grammatical aspect.
588 "proper": "A String", # The grammatical properness.
589 "voice": "A String", # The grammatical voice.
590 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400591 "dependencyEdge": { # Represents dependency parse tree information for a token. # Dependency tree parse for this token.
592 "headTokenIndex": 42, # Represents the head of this token in the dependency tree.
593 # This is the index of the token which has an arc going to this token.
594 # The index is the position of the token in the array of tokens returned
595 # by the API method. If this token is a root token, then the
596 # `head_token_index` is its own index.
597 "label": "A String", # The parse label for the token.
598 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700599 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400600 },
601 ],
602 "entities": [ # Entities, along with their semantic information, in the input document.
603 # Populated if the user enables
604 # AnnotateTextRequest.Features.extract_entities.
605 { # Represents a phrase in the text that is a known entity, such as
606 # a person, an organization, or location. The API associates information, such
607 # as salience and mentions, with entities.
608 "name": "A String", # The representative name for the entity.
609 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
610 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
611 # true, this field will contain the aggregate sentiment expressed for this
612 # entity in the provided document.
613 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700614 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400615 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
616 # (positive sentiment).
617 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
618 # the absolute magnitude of sentiment regardless of score (positive or
619 # negative).
620 },
621 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range.
622 #
623 # The salience score for an entity provides information about the
624 # importance or centrality of that entity to the entire document text.
625 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
626 # salient.
627 "mentions": [ # The mentions of this entity in the input document. The API currently
628 # supports proper noun mentions.
629 { # Represents a mention for an entity in the text. Currently, proper noun
630 # mentions are supported.
631 "text": { # Represents an output piece of text. # The mention text.
632 "content": "A String", # The content of the output text.
633 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
634 # document according to the EncodingType specified in the API request.
635 },
636 "type": "A String", # The type of the entity mention.
637 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
638 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
639 # true, this field will contain the sentiment expressed for this mention of
640 # the entity in the provided document.
641 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700642 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400643 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
644 # (positive sentiment).
645 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
646 # the absolute magnitude of sentiment regardless of score (positive or
647 # negative).
648 },
649 },
650 ],
651 "type": "A String", # The entity type.
652 "metadata": { # Metadata associated with the entity.
653 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700654 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
655 # and Knowledge Graph MID (`mid`), if they are available. For the metadata
656 # associated with other entity types, see the Type table below.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400657 "a_key": "A String",
658 },
659 },
660 ],
661 "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment for the document. Populated if the user enables
662 # AnnotateTextRequest.Features.extract_document_sentiment.
663 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700664 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400665 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
666 # (positive sentiment).
667 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
668 # the absolute magnitude of sentiment regardless of score (positive or
669 # negative).
670 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400671 "sentences": [ # Sentences in the input document. Populated if the user enables
672 # AnnotateTextRequest.Features.extract_syntax.
673 { # Represents a sentence in the input document.
674 "text": { # Represents an output piece of text. # The sentence text.
675 "content": "A String", # The content of the output text.
676 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
677 # document according to the EncodingType specified in the API request.
678 },
679 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
680 # AnnotateTextRequest.Features.extract_document_sentiment is set to
681 # true, this field will contain the sentiment for the sentence.
682 # the text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700683 # Next ID: 6
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400684 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
685 # (positive sentiment).
686 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
687 # the absolute magnitude of sentiment regardless of score (positive or
688 # negative).
689 },
690 },
691 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700692 "categories": [ # Categories identified in the input document.
693 { # Represents a category returned from the text classifier.
694 "confidence": 3.14, # The classifier's confidence of the category. Number represents how certain
695 # the classifier is that this category represents the given text.
696 "name": "A String", # The name of the category representing the document, from the [predefined
Dan O'Mearadd494642020-05-01 07:42:23 -0700697 # taxonomy](https://cloud.google.com/natural-language/docs/categories).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700698 },
699 ],
700 }</pre>
701</div>
702
703<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700704 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700705 <pre>Classifies a document into categories.
706
707Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700708 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700709 The object takes the form of:
710
711{ # The document classification request message.
Dan O'Mearadd494642020-05-01 07:42:23 -0700712 "document": { # ################################################################ # # Required. Input document.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700713 #
714 # Represents the input to API methods.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700715 "language": "A String", # The language of the document (if not specified, the language is
716 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700717 # accepted.&lt;br&gt;
718 # [Language
719 # Support](https://cloud.google.com/natural-language/docs/languages) lists
720 # currently supported languages for each API method. If the language (either
721 # specified by the caller or automatically detected) is not supported by the
722 # called API method, an `INVALID_ARGUMENT` error is returned.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700723 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
724 # This URI must be of the form: gs://bucket_name/object_name. For more
725 # details, see https://cloud.google.com/storage/docs/reference-uris.
726 # NOTE: Cloud Storage object versioning is not supported.
Dan O'Mearadd494642020-05-01 07:42:23 -0700727 "content": "A String", # The content of the input in string format.
728 # Cloud audit logging exempt since it is based on user data.
729 "referenceWebUri": "A String", # The web URI where the document comes from. This URI is not used for
730 # fetching the content, but as a hint for analyzing the document.
731 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
732 # returns an `INVALID_ARGUMENT` error.
733 "boilerplateHandling": "A String", # Indicates how detected boilerplate(e.g. advertisements, copyright
734 # declarations, banners) should be handled for this document. If not
735 # specified, boilerplate will be treated the same as content.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700736 },
737 }
738
739 x__xgafv: string, V1 error format.
740 Allowed values
741 1 - v1 error format
742 2 - v2 error format
743
744Returns:
745 An object of the form:
746
747 { # The document classification response message.
748 "categories": [ # Categories representing the input document.
749 { # Represents a category returned from the text classifier.
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.
752 "name": "A String", # The name of the category representing the document, from the [predefined
Dan O'Mearadd494642020-05-01 07:42:23 -0700753 # taxonomy](https://cloud.google.com/natural-language/docs/categories).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700754 },
755 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400756 }</pre>
757</div>
758
759</body></html>