blob: 16793be6e8fbc9cafd28c9deb6209509b55089c3 [file] [log] [blame]
Jon Wayne Parrott692617a2017-01-06 09:58:29 -08001<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_v1.html">Cloud Natural Language API</a> . <a href="language_v1.documents.html">documents</a></h1>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080076<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 Cheemalapatie833b792017-03-24 15:06:46 -070079<p class="firstline">Finds named entities (currently proper names and common nouns) in the text</p>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080080<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>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070082<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>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080085<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>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080088<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>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080091<p class="firstline">A convenience method that provides all the features that analyzeSentiment,</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>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080095<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 Cheemalapatie833b792017-03-24 15:06:46 -070098 <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.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800101
102Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700103 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800104 The object takes the form of:
105
106{ # The entity analysis request message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700107 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
108 &quot;document&quot;: { # ################################################################ # # Required. Input document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800109 #
110 # Represents the input to API methods.
Bu Sun Kim65020912020-05-20 12:08:20 -0700111 &quot;gcsContentUri&quot;: &quot;A String&quot;, # 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 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800116 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700117 # accepted.&lt;br&gt;
118 # [Language
119 # Support](https://cloud.google.com/natural-language/docs/languages) lists
120 # currently supported languages for each API method. If the language (either
121 # specified by the caller or automatically detected) is not supported by the
122 # called API method, an `INVALID_ARGUMENT` error is returned.
Bu Sun Kim65020912020-05-20 12:08:20 -0700123 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
124 # returns an `INVALID_ARGUMENT` error.
125 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format.
126 # Cloud audit logging exempt since it is based on user data.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800127 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800128 }
129
130 x__xgafv: string, V1 error format.
131 Allowed values
132 1 - v1 error format
133 2 - v2 error format
134
135Returns:
136 An object of the form:
137
138 { # The entity analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700139 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified
140 # in the request or, if not specified, the automatically-detected language.
141 # See Document.language field for more details.
142 &quot;entities&quot;: [ # The recognized entities in the input document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800143 { # Represents a phrase in the text that is a known entity, such as
144 # a person, an organization, or location. The API associates information, such
145 # as salience and mentions, with entities.
Bu Sun Kim65020912020-05-20 12:08:20 -0700146 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800147 # supports proper noun mentions.
148 { # Represents a mention for an entity in the text. Currently, proper noun
149 # mentions are supported.
Bu Sun Kim65020912020-05-20 12:08:20 -0700150 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
151 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800152 # document according to the EncodingType specified in the API request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700153 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800154 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700155 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
156 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700157 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
158 # true, this field will contain the sentiment expressed for this mention of
159 # the entity in the provided document.
160 # the text.
Bu Sun Kim65020912020-05-20 12:08:20 -0700161 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700162 # (positive sentiment).
Bu Sun Kim65020912020-05-20 12:08:20 -0700163 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700164 # the absolute magnitude of sentiment regardless of score (positive or
165 # negative).
166 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800167 },
168 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700169 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
170 &quot;type&quot;: &quot;A String&quot;, # The entity type.
171 &quot;metadata&quot;: { # Metadata associated with the entity.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700172 #
173 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
174 # and Knowledge Graph MID (`mid`), if they are available. For the metadata
175 # associated with other entity types, see the Type table below.
Bu Sun Kim65020912020-05-20 12:08:20 -0700176 &quot;a_key&quot;: &quot;A String&quot;,
177 },
178 &quot;salience&quot;: 3.14, # The salience score associated with the entity in the [0, 1.0] range.
179 #
180 # The salience score for an entity provides information about the
181 # importance or centrality of that entity to the entire document text.
182 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
183 # salient.
184 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
185 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
186 # true, this field will contain the aggregate sentiment expressed for this
187 # entity in the provided document.
188 # the text.
189 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
190 # (positive sentiment).
191 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
192 # the absolute magnitude of sentiment regardless of score (positive or
193 # negative).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700194 },
195 },
196 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700197 }</pre>
198</div>
199
200<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700201 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700202 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes
203sentiment associated with each entity and its mentions.
204
205Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700206 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700207 The object takes the form of:
208
209{ # The entity-level sentiment analysis request message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700210 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
211 &quot;document&quot;: { # ################################################################ # # Required. Input document.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700212 #
213 # Represents the input to API methods.
Bu Sun Kim65020912020-05-20 12:08:20 -0700214 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located.
215 # This URI must be of the form: gs://bucket_name/object_name. For more
216 # details, see https://cloud.google.com/storage/docs/reference-uris.
217 # NOTE: Cloud Storage object versioning is not supported.
218 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700219 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700220 # accepted.&lt;br&gt;
221 # [Language
222 # Support](https://cloud.google.com/natural-language/docs/languages) lists
223 # currently supported languages for each API method. If the language (either
224 # specified by the caller or automatically detected) is not supported by the
225 # called API method, an `INVALID_ARGUMENT` error is returned.
Bu Sun Kim65020912020-05-20 12:08:20 -0700226 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
227 # returns an `INVALID_ARGUMENT` error.
228 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format.
229 # Cloud audit logging exempt since it is based on user data.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700230 },
231 }
232
233 x__xgafv: string, V1 error format.
234 Allowed values
235 1 - v1 error format
236 2 - v2 error format
237
238Returns:
239 An object of the form:
240
241 { # The entity-level sentiment analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700242 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified
243 # in the request or, if not specified, the automatically-detected language.
244 # See Document.language field for more details.
245 &quot;entities&quot;: [ # The recognized entities in the input document with associated sentiments.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700246 { # Represents a phrase in the text that is a known entity, such as
247 # a person, an organization, or location. The API associates information, such
248 # as salience and mentions, with entities.
Bu Sun Kim65020912020-05-20 12:08:20 -0700249 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700250 # supports proper noun mentions.
251 { # Represents a mention for an entity in the text. Currently, proper noun
252 # mentions are supported.
Bu Sun Kim65020912020-05-20 12:08:20 -0700253 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
254 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700255 # document according to the EncodingType specified in the API request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700256 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700257 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700258 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
259 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700260 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
261 # true, this field will contain the sentiment expressed for this mention of
262 # the entity in the provided document.
263 # the text.
Bu Sun Kim65020912020-05-20 12:08:20 -0700264 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700265 # (positive sentiment).
Bu Sun Kim65020912020-05-20 12:08:20 -0700266 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700267 # the absolute magnitude of sentiment regardless of score (positive or
268 # negative).
269 },
270 },
271 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700272 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
273 &quot;type&quot;: &quot;A String&quot;, # The entity type.
274 &quot;metadata&quot;: { # Metadata associated with the entity.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800275 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700276 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
277 # and Knowledge Graph MID (`mid`), if they are available. For the metadata
278 # associated with other entity types, see the Type table below.
Bu Sun Kim65020912020-05-20 12:08:20 -0700279 &quot;a_key&quot;: &quot;A String&quot;,
280 },
281 &quot;salience&quot;: 3.14, # The salience score associated with the entity in the [0, 1.0] range.
282 #
283 # The salience score for an entity provides information about the
284 # importance or centrality of that entity to the entire document text.
285 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
286 # salient.
287 &quot;sentiment&quot;: { # 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 aggregate sentiment expressed for this
290 # entity in the provided document.
291 # the text.
292 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
293 # (positive sentiment).
294 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
295 # the absolute magnitude of sentiment regardless of score (positive or
296 # negative).
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800297 },
298 },
299 ],
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800300 }</pre>
301</div>
302
303<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700304 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800305 <pre>Analyzes the sentiment of the provided text.
306
307Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700308 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800309 The object takes the form of:
310
311{ # The sentiment analysis request message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700312 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate sentence offsets.
313 &quot;document&quot;: { # ################################################################ # # Required. Input document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800314 #
315 # Represents the input to API methods.
Bu Sun Kim65020912020-05-20 12:08:20 -0700316 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located.
317 # This URI must be of the form: gs://bucket_name/object_name. For more
318 # details, see https://cloud.google.com/storage/docs/reference-uris.
319 # NOTE: Cloud Storage object versioning is not supported.
320 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800321 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700322 # accepted.&lt;br&gt;
323 # [Language
324 # Support](https://cloud.google.com/natural-language/docs/languages) lists
325 # currently supported languages for each API method. If the language (either
326 # specified by the caller or automatically detected) is not supported by the
327 # called API method, an `INVALID_ARGUMENT` error is returned.
Bu Sun Kim65020912020-05-20 12:08:20 -0700328 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
329 # returns an `INVALID_ARGUMENT` error.
330 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format.
331 # Cloud audit logging exempt since it is based on user data.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800332 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800333 }
334
335 x__xgafv: string, V1 error format.
336 Allowed values
337 1 - v1 error format
338 2 - v2 error format
339
340Returns:
341 An object of the form:
342
343 { # The sentiment analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700344 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in # The overall sentiment of the input document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800345 # the text.
Bu Sun Kim65020912020-05-20 12:08:20 -0700346 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800347 # (positive sentiment).
Bu Sun Kim65020912020-05-20 12:08:20 -0700348 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800349 # the absolute magnitude of sentiment regardless of score (positive or
350 # negative).
351 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700352 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800353 # in the request or, if not specified, the automatically-detected language.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400354 # See Document.language field for more details.
Bu Sun Kim65020912020-05-20 12:08:20 -0700355 &quot;sentences&quot;: [ # The sentiment for all the sentences in the document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800356 { # Represents a sentence in the input document.
Bu Sun Kim65020912020-05-20 12:08:20 -0700357 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800358 # AnnotateTextRequest.Features.extract_document_sentiment is set to
359 # true, this field will contain the sentiment for the sentence.
360 # the text.
Bu Sun Kim65020912020-05-20 12:08:20 -0700361 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800362 # (positive sentiment).
Bu Sun Kim65020912020-05-20 12:08:20 -0700363 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800364 # the absolute magnitude of sentiment regardless of score (positive or
365 # negative).
366 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700367 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
368 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
369 # document according to the EncodingType specified in the API request.
370 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
371 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800372 },
373 ],
374 }</pre>
375</div>
376
377<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700378 <code class="details" id="analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</code>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800379 <pre>Analyzes the syntax of the text and provides sentence boundaries and
380tokenization along with part of speech tags, dependency trees, and other
381properties.
382
383Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700384 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800385 The object takes the form of:
386
387{ # The syntax analysis request message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700388 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
389 &quot;document&quot;: { # ################################################################ # # Required. Input document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800390 #
391 # Represents the input to API methods.
Bu Sun Kim65020912020-05-20 12:08:20 -0700392 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located.
393 # This URI must be of the form: gs://bucket_name/object_name. For more
394 # details, see https://cloud.google.com/storage/docs/reference-uris.
395 # NOTE: Cloud Storage object versioning is not supported.
396 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800397 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700398 # accepted.&lt;br&gt;
399 # [Language
400 # Support](https://cloud.google.com/natural-language/docs/languages) lists
401 # currently supported languages for each API method. If the language (either
402 # specified by the caller or automatically detected) is not supported by the
403 # called API method, an `INVALID_ARGUMENT` error is returned.
Bu Sun Kim65020912020-05-20 12:08:20 -0700404 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
405 # returns an `INVALID_ARGUMENT` error.
406 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format.
407 # Cloud audit logging exempt since it is based on user data.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800408 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800409 }
410
411 x__xgafv: string, V1 error format.
412 Allowed values
413 1 - v1 error format
414 2 - v2 error format
415
416Returns:
417 An object of the form:
418
419 { # The syntax analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700420 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified
421 # in the request or, if not specified, the automatically-detected language.
422 # See Document.language field for more details.
423 &quot;sentences&quot;: [ # Sentences in the input document.
424 { # Represents a sentence in the input document.
425 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
426 # AnnotateTextRequest.Features.extract_document_sentiment is set to
427 # true, this field will contain the sentiment for the sentence.
428 # the text.
429 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
430 # (positive sentiment).
431 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
432 # the absolute magnitude of sentiment regardless of score (positive or
433 # negative).
434 },
435 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
436 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800437 # document according to the EncodingType specified in the API request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700438 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800439 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700440 },
441 ],
442 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document.
443 { # Represents the smallest syntactic building block of the text.
444 &quot;text&quot;: { # Represents an output piece of text. # The token text.
445 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
446 # document according to the EncodingType specified in the API request.
447 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Thomas Coffee2f245372017-03-27 10:39:26 -0700448 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700449 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. (For more # Dependency tree parse for this token.
Dan O'Mearadd494642020-05-01 07:42:23 -0700450 # information on dependency labels, see
451 # http://www.aclweb.org/anthology/P13-2017
Bu Sun Kim65020912020-05-20 12:08:20 -0700452 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
453 &quot;headTokenIndex&quot;: 42, # Represents the head of this token in the dependency tree.
Dan O'Mearadd494642020-05-01 07:42:23 -0700454 # This is the index of the token which has an arc going to this token.
455 # The index is the position of the token in the array of tokens returned
456 # by the API method. If this token is a root token, then the
457 # `head_token_index` is its own index.
Dan O'Mearadd494642020-05-01 07:42:23 -0700458 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700459 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
460 &quot;partOfSpeech&quot;: { # Represents part of speech information for a token. Parts of speech # Parts of speech tag for this token.
461 # are as defined in
462 # http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf
463 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
464 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
465 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
466 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
467 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
468 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
469 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
470 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
471 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
472 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
473 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
474 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800475 },
476 },
477 ],
478 }</pre>
479</div>
480
481<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700482 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800483 <pre>A convenience method that provides all the features that analyzeSentiment,
484analyzeEntities, and analyzeSyntax provide in one call.
485
486Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700487 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800488 The object takes the form of:
489
490{ # The request message for the text annotation API, which can perform multiple
491 # analysis types (sentiment, entities, and syntax) in one call.
Bu Sun Kim65020912020-05-20 12:08:20 -0700492 &quot;features&quot;: { # All available features for sentiment, syntax, and semantic analysis. # Required. The enabled features.
493 # Setting each one to true will enable that specific analysis for the input.
494 &quot;classifyText&quot;: True or False, # Classify the full document into categories.
495 &quot;extractSyntax&quot;: True or False, # Extract syntax information.
496 &quot;extractDocumentSentiment&quot;: True or False, # Extract document-level sentiment.
497 &quot;extractEntitySentiment&quot;: True or False, # Extract entities and their associated sentiment.
498 &quot;extractEntities&quot;: True or False, # Extract entities.
499 },
500 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
501 &quot;document&quot;: { # ################################################################ # # Required. Input document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800502 #
503 # Represents the input to API methods.
Bu Sun Kim65020912020-05-20 12:08:20 -0700504 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located.
505 # This URI must be of the form: gs://bucket_name/object_name. For more
506 # details, see https://cloud.google.com/storage/docs/reference-uris.
507 # NOTE: Cloud Storage object versioning is not supported.
508 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800509 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700510 # accepted.&lt;br&gt;
511 # [Language
512 # Support](https://cloud.google.com/natural-language/docs/languages) lists
513 # currently supported languages for each API method. If the language (either
514 # specified by the caller or automatically detected) is not supported by the
515 # called API method, an `INVALID_ARGUMENT` error is returned.
Bu Sun Kim65020912020-05-20 12:08:20 -0700516 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
517 # returns an `INVALID_ARGUMENT` error.
518 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format.
519 # Cloud audit logging exempt since it is based on user data.
Dan O'Mearadd494642020-05-01 07:42:23 -0700520 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800521 }
522
523 x__xgafv: string, V1 error format.
524 Allowed values
525 1 - v1 error format
526 2 - v2 error format
527
528Returns:
529 An object of the form:
530
531 { # The text annotations response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700532 &quot;categories&quot;: [ # Categories identified in the input document.
533 { # Represents a category returned from the text classifier.
534 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document, from the [predefined
535 # taxonomy](https://cloud.google.com/natural-language/docs/categories).
536 &quot;confidence&quot;: 3.14, # The classifier&#x27;s confidence of the category. Number represents how certain
537 # the classifier is that this category represents the given text.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800538 },
539 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700540 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in # The overall sentiment for the document. Populated if the user enables
541 # AnnotateTextRequest.Features.extract_document_sentiment.
542 # the text.
543 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
544 # (positive sentiment).
545 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
546 # the absolute magnitude of sentiment regardless of score (positive or
547 # negative).
548 },
549 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified
550 # in the request or, if not specified, the automatically-detected language.
551 # See Document.language field for more details.
552 &quot;entities&quot;: [ # Entities, along with their semantic information, in the input document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800553 # Populated if the user enables
554 # AnnotateTextRequest.Features.extract_entities.
555 { # Represents a phrase in the text that is a known entity, such as
556 # a person, an organization, or location. The API associates information, such
557 # as salience and mentions, with entities.
Bu Sun Kim65020912020-05-20 12:08:20 -0700558 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800559 # supports proper noun mentions.
560 { # Represents a mention for an entity in the text. Currently, proper noun
561 # mentions are supported.
Bu Sun Kim65020912020-05-20 12:08:20 -0700562 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
563 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800564 # document according to the EncodingType specified in the API request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700565 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800566 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700567 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
568 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700569 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
570 # true, this field will contain the sentiment expressed for this mention of
571 # the entity in the provided document.
572 # the text.
Bu Sun Kim65020912020-05-20 12:08:20 -0700573 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700574 # (positive sentiment).
Bu Sun Kim65020912020-05-20 12:08:20 -0700575 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700576 # the absolute magnitude of sentiment regardless of score (positive or
577 # negative).
578 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800579 },
580 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700581 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
582 &quot;type&quot;: &quot;A String&quot;, # The entity type.
583 &quot;metadata&quot;: { # Metadata associated with the entity.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800584 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700585 # For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
586 # and Knowledge Graph MID (`mid`), if they are available. For the metadata
587 # associated with other entity types, see the Type table below.
Bu Sun Kim65020912020-05-20 12:08:20 -0700588 &quot;a_key&quot;: &quot;A String&quot;,
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800589 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700590 &quot;salience&quot;: 3.14, # The salience score associated with the entity in the [0, 1.0] range.
591 #
592 # The salience score for an entity provides information about the
593 # importance or centrality of that entity to the entire document text.
594 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
595 # salient.
596 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeEntitySentiment or if
597 # AnnotateTextRequest.Features.extract_entity_sentiment is set to
598 # true, this field will contain the aggregate sentiment expressed for this
599 # entity in the provided document.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800600 # the text.
Bu Sun Kim65020912020-05-20 12:08:20 -0700601 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800602 # (positive sentiment).
Bu Sun Kim65020912020-05-20 12:08:20 -0700603 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800604 # the absolute magnitude of sentiment regardless of score (positive or
605 # negative).
606 },
607 },
608 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700609 &quot;sentences&quot;: [ # Sentences in the input document. Populated if the user enables
610 # AnnotateTextRequest.Features.extract_syntax.
611 { # Represents a sentence in the input document.
612 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
613 # AnnotateTextRequest.Features.extract_document_sentiment is set to
614 # true, this field will contain the sentiment for the sentence.
615 # the text.
616 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
617 # (positive sentiment).
618 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents
619 # the absolute magnitude of sentiment regardless of score (positive or
620 # negative).
621 },
622 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
623 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
624 # document according to the EncodingType specified in the API request.
625 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
626 },
627 },
628 ],
629 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document.
630 # Populated if the user enables
631 # AnnotateTextRequest.Features.extract_syntax.
632 { # Represents the smallest syntactic building block of the text.
633 &quot;text&quot;: { # Represents an output piece of text. # The token text.
634 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original
635 # document according to the EncodingType specified in the API request.
636 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
637 },
638 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. (For more # Dependency tree parse for this token.
639 # information on dependency labels, see
640 # http://www.aclweb.org/anthology/P13-2017
641 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
642 &quot;headTokenIndex&quot;: 42, # Represents the head of this token in the dependency tree.
643 # This is the index of the token which has an arc going to this token.
644 # The index is the position of the token in the array of tokens returned
645 # by the API method. If this token is a root token, then the
646 # `head_token_index` is its own index.
647 },
648 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
649 &quot;partOfSpeech&quot;: { # Represents part of speech information for a token. Parts of speech # Parts of speech tag for this token.
650 # are as defined in
651 # http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf
652 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
653 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
654 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
655 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
656 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
657 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
658 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
659 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
660 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
661 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
662 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
663 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
664 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700665 },
666 ],
667 }</pre>
668</div>
669
670<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700671 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700672 <pre>Classifies a document into categories.
673
674Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700675 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700676 The object takes the form of:
677
678{ # The document classification request message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700679 &quot;document&quot;: { # ################################################################ # # Required. Input document.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700680 #
681 # Represents the input to API methods.
Bu Sun Kim65020912020-05-20 12:08:20 -0700682 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located.
683 # This URI must be of the form: gs://bucket_name/object_name. For more
684 # details, see https://cloud.google.com/storage/docs/reference-uris.
685 # NOTE: Cloud Storage object versioning is not supported.
686 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700687 # automatically detected). Both ISO and BCP-47 language codes are
Dan O'Mearadd494642020-05-01 07:42:23 -0700688 # accepted.&lt;br&gt;
689 # [Language
690 # Support](https://cloud.google.com/natural-language/docs/languages) lists
691 # currently supported languages for each API method. If the language (either
692 # specified by the caller or automatically detected) is not supported by the
693 # called API method, an `INVALID_ARGUMENT` error is returned.
Bu Sun Kim65020912020-05-20 12:08:20 -0700694 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
695 # returns an `INVALID_ARGUMENT` error.
696 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format.
697 # Cloud audit logging exempt since it is based on user data.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700698 },
699 }
700
701 x__xgafv: string, V1 error format.
702 Allowed values
703 1 - v1 error format
704 2 - v2 error format
705
706Returns:
707 An object of the form:
708
709 { # The document classification response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700710 &quot;categories&quot;: [ # Categories representing the input document.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700711 { # Represents a category returned from the text classifier.
Bu Sun Kim65020912020-05-20 12:08:20 -0700712 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document, from the [predefined
Dan O'Mearadd494642020-05-01 07:42:23 -0700713 # taxonomy](https://cloud.google.com/natural-language/docs/categories).
Bu Sun Kim65020912020-05-20 12:08:20 -0700714 &quot;confidence&quot;: 3.14, # The classifier&#x27;s confidence of the category. Number represents how certain
715 # the classifier is that this category represents the given text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700716 },
717 ],
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800718 }</pre>
719</div>
720
721</body></html>