blob: 3e0e122c58357d83d8ef1094910f620b40427dad [file] [log] [blame]
Jon Wayne Parrott692617a2017-01-06 09:58:29 -08001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="language_v1.html">Google 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, x__xgafv=None)</a></code></p>
79<p class="firstline">Finds named entities (currently finds proper names) in the text,</p>
80<p class="toc_element">
81 <code><a href="#analyzeSentiment">analyzeSentiment(body, 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="#analyzeSyntax">analyzeSyntax(body, x__xgafv=None)</a></code></p>
85<p class="firstline">Analyzes the syntax of the text and provides sentence boundaries and</p>
86<p class="toc_element">
87 <code><a href="#annotateText">annotateText(body, x__xgafv=None)</a></code></p>
88<p class="firstline">A convenience method that provides all the features that analyzeSentiment,</p>
89<h3>Method Details</h3>
90<div class="method">
91 <code class="details" id="analyzeEntities">analyzeEntities(body, x__xgafv=None)</code>
92 <pre>Finds named entities (currently finds proper names) in the text,
93entity types, salience, mentions for each entity, and other properties.
94
95Args:
96 body: object, The request body. (required)
97 The object takes the form of:
98
99{ # The entity analysis request message.
100 "document": { # ################################################################ # # Input document.
101 #
102 # Represents the input to API methods.
103 "content": "A String", # The content of the input in string format.
104 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
105 # returns an `INVALID_ARGUMENT` error.
106 "language": "A String", # The language of the document (if not specified, the language is
107 # automatically detected). Both ISO and BCP-47 language codes are
108 # accepted.<br>
109 # **Current Language Restrictions:**
110 #
111 # * Only English, Spanish, and Japanese textual content are supported.
112 # If the language (either specified by the caller or automatically detected)
113 # is not supported by the called API method, an `INVALID_ARGUMENT` error
114 # is returned.
115 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
116 # This URI must be of the form: gs://bucket_name/object_name. For more
117 # details, see https://cloud.google.com/storage/docs/reference-uris.
118 # NOTE: Cloud Storage object versioning is not supported.
119 },
120 "encodingType": "A String", # The encoding type used by the API to calculate offsets.
121 }
122
123 x__xgafv: string, V1 error format.
124 Allowed values
125 1 - v1 error format
126 2 - v2 error format
127
128Returns:
129 An object of the form:
130
131 { # The entity analysis response message.
132 "entities": [ # The recognized entities in the input document.
133 { # Represents a phrase in the text that is a known entity, such as
134 # a person, an organization, or location. The API associates information, such
135 # as salience and mentions, with entities.
136 "type": "A String", # The entity type.
137 "mentions": [ # The mentions of this entity in the input document. The API currently
138 # supports proper noun mentions.
139 { # Represents a mention for an entity in the text. Currently, proper noun
140 # mentions are supported.
141 "text": { # Represents an output piece of text. # The mention text.
142 "content": "A String", # The content of the output text.
143 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
144 # document according to the EncodingType specified in the API request.
145 },
146 "type": "A String", # The type of the entity mention.
147 },
148 ],
149 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range.
150 #
151 # The salience score for an entity provides information about the
152 # importance or centrality of that entity to the entire document text.
153 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
154 # salient.
155 "name": "A String", # The representative name for the entity.
156 "metadata": { # Metadata associated with the entity.
157 #
158 # Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
159 # available. The associated keys are "wikipedia_url" and "mid", respectively.
160 "a_key": "A String",
161 },
162 },
163 ],
164 "language": "A String", # The language of the text, which will be the same as the language specified
165 # in the request or, if not specified, the automatically-detected language.
166 # See `Document.language` field for more details.
167 }</pre>
168</div>
169
170<div class="method">
171 <code class="details" id="analyzeSentiment">analyzeSentiment(body, x__xgafv=None)</code>
172 <pre>Analyzes the sentiment of the provided text.
173
174Args:
175 body: object, The request body. (required)
176 The object takes the form of:
177
178{ # The sentiment analysis request message.
179 "document": { # ################################################################ # # Input document. Currently, `analyzeSentiment` only supports English text
180 # (Document.language="EN").
181 #
182 # Represents the input to API methods.
183 "content": "A String", # The content of the input in string format.
184 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
185 # returns an `INVALID_ARGUMENT` error.
186 "language": "A String", # The language of the document (if not specified, the language is
187 # automatically detected). Both ISO and BCP-47 language codes are
188 # accepted.<br>
189 # **Current Language Restrictions:**
190 #
191 # * Only English, Spanish, and Japanese textual content are supported.
192 # If the language (either specified by the caller or automatically detected)
193 # is not supported by the called API method, an `INVALID_ARGUMENT` error
194 # is returned.
195 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
196 # This URI must be of the form: gs://bucket_name/object_name. For more
197 # details, see https://cloud.google.com/storage/docs/reference-uris.
198 # NOTE: Cloud Storage object versioning is not supported.
199 },
200 "encodingType": "A String", # The encoding type used by the API to calculate sentence offsets.
201 }
202
203 x__xgafv: string, V1 error format.
204 Allowed values
205 1 - v1 error format
206 2 - v2 error format
207
208Returns:
209 An object of the form:
210
211 { # The sentiment analysis response message.
212 "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment of the input document.
213 # the text.
214 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
215 # (positive sentiment).
216 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
217 # the absolute magnitude of sentiment regardless of score (positive or
218 # negative).
219 },
220 "language": "A String", # The language of the text, which will be the same as the language specified
221 # in the request or, if not specified, the automatically-detected language.
222 # See `Document.language` field for more details.
223 "sentences": [ # The sentiment for all the sentences in the document.
224 { # Represents a sentence in the input document.
225 "text": { # Represents an output piece of text. # The sentence text.
226 "content": "A String", # The content of the output text.
227 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
228 # document according to the EncodingType specified in the API request.
229 },
230 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
231 # AnnotateTextRequest.Features.extract_document_sentiment is set to
232 # true, this field will contain the sentiment for the sentence.
233 # the text.
234 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
235 # (positive sentiment).
236 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
237 # the absolute magnitude of sentiment regardless of score (positive or
238 # negative).
239 },
240 },
241 ],
242 }</pre>
243</div>
244
245<div class="method">
246 <code class="details" id="analyzeSyntax">analyzeSyntax(body, x__xgafv=None)</code>
247 <pre>Analyzes the syntax of the text and provides sentence boundaries and
248tokenization along with part of speech tags, dependency trees, and other
249properties.
250
251Args:
252 body: object, The request body. (required)
253 The object takes the form of:
254
255{ # The syntax analysis request message.
256 "document": { # ################################################################ # # Input document.
257 #
258 # Represents the input to API methods.
259 "content": "A String", # The content of the input in string format.
260 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
261 # returns an `INVALID_ARGUMENT` error.
262 "language": "A String", # The language of the document (if not specified, the language is
263 # automatically detected). Both ISO and BCP-47 language codes are
264 # accepted.<br>
265 # **Current Language Restrictions:**
266 #
267 # * Only English, Spanish, and Japanese textual content are supported.
268 # If the language (either specified by the caller or automatically detected)
269 # is not supported by the called API method, an `INVALID_ARGUMENT` error
270 # is returned.
271 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
272 # This URI must be of the form: gs://bucket_name/object_name. For more
273 # details, see https://cloud.google.com/storage/docs/reference-uris.
274 # NOTE: Cloud Storage object versioning is not supported.
275 },
276 "encodingType": "A String", # The encoding type used by the API to calculate offsets.
277 }
278
279 x__xgafv: string, V1 error format.
280 Allowed values
281 1 - v1 error format
282 2 - v2 error format
283
284Returns:
285 An object of the form:
286
287 { # The syntax analysis response message.
288 "tokens": [ # Tokens, along with their syntactic information, in the input document.
289 { # Represents the smallest syntactic building block of the text.
290 "text": { # Represents an output piece of text. # The token text.
291 "content": "A String", # The content of the output text.
292 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
293 # document according to the EncodingType specified in the API request.
294 },
295 "dependencyEdge": { # Represents dependency parse tree information for a token. (For more # Dependency tree parse for this token.
296 # information on dependency labels, see
297 # http://www.aclweb.org/anthology/P13-2017
298 "headTokenIndex": 42, # Represents the head of this token in the dependency tree.
299 # This is the index of the token which has an arc going to this token.
300 # The index is the position of the token in the array of tokens returned
301 # by the API method. If this token is a root token, then the
302 # `head_token_index` is its own index.
303 "label": "A String", # The parse label for the token.
304 },
305 "partOfSpeech": { # Represents part of speech information for a token. Parts of speech # Parts of speech tag for this token.
306 # are as defined in
307 # http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf
308 "case": "A String", # The grammatical case.
309 "reciprocity": "A String", # The grammatical reciprocity.
310 "mood": "A String", # The grammatical mood.
311 "form": "A String", # The grammatical form.
312 "gender": "A String", # The grammatical gender.
313 "number": "A String", # The grammatical number.
314 "person": "A String", # The grammatical person.
315 "tag": "A String", # The part of speech tag.
316 "tense": "A String", # The grammatical tense.
317 "aspect": "A String", # The grammatical aspect.
318 "proper": "A String", # The grammatical properness.
319 "voice": "A String", # The grammatical voice.
320 },
321 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
322 },
323 ],
324 "language": "A String", # The language of the text, which will be the same as the language specified
325 # in the request or, if not specified, the automatically-detected language.
326 # See `Document.language` field for more details.
327 "sentences": [ # Sentences in the input document.
328 { # Represents a sentence in the input document.
329 "text": { # Represents an output piece of text. # The sentence text.
330 "content": "A String", # The content of the output text.
331 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
332 # document according to the EncodingType specified in the API request.
333 },
334 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
335 # AnnotateTextRequest.Features.extract_document_sentiment is set to
336 # true, this field will contain the sentiment for the sentence.
337 # the text.
338 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
339 # (positive sentiment).
340 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
341 # the absolute magnitude of sentiment regardless of score (positive or
342 # negative).
343 },
344 },
345 ],
346 }</pre>
347</div>
348
349<div class="method">
350 <code class="details" id="annotateText">annotateText(body, x__xgafv=None)</code>
351 <pre>A convenience method that provides all the features that analyzeSentiment,
352analyzeEntities, and analyzeSyntax provide in one call.
353
354Args:
355 body: object, The request body. (required)
356 The object takes the form of:
357
358{ # The request message for the text annotation API, which can perform multiple
359 # analysis types (sentiment, entities, and syntax) in one call.
360 "document": { # ################################################################ # # Input document.
361 #
362 # Represents the input to API methods.
363 "content": "A String", # The content of the input in string format.
364 "type": "A String", # Required. If the type is not set or is `TYPE_UNSPECIFIED`,
365 # returns an `INVALID_ARGUMENT` error.
366 "language": "A String", # The language of the document (if not specified, the language is
367 # automatically detected). Both ISO and BCP-47 language codes are
368 # accepted.<br>
369 # **Current Language Restrictions:**
370 #
371 # * Only English, Spanish, and Japanese textual content are supported.
372 # If the language (either specified by the caller or automatically detected)
373 # is not supported by the called API method, an `INVALID_ARGUMENT` error
374 # is returned.
375 "gcsContentUri": "A String", # The Google Cloud Storage URI where the file content is located.
376 # This URI must be of the form: gs://bucket_name/object_name. For more
377 # details, see https://cloud.google.com/storage/docs/reference-uris.
378 # NOTE: Cloud Storage object versioning is not supported.
379 },
380 "encodingType": "A String", # The encoding type used by the API to calculate offsets.
381 "features": { # All available features for sentiment, syntax, and semantic analysis. # The enabled features.
382 # Setting each one to true will enable that specific analysis for the input.
383 "extractSyntax": True or False, # Extract syntax information.
384 "extractEntities": True or False, # Extract entities.
385 "extractDocumentSentiment": True or False, # Extract document-level sentiment.
386 },
387 }
388
389 x__xgafv: string, V1 error format.
390 Allowed values
391 1 - v1 error format
392 2 - v2 error format
393
394Returns:
395 An object of the form:
396
397 { # The text annotations response message.
398 "tokens": [ # Tokens, along with their syntactic information, in the input document.
399 # Populated if the user enables
400 # AnnotateTextRequest.Features.extract_syntax.
401 { # Represents the smallest syntactic building block of the text.
402 "text": { # Represents an output piece of text. # The token text.
403 "content": "A String", # The content of the output text.
404 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
405 # document according to the EncodingType specified in the API request.
406 },
407 "dependencyEdge": { # Represents dependency parse tree information for a token. (For more # Dependency tree parse for this token.
408 # information on dependency labels, see
409 # http://www.aclweb.org/anthology/P13-2017
410 "headTokenIndex": 42, # Represents the head of this token in the dependency tree.
411 # This is the index of the token which has an arc going to this token.
412 # The index is the position of the token in the array of tokens returned
413 # by the API method. If this token is a root token, then the
414 # `head_token_index` is its own index.
415 "label": "A String", # The parse label for the token.
416 },
417 "partOfSpeech": { # Represents part of speech information for a token. Parts of speech # Parts of speech tag for this token.
418 # are as defined in
419 # http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf
420 "case": "A String", # The grammatical case.
421 "reciprocity": "A String", # The grammatical reciprocity.
422 "mood": "A String", # The grammatical mood.
423 "form": "A String", # The grammatical form.
424 "gender": "A String", # The grammatical gender.
425 "number": "A String", # The grammatical number.
426 "person": "A String", # The grammatical person.
427 "tag": "A String", # The part of speech tag.
428 "tense": "A String", # The grammatical tense.
429 "aspect": "A String", # The grammatical aspect.
430 "proper": "A String", # The grammatical properness.
431 "voice": "A String", # The grammatical voice.
432 },
433 "lemma": "A String", # [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
434 },
435 ],
436 "entities": [ # Entities, along with their semantic information, in the input document.
437 # Populated if the user enables
438 # AnnotateTextRequest.Features.extract_entities.
439 { # Represents a phrase in the text that is a known entity, such as
440 # a person, an organization, or location. The API associates information, such
441 # as salience and mentions, with entities.
442 "type": "A String", # The entity type.
443 "mentions": [ # The mentions of this entity in the input document. The API currently
444 # supports proper noun mentions.
445 { # Represents a mention for an entity in the text. Currently, proper noun
446 # mentions are supported.
447 "text": { # Represents an output piece of text. # The mention text.
448 "content": "A String", # The content of the output text.
449 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
450 # document according to the EncodingType specified in the API request.
451 },
452 "type": "A String", # The type of the entity mention.
453 },
454 ],
455 "salience": 3.14, # The salience score associated with the entity in the [0, 1.0] range.
456 #
457 # The salience score for an entity provides information about the
458 # importance or centrality of that entity to the entire document text.
459 # Scores closer to 0 are less salient, while scores closer to 1.0 are highly
460 # salient.
461 "name": "A String", # The representative name for the entity.
462 "metadata": { # Metadata associated with the entity.
463 #
464 # Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
465 # available. The associated keys are "wikipedia_url" and "mid", respectively.
466 "a_key": "A String",
467 },
468 },
469 ],
470 "documentSentiment": { # Represents the feeling associated with the entire text or entities in # The overall sentiment for the document. Populated if the user enables
471 # AnnotateTextRequest.Features.extract_document_sentiment.
472 # the text.
473 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
474 # (positive sentiment).
475 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
476 # the absolute magnitude of sentiment regardless of score (positive or
477 # negative).
478 },
479 "language": "A String", # The language of the text, which will be the same as the language specified
480 # in the request or, if not specified, the automatically-detected language.
481 # See `Document.language` field for more details.
482 "sentences": [ # Sentences in the input document. Populated if the user enables
483 # AnnotateTextRequest.Features.extract_syntax.
484 { # Represents a sentence in the input document.
485 "text": { # Represents an output piece of text. # The sentence text.
486 "content": "A String", # The content of the output text.
487 "beginOffset": 42, # The API calculates the beginning offset of the content in the original
488 # document according to the EncodingType specified in the API request.
489 },
490 "sentiment": { # Represents the feeling associated with the entire text or entities in # For calls to AnalyzeSentiment or if
491 # AnnotateTextRequest.Features.extract_document_sentiment is set to
492 # true, this field will contain the sentiment for the sentence.
493 # the text.
494 "score": 3.14, # Sentiment score between -1.0 (negative sentiment) and 1.0
495 # (positive sentiment).
496 "magnitude": 3.14, # A non-negative number in the [0, +inf) range, which represents
497 # the absolute magnitude of sentiment regardless of score (positive or
498 # negative).
499 },
500 },
501 ],
502 }</pre>
503</div>
504
505</body></html>