Debian Codegraph @

docs/dyn/language_v2.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_v2.html">Cloud Natural Language API</a> . <a href="language_v2.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, probability, mentions for each entity, and other properties.</p>
80 <p class="toc_element">
81 <code><a href="#analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</a></code></p>
82 <p class="firstline">Analyzes the sentiment of the provided text.</p>
83 <p class="toc_element">
84 <code><a href="#annotateText">annotateText(body=None, x__xgafv=None)</a></code></p>
85 <p class="firstline">A convenience method that provides all features in one call.</p>
86 <p class="toc_element">
87 <code><a href="#classifyText">classifyText(body=None, x__xgafv=None)</a></code></p>
88 <p class="firstline">Classifies a document into categories.</p>
89 <p class="toc_element">
90 <code><a href="#close">close()</a></code></p>
91 <p class="firstline">Close httplib2 connections.</p>
92 <p class="toc_element">
93 <code><a href="#moderateText">moderateText(body=None, x__xgafv=None)</a></code></p>
94 <p class="firstline">Moderates a document for harmful and sensitive categories.</p>
95 <h3>Method Details</h3>
96 <div class="method">
97 <code class="details" id="analyzeEntities">analyzeEntities(body=None, x__xgafv=None)</code>
98 <pre>Finds named entities (currently proper names and common nouns) in the text along with entity types, probability, mentions for each entity, and other properties.
99
100 Args:
101 body: object, The request body.
102 The object takes the form of:
103
104 { # The entity analysis request message.
105 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
106 &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.
107 &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.
108 &quot;languageCode&quot;: &quot;A String&quot;, # Optional. 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.
109 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
110 },
111 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
112 }
113
114 x__xgafv: string, V1 error format.
115 Allowed values
116 1 - v1 error format
117 2 - v2 error format
118
119 Returns:
120 An object of the form:
121
122 { # The entity analysis response message.
123 &quot;entities&quot;: [ # The recognized entities in the input document.
124 { # 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 probability and mentions, with entities.
125 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
126 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
127 &quot;probability&quot;: 3.14, # Probability score associated with the entity. The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range.
128 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment this field will contain the sentiment expressed for this mention of the entity in the provided document.
129 &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).
130 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
131 },
132 &quot;text&quot;: { # Represents a text span in the input document. # The mention text.
133 &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.
134 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
135 },
136 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
137 },
138 ],
139 &quot;metadata&quot;: { # Metadata associated with the entity. For the metadata associated with other entity types, see the Type table below.
140 &quot;a_key&quot;: &quot;A String&quot;,
141 },
142 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
143 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment this field will contain the aggregate sentiment expressed for this entity in the provided document.
144 &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).
145 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
146 },
147 &quot;type&quot;: &quot;A String&quot;, # The entity type.
148 },
149 ],
150 &quot;languageCode&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_code field for more details.
151 &quot;languageSupported&quot;: True or False, # Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.
152 }</pre>
153 </div>
154
155 <div class="method">
156 <code class="details" id="analyzeSentiment">analyzeSentiment(body=None, x__xgafv=None)</code>
157 <pre>Analyzes the sentiment of the provided text.
158
159 Args:
160 body: object, The request body.
161 The object takes the form of:
162
163 { # The sentiment analysis request message.
164 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
165 &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.
166 &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.
167 &quot;languageCode&quot;: &quot;A String&quot;, # Optional. 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.
168 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
169 },
170 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate sentence offsets.
171 }
172
173 x__xgafv: string, V1 error format.
174 Allowed values
175 1 - v1 error format
176 2 - v2 error format
177
178 Returns:
179 An object of the form:
180
181 { # The sentiment analysis response message.
182 &quot;documentSentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # The overall sentiment of the input document.
183 &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).
184 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
185 },
186 &quot;languageCode&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_code field for more details.
187 &quot;languageSupported&quot;: True or False, # Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.
188 &quot;sentences&quot;: [ # The sentiment for all the sentences in the document.
189 { # Represents a sentence in the input document.
190 &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.
191 &quot;magnitude&quot;: 3.14, # A non-negative number in the [0, +inf] range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).
192 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
193 },
194 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
195 &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.
196 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
197 },
198 },
199 ],
200 }</pre>
201 </div>
202
203 <div class="method">
204 <code class="details" id="annotateText">annotateText(body=None, x__xgafv=None)</code>
205 <pre>A convenience method that provides all features in one call.
206
207 Args:
208 body: object, The request body.
209 The object takes the form of:
210
211 { # The request message for the text annotation API, which can perform multiple analysis types in one call.
212 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
213 &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.
214 &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.
215 &quot;languageCode&quot;: &quot;A String&quot;, # Optional. 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.
216 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
217 },
218 &quot;encodingType&quot;: &quot;A String&quot;, # The encoding type used by the API to calculate offsets.
219 &quot;features&quot;: { # All available features. Setting each one to true will enable that specific analysis for the input. # Required. The enabled features.
220 &quot;classifyText&quot;: True or False, # Optional. Classify the full document into categories.
221 &quot;extractDocumentSentiment&quot;: True or False, # Optional. Extract document-level sentiment.
222 &quot;extractEntities&quot;: True or False, # Optional. Extract entities.
223 &quot;moderateText&quot;: True or False, # Optional. Moderate the document for harmful and sensitive categories.
224 },
225 }
226
227 x__xgafv: string, V1 error format.
228 Allowed values
229 1 - v1 error format
230 2 - v2 error format
231
232 Returns:
233 An object of the form:
234
235 { # The text annotations response message.
236 &quot;categories&quot;: [ # Categories identified in the input document.
237 { # Represents a category returned from the text classifier.
238 &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.
239 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
240 &quot;severity&quot;: 3.14, # Optional. The classifier&#x27;s severity of the category. This is only present when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and the corresponding category has a severity score.
241 },
242 ],
243 &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.
244 &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).
245 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
246 },
247 &quot;entities&quot;: [ # Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities .
248 { # 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 probability and mentions, with entities.
249 &quot;mentions&quot;: [ # The mentions of this entity in the input document. The API currently supports proper noun mentions.
250 { # Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
251 &quot;probability&quot;: 3.14, # Probability score associated with the entity. The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range.
252 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment this field will contain the sentiment expressed for this mention of the entity in the provided document.
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 mention 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 &quot;type&quot;: &quot;A String&quot;, # The type of the entity mention.
261 },
262 ],
263 &quot;metadata&quot;: { # Metadata associated with the entity. For the metadata associated with other entity types, see the Type table below.
264 &quot;a_key&quot;: &quot;A String&quot;,
265 },
266 &quot;name&quot;: &quot;A String&quot;, # The representative name for the entity.
267 &quot;sentiment&quot;: { # Represents the feeling associated with the entire text or entities in the text. # For calls to AnalyzeEntitySentiment this field will contain the aggregate sentiment expressed for this entity in the provided document.
268 &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).
269 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
270 },
271 &quot;type&quot;: &quot;A String&quot;, # The entity type.
272 },
273 ],
274 &quot;languageCode&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_code field for more details.
275 &quot;languageSupported&quot;: True or False, # Whether the language is officially supported by all requested features. The API may still return a response when the language is not supported, but it is on a best effort basis.
276 &quot;moderationCategories&quot;: [ # Harmful and sensitive categories identified in the input document.
277 { # Represents a category returned from the text classifier.
278 &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.
279 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
280 &quot;severity&quot;: 3.14, # Optional. The classifier&#x27;s severity of the category. This is only present when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and the corresponding category has a severity score.
281 },
282 ],
283 &quot;sentences&quot;: [ # Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment.
284 { # Represents a sentence in the input document.
285 &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.
286 &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).
287 &quot;score&quot;: 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
288 },
289 &quot;text&quot;: { # Represents a text span in the input document. # The sentence text.
290 &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.
291 &quot;content&quot;: &quot;A String&quot;, # The content of the text span, which is a substring of the document.
292 },
293 },
294 ],
295 }</pre>
296 </div>
297
298 <div class="method">
299 <code class="details" id="classifyText">classifyText(body=None, x__xgafv=None)</code>
300 <pre>Classifies a document into categories.
301
302 Args:
303 body: object, The request body.
304 The object takes the form of:
305
306 { # The document classification request message.
307 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
308 &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.
309 &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.
310 &quot;languageCode&quot;: &quot;A String&quot;, # Optional. 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.
311 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
312 },
313 }
314
315 x__xgafv: string, V1 error format.
316 Allowed values
317 1 - v1 error format
318 2 - v2 error format
319
320 Returns:
321 An object of the form:
322
323 { # The document classification response message.
324 &quot;categories&quot;: [ # Categories representing the input document.
325 { # Represents a category returned from the text classifier.
326 &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.
327 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
328 &quot;severity&quot;: 3.14, # Optional. The classifier&#x27;s severity of the category. This is only present when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and the corresponding category has a severity score.
329 },
330 ],
331 &quot;languageCode&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_code field for more details.
332 &quot;languageSupported&quot;: True or False, # Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.
333 }</pre>
334 </div>
335
336 <div class="method">
337 <code class="details" id="close">close()</code>
338 <pre>Close httplib2 connections.</pre>
339 </div>
340
341 <div class="method">
342 <code class="details" id="moderateText">moderateText(body=None, x__xgafv=None)</code>
343 <pre>Moderates a document for harmful and sensitive categories.
344
345 Args:
346 body: object, The request body.
347 The object takes the form of:
348
349 { # The document moderation request message.
350 &quot;document&quot;: { # Represents the input to API methods. # Required. Input document.
351 &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.
352 &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.
353 &quot;languageCode&quot;: &quot;A String&quot;, # Optional. 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.
354 &quot;type&quot;: &quot;A String&quot;, # Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
355 },
356 &quot;modelVersion&quot;: &quot;A String&quot;, # Optional. The model version to use for ModerateText.
357 }
358
359 x__xgafv: string, V1 error format.
360 Allowed values
361 1 - v1 error format
362 2 - v2 error format
363
364 Returns:
365 An object of the form:
366
367 { # The document moderation response message.
368 &quot;languageCode&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_code field for more details.
369 &quot;languageSupported&quot;: True or False, # Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.
370 &quot;moderationCategories&quot;: [ # Harmful and sensitive categories representing the input document.
371 { # Represents a category returned from the text classifier.
372 &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.
373 &quot;name&quot;: &quot;A String&quot;, # The name of the category representing the document.
374 &quot;severity&quot;: 3.14, # Optional. The classifier&#x27;s severity of the category. This is only present when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and the corresponding category has a severity score.
375 },
376 ],
377 }</pre>
378 </div>
379
380 </body></html>