Debian Codegraph @

docs/dyn/language_v1beta2.documents.html

raw
1 <html><body>
2 <style>
3
4 body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13 }
14
15 body {
16 font-size: 13px;
17 padding: 1em;
18 }
19
20 h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23 }
24
25 h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28 }
29
30 h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34 }
35
36 pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39 }
40
41 pre {
42 margin-top: 0.5em;
43 }
44
45 h1, h2, h3, p {
46 font-family: Arial, sans serif;
47 }
48
49 h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51 }
52
53 .toc_element {
54 margin-top: 0.5em;
55 }
56
57 .firstline {
58 margin-left: 2 em;
59 }
60
61 .method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66 }
67
68 .details {
69 font-weight: bold;
70 font-size: 14px;
71 }
72
73 </style>
74
75 <h1><a href="language_v1beta2.html">Cloud Natural Language API</a> . <a href="language_v1beta2.documents.html">documents</a></h1>
76 <h2>Instance Methods</h2>
77 <p class="toc_element">
78 <code><a href="#analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</a></code></p>
79 <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>
80 <p class="toc_element">
81 <code><a href="#analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</a></code></p>
82 <p class="firstline">Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.</p>
83 <p class="toc_element">
84 <code><a href="#analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</a></code></p>
85 <p class="firstline">Analyzes the sentiment of the provided text.</p>
86 <p class="toc_element">
87 <code><a href="#analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</a></code></p>
88 <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>
89 <p class="toc_element">
90 <code><a href="#annotateText">annotateText(body=None, x__xgafv=None)</a></code></p>
91 <p class="firstline">A convenience method that provides all syntax, sentiment, entity, and classification features in one call.</p>
92 <p class="toc_element">
93 <code><a href="#classifyText">classifyText(body=None, x__xgafv=None)</a></code></p>
94 <p class="firstline">Classifies a document into categories.</p>
95 <p class="toc_element">
96 <code><a href="#close">close()</a></code></p>
97 <p class="firstline">Close httplib2 connections.</p>
98 <p class="toc_element">
99 <code><a href="#moderateText">moderateText(body=None, x__xgafv=None)</a></code></p>
100 <p class="firstline">Moderates a document for harmful and sensitive categories.</p>
101 <h3>Method Details</h3>
102 <div class="method">
103 <code class="details" id="analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</code>
104 <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.
105
106 Args:
107 body: object, The request body.
108 The object takes the form of:
109
110 { # The entity analysis request message.
111 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
112 &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.
113 &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.
114 &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.
115 &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.
116 &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.
117 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
118 },
119 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
120 }
121
122 x__xgafv: string, V1 error format.
123 Allowed values
124 1 - v1 error format
125 2 - v2 error format
126
127 Returns:
128 An object of the form:
129
130 { # The entity analysis response message.
131 &quot;entities&quot;: [ # The recognized entities in the input document.
132 { # 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.
133 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
134 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
135 &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.
136 &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).
137 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
138 },
139 &quot;text&quot;: { # Represents a text span in the input document. # The mention text.
140 &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.
141 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
142 },
143 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
144 },
145 ],
146 &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.
147 &quot;a_key&quot;: &quot;A String&quot;,
148 },
149 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
150 &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.
151 &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.
152 &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).
153 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
154 },
155 &quot;type&quot;: &quot;A String&quot;, # The entity type.
156 },
157 ],
158 &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.
159 }</pre>
160 </div>
161
162 <div class="method">
163 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</code>
164 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.
165
166 Args:
167 body: object, The request body.
168 The object takes the form of:
169
170 { # The entity-level sentiment analysis request message.
171 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
172 &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.
173 &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.
174 &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.
175 &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.
176 &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.
177 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
178 },
179 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
180 }
181
182 x__xgafv: string, V1 error format.
183 Allowed values
184 1 - v1 error format
185 2 - v2 error format
186
187 Returns:
188 An object of the form:
189
190 { # The entity-level sentiment analysis response message.
191 &quot;entities&quot;: [ # The recognized entities in the input document with associated sentiments.
192 { # 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.
193 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
194 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
195 &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.
196 &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).
197 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
198 },
199 &quot;text&quot;: { # Represents a text span in the input document. # The mention text.
200 &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.
201 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
202 },
203 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
204 },
205 ],
206 &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.
207 &quot;a_key&quot;: &quot;A String&quot;,
208 },
209 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
210 &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.
211 &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.
212 &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).
213 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
214 },
215 &quot;type&quot;: &quot;A String&quot;, # The entity type.
216 },
217 ],
218 &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.
219 }</pre>
220 </div>
221
222 <div class="method">
223 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code>
224 <pre>Analyzes the sentiment of the provided text.
225
226 Args:
227 body: object, The request body.
228 The object takes the form of:
229
230 { # The sentiment analysis request message.
231 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
232 &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.
233 &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.
234 &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.
235 &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.
236 &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.
237 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
238 },
239 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate sentence offsets for the sentence sentiment.
240 }
241
242 x__xgafv: string, V1 error format.
243 Allowed values
244 1 - v1 error format
245 2 - v2 error format
246
247 Returns:
248 An object of the form:
249
250 { # The sentiment analysis response message.
251 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # The overall sentiment of the input document.
252 &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).
253 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
254 },
255 &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.
256 &quot;sentences&quot;: [ # The sentiment for all the sentences in the document.
257 { # Represents a sentence in the input document.
258 &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.
259 &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).
260 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
261 },
262 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
263 &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.
264 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
265 },
266 },
267 ],
268 }</pre>
269 </div>
270
271 <div class="method">
272 <code class="details" id="analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</code>
273 <pre>Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
274
275 Args:
276 body: object, The request body.
277 The object takes the form of:
278
279 { # The syntax analysis request message.
280 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
281 &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.
282 &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.
283 &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.
284 &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.
285 &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.
286 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
287 },
288 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
289 }
290
291 x__xgafv: string, V1 error format.
292 Allowed values
293 1 - v1 error format
294 2 - v2 error format
295
296 Returns:
297 An object of the form:
298
299 { # The syntax analysis response message.
300 &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.
301 &quot;sentences&quot;: [ # Sentences in the input document.
302 { # Represents a sentence in the input document.
303 &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.
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).
306 },
307 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
308 &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.
309 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
310 },
311 },
312 ],
313 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document.
314 { # Represents the smallest syntactic building block of the text.
315 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. # Dependency tree parse for this token.
316 &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.
317 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
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;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
322 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
323 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
324 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
325 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
326 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
327 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
328 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
329 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
330 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
331 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
332 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
333 },
334 &quot;text&quot;: { # Represents a text span in the input document. # The token text.
335 &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.
336 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
337 },
338 },
339 ],
340 }</pre>
341 </div>
342
343 <div class="method">
344 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code>
345 <pre>A convenience method that provides all syntax, sentiment, entity, and classification features in one call.
346
347 Args:
348 body: object, The request body.
349 The object takes the form of:
350
351 { # The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call.
352 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
353 &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.
354 &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.
355 &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.
356 &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.
357 &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.
358 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
359 },
360 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
361 &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.
362 &quot;classificationModelOptions&quot;: { # Model options available for classification requests. # Optional. The model options to use for classification. Defaults to v1 options if not specified. Only used if `classify_text` is set to true.
363 &quot;v1Model&quot;: { # Options for the V1 model. # Setting this field will use the V1 model and V1 content categories version. The V1 model is a legacy model; support for this will be discontinued in the future.
364 },
365 &quot;v2Model&quot;: { # Options for the V2 model. # Setting this field will use the V2 model with the appropriate content categories version. The V2 model is a better performing model.
366 &quot;contentCategoriesVersion&quot;: &quot;A String&quot;, # The content categories used for classification.
367 },
368 },
369 &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).
370 &quot;extractDocumentSentiment&quot;: True or False, # Extract document-level sentiment.
371 &quot;extractEntities&quot;: True or False, # Extract entities.
372 &quot;extractEntitySentiment&quot;: True or False, # Extract entities and their associated sentiment.
373 &quot;extractSyntax&quot;: True or False, # Extract syntax information.
374 &quot;moderateText&quot;: True or False, # Moderate the document for harmful and sensitive categories.
375 },
376 }
377
378 x__xgafv: string, V1 error format.
379 Allowed values
380 1 - v1 error format
381 2 - v2 error format
382
383 Returns:
384 An object of the form:
385
386 { # The text annotations response message.
387 &quot;categories&quot;: [ # Categories identified in the input document.
388 { # Represents a category returned from the text classifier.
389 &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.
390 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
391 },
392 ],
393 &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.
394 &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).
395 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
396 },
397 &quot;entities&quot;: [ # Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities.
398 { # 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.
399 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
400 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
401 &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.
402 &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).
403 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
404 },
405 &quot;text&quot;: { # Represents a text span in the input document. # The mention text.
406 &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.
407 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
408 },
409 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
410 },
411 ],
412 &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.
413 &quot;a_key&quot;: &quot;A String&quot;,
414 },
415 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
416 &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.
417 &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.
418 &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).
419 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
420 },
421 &quot;type&quot;: &quot;A String&quot;, # The entity type.
422 },
423 ],
424 &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.
425 &quot;moderationCategories&quot;: [ # Harmful and sensitive categories identified in the input document.
426 { # Represents a category returned from the text classifier.
427 &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.
428 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
429 },
430 ],
431 &quot;sentences&quot;: [ # Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
432 { # Represents a sentence in the input document.
433 &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.
434 &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).
435 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
436 },
437 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
438 &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.
439 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
440 },
441 },
442 ],
443 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
444 { # Represents the smallest syntactic building block of the text.
445 &quot;dependencyEdge&quot;: { # Represents dependency parse tree information for a token. # Dependency tree parse for this token.
446 &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.
447 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
448 },
449 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
450 &quot;partOfSpeech&quot;: { # Represents part of speech information for a token. # Parts of speech tag for this token.
451 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
452 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
453 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
454 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
455 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
456 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
457 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
458 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
459 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
460 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
461 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
462 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
463 },
464 &quot;text&quot;: { # Represents a text span in the input document. # The token text.
465 &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.
466 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
467 },
468 },
469 ],
470 }</pre>
471 </div>
472
473 <div class="method">
474 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code>
475 <pre>Classifies a document into categories.
476
477 Args:
478 body: object, The request body.
479 The object takes the form of:
480
481 { # The document classification request message.
482 &quot;classificationModelOptions&quot;: { # Model options available for classification requests. # Optional. Model options to use for classification. Defaults to v1 options if not specified.
483 &quot;v1Model&quot;: { # Options for the V1 model. # Setting this field will use the V1 model and V1 content categories version. The V1 model is a legacy model; support for this will be discontinued in the future.
484 },
485 &quot;v2Model&quot;: { # Options for the V2 model. # Setting this field will use the V2 model with the appropriate content categories version. The V2 model is a better performing model.
486 &quot;contentCategoriesVersion&quot;: &quot;A String&quot;, # The content categories used for classification.
487 },
488 },
489 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
490 &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.
491 &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.
492 &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.
493 &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.
494 &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.
495 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
496 },
497 }
498
499 x__xgafv: string, V1 error format.
500 Allowed values
501 1 - v1 error format
502 2 - v2 error format
503
504 Returns:
505 An object of the form:
506
507 { # The document classification response message.
508 &quot;categories&quot;: [ # Categories representing the input document.
509 { # Represents a category returned from the text classifier.
510 &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.
511 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
512 },
513 ],
514 }</pre>
515 </div>
516
517 <div class="method">
518 <code class="details" id="close">close()</code>
519 <pre>Close httplib2 connections.</pre>
520 </div>
521
522 <div class="method">
523 <code class="details" id="moderateText">moderateText(body=None, x__xgafv=None)</code>
524 <pre>Moderates a document for harmful and sensitive categories.
525
526 Args:
527 body: object, The request body.
528 The object takes the form of:
529
530 { # The document moderation request message.
531 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
532 &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.
533 &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.
534 &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.
535 &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.
536 &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.
537 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
538 },
539 }
540
541 x__xgafv: string, V1 error format.
542 Allowed values
543 1 - v1 error format
544 2 - v2 error format
545
546 Returns:
547 An object of the form:
548
549 { # The document moderation response message.
550 &quot;moderationCategories&quot;: [ # Harmful and sensitive categories representing the input document.
551 { # Represents a category returned from the text classifier.
552 &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.
553 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
554 },
555 ],
556 }</pre>
557 </div>
558
559 </body></html>