blob: bf3292b821489f69223542399447db65421e6817 [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>
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>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040080<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>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040083<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>
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>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040089<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 syntax, sentiment, entity, and classification features 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>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040098<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.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400102
103Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700104 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400105 The object takes the form of:
106
107{ # The entity analysis request message.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700108 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700109 &quot;boilerplateHandling&quot;: &quot;A String&quot;, # Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800110 &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 Botc2228be2020-11-24 15:48:03 -0800111 &quot;referenceWebUri&quot;: &quot;A String&quot;, # The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800112 &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 Botb6971b02020-11-26 17:16:03 -0800113 &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 -0800114 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700115 },
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800116 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400117 }
118
119 x__xgafv: string, V1 error format.
120 Allowed values
121 1 - v1 error format
122 2 - v2 error format
123
124Returns:
125 An object of the form:
126
127 { # The entity analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700128 &quot;entities&quot;: [ # The recognized entities in the input document.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700129 { # 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 Botb6971b02020-11-26 17:16:03 -0800130 &quot;type&quot;: &quot;A String&quot;, # The entity type.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700131 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
132 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700133 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # 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.
134 &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).
135 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700136 },
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800137 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700138 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800139 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800140 &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 Kim673ec5c2020-11-16 11:05:03 -0700141 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700142 },
143 ],
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800144 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # 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.
145 &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).
146 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
147 },
148 &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.
149 &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.
150 &quot;a_key&quot;: &quot;A String&quot;,
151 },
152 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400153 },
154 ],
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800155 &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.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400156 }</pre>
157</div>
158
159<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700160 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700161 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400162
163Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700164 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400165 The object takes the form of:
166
167{ # The entity-level sentiment analysis request message.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700168 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800169 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
170 &quot;boilerplateHandling&quot;: &quot;A String&quot;, # Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800171 &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.
172 &quot;referenceWebUri&quot;: &quot;A String&quot;, # The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document.
173 &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 Botb6971b02020-11-26 17:16:03 -0800174 &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 -0800175 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
176 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400177 }
178
179 x__xgafv: string, V1 error format.
180 Allowed values
181 1 - v1 error format
182 2 - v2 error format
183
184Returns:
185 An object of the form:
186
187 { # The entity-level sentiment analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700188 &quot;entities&quot;: [ # The recognized entities in the input document with associated sentiments.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700189 { # 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 Botb6971b02020-11-26 17:16:03 -0800190 &quot;type&quot;: &quot;A String&quot;, # The entity type.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700191 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
192 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700193 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # 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.
194 &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).
195 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700196 },
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800197 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700198 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800199 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800200 &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 Kim673ec5c2020-11-16 11:05:03 -0700201 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700202 },
203 ],
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800204 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # 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.
205 &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).
206 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
207 },
208 &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.
209 &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.
210 &quot;a_key&quot;: &quot;A String&quot;,
211 },
212 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400213 },
214 ],
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800215 &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.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400216 }</pre>
217</div>
218
219<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700220 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400221 <pre>Analyzes the sentiment of the provided text.
222
223Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700224 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400225 The object takes the form of:
226
227{ # The sentiment analysis request message.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700228 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700229 &quot;boilerplateHandling&quot;: &quot;A String&quot;, # Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800230 &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 Botc2228be2020-11-24 15:48:03 -0800231 &quot;referenceWebUri&quot;: &quot;A String&quot;, # The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800232 &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 Botb6971b02020-11-26 17:16:03 -0800233 &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 -0800234 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400235 },
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800236 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate sentence offsets for the sentence sentiment.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400237 }
238
239 x__xgafv: string, V1 error format.
240 Allowed values
241 1 - v1 error format
242 2 - v2 error format
243
244Returns:
245 An object of the form:
246
247 { # The sentiment analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700248 &quot;sentences&quot;: [ # The sentiment for all the sentences in the document.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400249 { # Represents a sentence in the input document.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800250 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
251 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
252 &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.
253 },
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700254 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.
255 &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).
256 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400257 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400258 },
259 ],
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800260 &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 Bot0d561ef2020-11-25 07:50:41 -0800261 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # The overall sentiment of the input document.
262 &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).
263 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
264 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400265 }</pre>
266</div>
267
268<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700269 <code class="details" id="analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700270 <pre>Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400271
272Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700273 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400274 The object takes the form of:
275
276{ # The syntax analysis request message.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700277 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700278 &quot;boilerplateHandling&quot;: &quot;A String&quot;, # Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800279 &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 Botc2228be2020-11-24 15:48:03 -0800280 &quot;referenceWebUri&quot;: &quot;A String&quot;, # The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800281 &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 Botb6971b02020-11-26 17:16:03 -0800282 &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 -0800283 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400284 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800285 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400286 }
287
288 x__xgafv: string, V1 error format.
289 Allowed values
290 1 - v1 error format
291 2 - v2 error format
292
293Returns:
294 An object of the form:
295
296 { # The syntax analysis response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700297 &quot;sentences&quot;: [ # Sentences in the input document.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400298 { # Represents a sentence in the input document.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800299 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
300 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
301 &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.
302 },
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700303 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.
304 &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).
305 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400306 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700307 },
308 ],
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800309 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document.
310 { # Represents the smallest syntactic building block of the text.
311 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. # Dependency tree parse for this token.
312 &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.
313 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
314 },
315 &quot;text&quot;: { # Represents an output piece of text. # The token text.
316 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
317 &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.
318 },
319 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
320 &quot;partOfSpeech&quot;: { # Represents part of speech information for a token. # Parts of speech tag for this token.
321 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
322 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
323 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
324 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
325 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
326 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
327 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
328 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
329 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
330 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
331 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
332 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
333 },
334 },
335 ],
336 &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.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400337 }</pre>
338</div>
339
340<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700341 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700342 <pre>A convenience method that provides all syntax, sentiment, entity, and classification features in one call.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400343
344Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700345 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400346 The object takes the form of:
347
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700348{ # The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call.
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800349 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700350 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700351 &quot;boilerplateHandling&quot;: &quot;A String&quot;, # Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -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 Botc2228be2020-11-24 15:48:03 -0800353 &quot;referenceWebUri&quot;: &quot;A String&quot;, # The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800354 &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 Botb6971b02020-11-26 17:16:03 -0800355 &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 -0800356 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
357 },
358 &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. Next ID: 10 # Required. The enabled features.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800359 &quot;extractEntities&quot;: True or False, # Extract entities.
360 &quot;extractSyntax&quot;: True or False, # Extract syntax information.
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800361 &quot;extractEntitySentiment&quot;: True or False, # Extract entities and their associated sentiment.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800362 &quot;extractDocumentSentiment&quot;: True or False, # Extract document-level sentiment.
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800363 &quot;classifyText&quot;: True or False, # Classify the full document into categories. If this is true, the API will use the default model which classifies into a [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories).
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800364 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400365 }
366
367 x__xgafv: string, V1 error format.
368 Allowed values
369 1 - v1 error format
370 2 - v2 error format
371
372Returns:
373 An object of the form:
374
375 { # The text annotations response message.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800376 &quot;sentences&quot;: [ # Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
377 { # Represents a sentence in the input document.
378 &quot;text&quot;: { # Represents an output piece of text. # The sentence text.
379 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
380 &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.
381 },
382 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800383 &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).
384 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
385 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800386 },
387 ],
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800388 &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.
389 &quot;entities&quot;: [ # Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities.
390 { # 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.
391 &quot;type&quot;: &quot;A String&quot;, # The entity type.
392 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
393 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
394 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # 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.
395 &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).
396 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
397 },
398 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
399 &quot;text&quot;: { # Represents an output piece of text. # The mention text.
400 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
401 &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.
402 },
403 },
404 ],
405 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # 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.
406 &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).
407 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
408 },
409 &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.
410 &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.
411 &quot;a_key&quot;: &quot;A String&quot;,
412 },
413 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
414 },
415 ],
416 &quot;categories&quot;: [ # Categories identified in the input document.
417 { # Represents a category returned from the text classifier.
418 &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.
419 &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).
420 },
421 ],
422 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. Next ID: 6 # The overall sentiment for the document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment.
423 &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).
424 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
425 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800426 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
427 { # Represents the smallest syntactic building block of the text.
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800428 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. # Dependency tree parse for this token.
429 &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.
430 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
431 },
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800432 &quot;text&quot;: { # Represents an output piece of text. # The token text.
433 &quot;content&quot;: &quot;A String&quot;, # The content of the output text.
434 &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.
435 },
436 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800437 &quot;partOfSpeech&quot;: { # Represents part of speech information for a token. # Parts of speech tag for this token.
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800438 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
439 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
440 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
441 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
442 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
443 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
444 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800445 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
446 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800447 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800448 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800449 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700450 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700451 },
452 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700453 }</pre>
454</div>
455
456<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700457 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700458 <pre>Classifies a document into categories.
459
460Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700461 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700462 The object takes the form of:
463
464{ # The document classification request message.
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700465 &quot;document&quot;: { # ################################################################ # Represents the input to API methods. # Required. Input document.
Bu Sun Kim673ec5c2020-11-16 11:05:03 -0700466 &quot;boilerplateHandling&quot;: &quot;A String&quot;, # Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800467 &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 Botc2228be2020-11-24 15:48:03 -0800468 &quot;referenceWebUri&quot;: &quot;A String&quot;, # The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800469 &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 Botb6971b02020-11-26 17:16:03 -0800470 &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 -0800471 &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 -0700472 },
473 }
474
475 x__xgafv: string, V1 error format.
476 Allowed values
477 1 - v1 error format
478 2 - v2 error format
479
480Returns:
481 An object of the form:
482
483 { # The document classification response message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700484 &quot;categories&quot;: [ # Categories representing the input document.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700485 { # Represents a category returned from the text classifier.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800486 &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.
Yoshi Automation Bot0d561ef2020-11-25 07:50:41 -0800487 &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).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700488 },
489 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400490 }</pre>
491</div>
492
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700493<div class="method">
494 <code class="details" id="close">close()</code>
495 <pre>Close httplib2 connections.</pre>
496</div>
497
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400498</body></html>