blob: fb4fe42d0e863306b57926fd70ae180eff1f637f [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>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070079<p class="firstline">Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.</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>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070082<p class="firstline">Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.</p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070083<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>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070088<p class="firstline">Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.</p>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080089<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>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070091<p class="firstline">A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.</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>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070095<p class="toc_element">
96 <code><a href="#close">close()</a></code></p>
97<p class="firstline">Close httplib2 connections.</p>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080098<h3>Method Details</h3>
99<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700100 <code class="details" id="analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700101 <pre>Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800102
103Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700104 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800105 The object takes the form of:
106
107{ # The entity analysis request message.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800108 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700109 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800110 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format. Cloud audit logging exempt since it is based on user data.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800111 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800112 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800113 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800114 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800115 }
116
117 x__xgafv: string, V1 error format.
118 Allowed values
119 1 - v1 error format
120 2 - v2 error format
121
122Returns:
123 An object of the form:
124
125 { # The entity analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700126 &quot;entities&quot;: [ # The recognized entities in the input document.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700127 { # Represents a phrase in the text that is a known entity, such as a person, an organization, or location. The API associates information, such as salience and mentions, with entities.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800128 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
129 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
130 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
131 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of the entity in the provided document.
132 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
133 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
134 },
135 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
136 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
137 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
138 },
139 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
140 },
141 ],
142 &quot;salience&quot;: 3.14, # The salience score associated with the entity in the [0, 1.0] range. The salience score for an entity provides information about the importance or centrality of that entity to the entire document text. Scores closer to 0 are less salient, while scores closer to 1.0 are highly salient.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800143 &quot;metadata&quot;: { # Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the metadata associated with other entity types, see the Type table below.
144 &quot;a_key&quot;: &quot;A String&quot;,
145 },
146 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.
147 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
148 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
149 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800150 &quot;type&quot;: &quot;A String&quot;, # The entity type.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700151 },
152 ],
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800153 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700154 }</pre>
155</div>
156
157<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700158 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700159 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700160
161Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700162 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700163 The object takes the form of:
164
165{ # The entity-level sentiment analysis request message.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800166 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700167 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800168 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format. Cloud audit logging exempt since it is based on user data.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800169 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800170 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800171 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700172 },
173 }
174
175 x__xgafv: string, V1 error format.
176 Allowed values
177 1 - v1 error format
178 2 - v2 error format
179
180Returns:
181 An object of the form:
182
183 { # The entity-level sentiment analysis response message.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800184 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.
Bu Sun Kim65020912020-05-20 12:08:20 -0700185 &quot;entities&quot;: [ # The recognized entities in the input document with associated sentiments.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700186 { # Represents a phrase in the text that is a known entity, such as a person, an organization, or location. The API associates information, such as salience and mentions, with entities.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800187 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
188 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
189 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
190 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of the entity in the provided document.
191 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
192 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
193 },
194 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
195 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
196 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
197 },
198 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
199 },
200 ],
201 &quot;salience&quot;: 3.14, # The salience score associated with the entity in the [0, 1.0] range. The salience score for an entity provides information about the importance or centrality of that entity to the entire document text. Scores closer to 0 are less salient, while scores closer to 1.0 are highly salient.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800202 &quot;metadata&quot;: { # Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the metadata associated with other entity types, see the Type table below.
203 &quot;a_key&quot;: &quot;A String&quot;,
204 },
205 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.
206 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
207 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
208 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800209 &quot;type&quot;: &quot;A String&quot;, # The entity type.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800210 },
211 ],
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800212 }</pre>
213</div>
214
215<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700216 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800217 <pre>Analyzes the sentiment of the provided text.
218
219Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700220 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800221 The object takes the form of:
222
223{ # The sentiment analysis request message.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700224 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800225 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format. Cloud audit logging exempt since it is based on user data.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800226 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800227 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800228 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800229 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800230 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate sentence offsets.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800231 }
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 sentiment analysis response message.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700242 &quot;sentences&quot;: [ # The sentiment for all the sentences in the document.
243 { # Represents a sentence in the input document.
244 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700245 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700246 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700247 },
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700248 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700249 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800250 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700251 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700252 },
253 ],
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700254 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800255 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # The overall sentiment of the input document.
256 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
257 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
258 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800259 }</pre>
260</div>
261
262<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700263 <code class="details" id="analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700264 <pre>Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800265
266Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700267 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800268 The object takes the form of:
269
270{ # The syntax analysis request message.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800271 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700272 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800273 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format. Cloud audit logging exempt since it is based on user data.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800274 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800275 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800276 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800277 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800278 }
279
280 x__xgafv: string, V1 error format.
281 Allowed values
282 1 - v1 error format
283 2 - v2 error format
284
285Returns:
286 An object of the form:
287
288 { # The syntax analysis response message.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700289 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700290 &quot;sentences&quot;: [ # Sentences in the input document.
291 { # Represents a sentence in the input document.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700292 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700293 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700294 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800295 },
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700296 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700297 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800298 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700299 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800300 },
301 ],
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800302 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document.
303 { # Represents the smallest syntactic building block of the text.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800304 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. (For more information on dependency labels, see http://www.aclweb.org/anthology/P13-2017 # Dependency tree parse for this token.
305 &quot;headTokenIndex&quot;: 42, # Represents the head of this token in the dependency tree. This is the index of the token which has an arc going to this token. The index is the position of the token in the array of tokens returned by the API method. If this token is a root token, then the `head_token_index` is its own index.
306 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
307 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800308 &quot;partOfSpeech&quot;: { # Represents part of speech information for a token. Parts of speech are as defined in http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf # Parts of speech tag for this token.
309 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
310 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
311 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
312 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
313 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
314 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
315 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
316 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
317 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
318 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
319 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
320 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
321 },
322 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800323 &quot;text&quot;: { # Represents an output piece of text. # The token text.
324 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
325 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
326 },
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800327 },
328 ],
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800329 }</pre>
330</div>
331
332<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700333 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700334 <pre>A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800335
336Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700337 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800338 The object takes the form of:
339
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700340{ # The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700341 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700342 &quot;features&quot;: { # All available features for sentiment, syntax, and semantic analysis. Setting each one to true will enable that specific analysis for the input. # Required. The enabled features.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700343 &quot;classifyText&quot;: True or False, # Classify the full document into categories.
344 &quot;extractEntitySentiment&quot;: True or False, # Extract entities and their associated sentiment.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800345 &quot;extractEntities&quot;: True or False, # Extract entities.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700346 &quot;extractSyntax&quot;: True or False, # Extract syntax information.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800347 &quot;extractDocumentSentiment&quot;: True or False, # Extract document-level sentiment.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700348 },
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800349 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800350 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format. Cloud audit logging exempt since it is based on user data.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800351 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800352 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800353 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800354 },
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800355 }
356
357 x__xgafv: string, V1 error format.
358 Allowed values
359 1 - v1 error format
360 2 - v2 error format
361
362Returns:
363 An object of the form:
364
365 { # The text annotations response message.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800366 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
367 { # Represents the smallest syntactic building block of the text.
368 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. (For more information on dependency labels, see http://www.aclweb.org/anthology/P13-2017 # Dependency tree parse for this token.
369 &quot;headTokenIndex&quot;: 42, # Represents the head of this token in the dependency tree. This is the index of the token which has an arc going to this token. The index is the position of the token in the array of tokens returned by the API method. If this token is a root token, then the `head_token_index` is its own index.
370 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
371 },
372 &quot;partOfSpeech&quot;: { # Represents part of speech information for a token. Parts of speech are as defined in http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf # Parts of speech tag for this token.
373 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
374 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
375 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
376 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
377 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
378 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
379 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
380 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
381 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
382 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
383 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
384 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
385 },
386 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
387 &quot;text&quot;: { # Represents an output piece of text. # The token text.
388 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
389 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
390 },
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700391 },
392 ],
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700393 &quot;sentences&quot;: [ # Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
394 { # Represents a sentence in the input document.
395 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700396 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700397 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700398 },
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700399 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700400 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800401 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700402 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700403 },
404 ],
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800405 &quot;categories&quot;: [ # Categories identified in the input document.
406 { # Represents a category returned from the text classifier.
407 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document, from the [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories).
408 &quot;confidence&quot;: 3.14, # The classifier&#x27;s confidence of the category. Number represents how certain the classifier is that this category represents the given text.
409 },
410 ],
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800411 &quot;entities&quot;: [ # Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities.
412 { # Represents a phrase in the text that is a known entity, such as a person, an organization, or location. The API associates information, such as salience and mentions, with entities.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800413 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
414 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
415 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
416 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the sentiment expressed for this mention of the entity in the provided document.
417 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
418 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
419 },
420 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
421 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
422 &quot;beginOffset&quot;: 42, # The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.
423 },
424 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
425 },
426 ],
427 &quot;salience&quot;: 3.14, # The salience score associated with the entity in the [0, 1.0] range. The salience score for an entity provides information about the importance or centrality of that entity to the entire document text. Scores closer to 0 are less salient, while scores closer to 1.0 are highly salient.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800428 &quot;metadata&quot;: { # Metadata associated with the entity. For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`), if they are available. For the metadata associated with other entity types, see the Type table below.
429 &quot;a_key&quot;: &quot;A String&quot;,
430 },
431 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment or if AnnotateTextRequest.Features.extract_entity_sentiment is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.
432 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
433 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
434 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800435 &quot;type&quot;: &quot;A String&quot;, # The entity type.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800436 },
437 ],
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800438 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # The overall sentiment for the document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment.
439 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
440 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
441 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800442 &quot;language&quot;: &quot;A String&quot;, # The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700443 }</pre>
444</div>
445
446<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700447 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700448 <pre>Classifies a document into categories.
449
450Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700451 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700452 The object takes the form of:
453
454{ # The document classification request message.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700455 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800456 &quot;content&quot;: &quot;A String&quot;, # The content of the input in string format. Cloud audit logging exempt since it is based on user data.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800457 &quot;gcsContentUri&quot;: &quot;A String&quot;, # The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800458 &quot;language&quot;: &quot;A String&quot;, # The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800459 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700460 },
461 }
462
463 x__xgafv: string, V1 error format.
464 Allowed values
465 1 - v1 error format
466 2 - v2 error format
467
468Returns:
469 An object of the form:
470
471 { # The document classification response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700472 &quot;categories&quot;: [ # Categories representing the input document.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700473 { # Represents a category returned from the text classifier.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700474 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document, from the [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories).
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800475 &quot;confidence&quot;: 3.14, # The classifier&#x27;s confidence of the category. Number represents how certain the classifier is that this category represents the given text.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700476 },
477 ],
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800478 }</pre>
479</div>
480
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700481<div class="method">
482 <code class="details" id="close">close()</code>
483 <pre>Close httplib2 connections.</pre>
484</div>
485
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800486</body></html>