Debian Codegraph @

docs/dyn/language_v1.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_v1.html">Cloud Natural Language API</a> . <a href="language_v1.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 the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide 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;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.
113 &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.
114 &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.
115 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
116 },
117 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
118 }
119
120 x__xgafv: string, V1 error format.
121 Allowed values
122 1 - v1 error format
123 2 - v2 error format
124
125 Returns:
126 An object of the form:
127
128 { # The entity analysis response message.
129 &quot;entities&quot;: [ # The recognized entities in the input document.
130 { # 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.
131 &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.
133 &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.
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).
136 },
137 &quot;text&quot;: { # Represents a text span in the input document. # The mention text.
138 &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.
139 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
140 },
141 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
142 },
143 ],
144 &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.
145 &quot;a_key&quot;: &quot;A String&quot;,
146 },
147 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
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;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.
150 &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).
151 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
152 },
153 &quot;type&quot;: &quot;A String&quot;, # The entity type.
154 },
155 ],
156 &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.
157 }</pre>
158 </div>
159
160 <div class="method">
161 <code class="details" id="analyzeEntitySentiment">analyzeEntitySentiment(body=None, x__xgafv=None)</code>
162 <pre>Finds entities, similar to AnalyzeEntities in the text and analyzes sentiment associated with each entity and its mentions.
163
164 Args:
165 body: object, The request body.
166 The object takes the form of:
167
168 { # The entity-level sentiment analysis request message.
169 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
170 &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.
171 &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.
172 &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.
173 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
174 },
175 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
176 }
177
178 x__xgafv: string, V1 error format.
179 Allowed values
180 1 - v1 error format
181 2 - v2 error format
182
183 Returns:
184 An object of the form:
185
186 { # The entity-level sentiment analysis response message.
187 &quot;entities&quot;: [ # The recognized entities in the input document with associated sentiments.
188 { # 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.
189 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
190 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
191 &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.
192 &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).
193 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
194 },
195 &quot;text&quot;: { # Represents a text span in the input document. # The mention 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 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
198 },
199 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
200 },
201 ],
202 &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;name&quot;: &quot;A String&quot;, # The representative name for the entity.
206 &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.
207 &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.
208 &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).
209 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
210 },
211 &quot;type&quot;: &quot;A String&quot;, # The entity type.
212 },
213 ],
214 &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.
215 }</pre>
216 </div>
217
218 <div class="method">
219 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code>
220 <pre>Analyzes the sentiment of the provided text.
221
222 Args:
223 body: object, The request body.
224 The object takes the form of:
225
226 { # The sentiment analysis request message.
227 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
228 &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.
229 &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.
230 &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.
231 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
232 },
233 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate sentence offsets.
234 }
235
236 x__xgafv: string, V1 error format.
237 Allowed values
238 1 - v1 error format
239 2 - v2 error format
240
241 Returns:
242 An object of the form:
243
244 { # The sentiment analysis response message.
245 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # The overall sentiment of the input document.
246 &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).
247 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
248 },
249 &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.
250 &quot;sentences&quot;: [ # The sentiment for all the sentences in the document.
251 { # Represents a sentence in the input document.
252 &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.
253 &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).
254 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
255 },
256 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
257 &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.
258 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
259 },
260 },
261 ],
262 }</pre>
263 </div>
264
265 <div class="method">
266 <code class="details" id="analyzeSyntax">analyzeSyntax(body=None, x__xgafv=None)</code>
267 <pre>Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
268
269 Args:
270 body: object, The request body.
271 The object takes the form of:
272
273 { # The syntax analysis request message.
274 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
275 &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.
276 &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.
277 &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.
278 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
279 },
280 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
281 }
282
283 x__xgafv: string, V1 error format.
284 Allowed values
285 1 - v1 error format
286 2 - v2 error format
287
288 Returns:
289 An object of the form:
290
291 { # The syntax analysis response message.
292 &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.
293 &quot;sentences&quot;: [ # Sentences in the input document.
294 { # Represents a sentence in the input document.
295 &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.
296 &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).
297 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
298 },
299 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
300 &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.
301 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
302 },
303 },
304 ],
305 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document.
306 { # Represents the smallest syntactic building block of the text.
307 &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.
308 &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.
309 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
310 },
311 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
312 &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.
313 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
314 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
315 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
316 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
317 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
318 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
319 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
320 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
321 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
322 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
323 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
324 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
325 },
326 &quot;text&quot;: { # Represents a text span in the input document. # The token text.
327 &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.
328 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
329 },
330 },
331 ],
332 }</pre>
333 </div>
334
335 <div class="method">
336 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code>
337 <pre>A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
338
339 Args:
340 body: object, The request body.
341 The object takes the form of:
342
343 { # The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call.
344 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
345 &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.
346 &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.
347 &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.
348 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
349 },
350 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
351 &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.
352 &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.
353 &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.
354 },
355 &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.
356 &quot;contentCategoriesVersion&quot;: &quot;A String&quot;, # The content categories used for classification.
357 },
358 },
359 &quot;classifyText&quot;: True or False, # Classify the full document into categories.
360 &quot;extractDocumentSentiment&quot;: True or False, # Extract document-level sentiment.
361 &quot;extractEntities&quot;: True or False, # Extract entities.
362 &quot;extractEntitySentiment&quot;: True or False, # Extract entities and their associated sentiment.
363 &quot;extractSyntax&quot;: True or False, # Extract syntax information.
364 &quot;moderateText&quot;: True or False, # Moderate the document for harmful and sensitive categories.
365 },
366 }
367
368 x__xgafv: string, V1 error format.
369 Allowed values
370 1 - v1 error format
371 2 - v2 error format
372
373 Returns:
374 An object of the form:
375
376 { # The text annotations response message.
377 &quot;categories&quot;: [ # Categories identified in the input document.
378 { # Represents a category returned from the text classifier.
379 &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.
380 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
381 },
382 ],
383 &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.
384 &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).
385 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
386 },
387 &quot;entities&quot;: [ # Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities.
388 { # 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.
389 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
390 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
391 &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.
392 &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).
393 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
394 },
395 &quot;text&quot;: { # Represents a text span in the input document. # The mention text.
396 &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.
397 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
398 },
399 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
400 },
401 ],
402 &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.
403 &quot;a_key&quot;: &quot;A String&quot;,
404 },
405 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
406 &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.
407 &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.
408 &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).
409 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
410 },
411 &quot;type&quot;: &quot;A String&quot;, # The entity type.
412 },
413 ],
414 &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.
415 &quot;moderationCategories&quot;: [ # Harmful and sensitive categories identified in the input document.
416 { # Represents a category returned from the text classifier.
417 &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.
418 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
419 },
420 ],
421 &quot;sentences&quot;: [ # Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
422 { # Represents a sentence in the input document.
423 &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.
424 &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).
425 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
426 },
427 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
428 &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.
429 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
430 },
431 },
432 ],
433 &quot;tokens&quot;: [ # Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
434 { # Represents the smallest syntactic building block of the text.
435 &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.
436 &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.
437 &quot;label&quot;: &quot;A String&quot;, # The parse label for the token.
438 },
439 &quot;lemma&quot;: &quot;A String&quot;, # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
440 &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.
441 &quot;aspect&quot;: &quot;A String&quot;, # The grammatical aspect.
442 &quot;case&quot;: &quot;A String&quot;, # The grammatical case.
443 &quot;form&quot;: &quot;A String&quot;, # The grammatical form.
444 &quot;gender&quot;: &quot;A String&quot;, # The grammatical gender.
445 &quot;mood&quot;: &quot;A String&quot;, # The grammatical mood.
446 &quot;number&quot;: &quot;A String&quot;, # The grammatical number.
447 &quot;person&quot;: &quot;A String&quot;, # The grammatical person.
448 &quot;proper&quot;: &quot;A String&quot;, # The grammatical properness.
449 &quot;reciprocity&quot;: &quot;A String&quot;, # The grammatical reciprocity.
450 &quot;tag&quot;: &quot;A String&quot;, # The part of speech tag.
451 &quot;tense&quot;: &quot;A String&quot;, # The grammatical tense.
452 &quot;voice&quot;: &quot;A String&quot;, # The grammatical voice.
453 },
454 &quot;text&quot;: { # Represents a text span in the input document. # The token text.
455 &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.
456 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
457 },
458 },
459 ],
460 }</pre>
461 </div>
462
463 <div class="method">
464 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code>
465 <pre>Classifies a document into categories.
466
467 Args:
468 body: object, The request body.
469 The object takes the form of:
470
471 { # The document classification request message.
472 &quot;classificationModelOptions&quot;: { # Model options available for classification requests. # Optional. Model options to use for classification. Defaults to v1 options if not specified.
473 &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.
474 },
475 &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.
476 &quot;contentCategoriesVersion&quot;: &quot;A String&quot;, # The content categories used for classification.
477 },
478 },
479 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
480 &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.
481 &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.
482 &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.
483 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
484 },
485 }
486
487 x__xgafv: string, V1 error format.
488 Allowed values
489 1 - v1 error format
490 2 - v2 error format
491
492 Returns:
493 An object of the form:
494
495 { # The document classification response message.
496 &quot;categories&quot;: [ # Categories representing the input document.
497 { # Represents a category returned from the text classifier.
498 &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.
499 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
500 },
501 ],
502 }</pre>
503 </div>
504
505 <div class="method">
506 <code class="details" id="close">close()</code>
507 <pre>Close httplib2 connections.</pre>
508 </div>
509
510 <div class="method">
511 <code class="details" id="moderateText">moderateText(body=None, x__xgafv=None)</code>
512 <pre>Moderates a document for harmful and sensitive categories.
513
514 Args:
515 body: object, The request body.
516 The object takes the form of:
517
518 { # The document moderation request message.
519 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
520 &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.
521 &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.
522 &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.
523 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
524 },
525 }
526
527 x__xgafv: string, V1 error format.
528 Allowed values
529 1 - v1 error format
530 2 - v2 error format
531
532 Returns:
533 An object of the form:
534
535 { # The document moderation response message.
536 &quot;moderationCategories&quot;: [ # Harmful and sensitive categories representing the input document.
537 { # Represents a category returned from the text classifier.
538 &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.
539 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
540 },
541 ],
542 }</pre>
543 </div>
544
545 </body></html>