Method: documents.annotateText

A convenience method that provides all syntax, sentiment, entity, and classification features in one call.

HTTP request

POST https://language.googleapis.com/v1beta2/documents:annotateText

The URL uses Google API HTTP annotation syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "document": {
    object(Document)
  },
  "features": {
    object(Features)
  },
  "encodingType": enum(EncodingType),
}
Fields
document

object(Document)

Input document.

features

object(Features)

The enabled features.

encodingType

enum(EncodingType)

The encoding type used by the API to calculate offsets.

Response body

If successful, the response body contains data with the following structure:

The text annotations response message.

JSON representation
{
  "sentences": [
    {
      object(Sentence)
    }
  ],
  "tokens": [
    {
      object(Token)
    }
  ],
  "entities": [
    {
      object(Entity)
    }
  ],
  "documentSentiment": {
    object(Sentiment)
  },
  "language": string,
  "categories": [
    {
      object(ClassificationCategory)
    }
  ],
}
Fields
sentences[]

object(Sentence)

Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.

tokens[]

object(Token)

Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.

entities[]

object(Entity)

Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities.

documentSentiment

object(Sentiment)

The overall sentiment for the document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment.

language

string

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.

categories[]

object(ClassificationCategory)

Categories identified in the input document.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-language
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Auth Guide.

Features

All available features for sentiment, syntax, and semantic analysis. Setting each one to true will enable that specific analysis for the input.

JSON representation
{
  "extractSyntax": boolean,
  "extractEntities": boolean,
  "extractDocumentSentiment": boolean,
  "extractEntitySentiment": boolean,
  "classifyText": boolean,
}
Fields
extractSyntax

boolean

Extract syntax information.

extractEntities

boolean

Extract entities.

extractDocumentSentiment

boolean

Extract document-level sentiment.

extractEntitySentiment

boolean

Extract entities and their associated sentiment.

classifyText

boolean

Classify the full document into categories. If this is true, the API will use the default model which classifies into a predefined taxonomy.

このページは役立ちましたか?評価をお願いいたします。

フィードバックを送信...

Cloud Natural Language API
ご不明な点がありましたら、Google のサポートページをご覧ください。