Package com.google.cloud.language.v1beta2 (2.1.10)

The interfaces provided are listed below, along with usage samples.

LanguageServiceClient

Service Description: Provides text analysis operations such as sentiment analysis and entity recognition.

Sample for LanguageServiceClient:


 try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
   Document document = Document.newBuilder().build();
   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
 }
 

Classes

AnalyzeEntitiesRequest

The entity analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitiesRequest

AnalyzeEntitiesRequest.Builder

The entity analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitiesRequest

AnalyzeEntitiesResponse

The entity analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitiesResponse

AnalyzeEntitiesResponse.Builder

The entity analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitiesResponse

AnalyzeEntitySentimentRequest

The entity-level sentiment analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest

AnalyzeEntitySentimentRequest.Builder

The entity-level sentiment analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest

AnalyzeEntitySentimentResponse

The entity-level sentiment analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse

AnalyzeEntitySentimentResponse.Builder

The entity-level sentiment analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse

AnalyzeSentimentRequest

The sentiment analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSentimentRequest

AnalyzeSentimentRequest.Builder

The sentiment analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSentimentRequest

AnalyzeSentimentResponse

The sentiment analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSentimentResponse

AnalyzeSentimentResponse.Builder

The sentiment analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSentimentResponse

AnalyzeSyntaxRequest

The syntax analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSyntaxRequest

AnalyzeSyntaxRequest.Builder

The syntax analysis request message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSyntaxRequest

AnalyzeSyntaxResponse

The syntax analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSyntaxResponse

AnalyzeSyntaxResponse.Builder

The syntax analysis response message.

Protobuf type google.cloud.language.v1beta2.AnalyzeSyntaxResponse

AnnotateTextRequest

The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call.

Protobuf type google.cloud.language.v1beta2.AnnotateTextRequest

AnnotateTextRequest.Builder

The request message for the text annotation API, which can perform multiple analysis types (sentiment, entities, and syntax) in one call.

Protobuf type google.cloud.language.v1beta2.AnnotateTextRequest

AnnotateTextRequest.Features

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

Protobuf type google.cloud.language.v1beta2.AnnotateTextRequest.Features

AnnotateTextRequest.Features.Builder

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

Protobuf type google.cloud.language.v1beta2.AnnotateTextRequest.Features

AnnotateTextResponse

The text annotations response message.

Protobuf type google.cloud.language.v1beta2.AnnotateTextResponse

AnnotateTextResponse.Builder

The text annotations response message.

Protobuf type google.cloud.language.v1beta2.AnnotateTextResponse

ClassificationCategory

Represents a category returned from the text classifier.

Protobuf type google.cloud.language.v1beta2.ClassificationCategory

ClassificationCategory.Builder

Represents a category returned from the text classifier.

Protobuf type google.cloud.language.v1beta2.ClassificationCategory

ClassifyTextRequest

The document classification request message.

Protobuf type google.cloud.language.v1beta2.ClassifyTextRequest

ClassifyTextRequest.Builder

The document classification request message.

Protobuf type google.cloud.language.v1beta2.ClassifyTextRequest

ClassifyTextResponse

The document classification response message.

Protobuf type google.cloud.language.v1beta2.ClassifyTextResponse

ClassifyTextResponse.Builder

The document classification response message.

Protobuf type google.cloud.language.v1beta2.ClassifyTextResponse

DependencyEdge

Represents dependency parse tree information for a token.

Protobuf type google.cloud.language.v1beta2.DependencyEdge

DependencyEdge.Builder

Represents dependency parse tree information for a token.

Protobuf type google.cloud.language.v1beta2.DependencyEdge

Document

Represents the input to API methods.

Protobuf type google.cloud.language.v1beta2.Document

Document.Builder

Represents the input to API methods.

Protobuf type google.cloud.language.v1beta2.Document

Entity

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.

Protobuf type google.cloud.language.v1beta2.Entity

Entity.Builder

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.

Protobuf type google.cloud.language.v1beta2.Entity

EntityMention

Represents a mention for an entity in the text. Currently, proper noun mentions are supported.

Protobuf type google.cloud.language.v1beta2.EntityMention

EntityMention.Builder

Represents a mention for an entity in the text. Currently, proper noun mentions are supported.

Protobuf type google.cloud.language.v1beta2.EntityMention

LanguageServiceClient

Service Description: Provides text analysis operations such as sentiment analysis and entity recognition.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
   Document document = Document.newBuilder().build();
   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
 }
 

Note: close() needs to be called on the LanguageServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of LanguageServiceSettings to create(). For example:

To customize credentials:


 LanguageServiceSettings languageServiceSettings =
     LanguageServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 LanguageServiceClient languageServiceClient =
     LanguageServiceClient.create(languageServiceSettings);
 

To customize the endpoint:


 LanguageServiceSettings languageServiceSettings =
     LanguageServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 LanguageServiceClient languageServiceClient =
     LanguageServiceClient.create(languageServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

LanguageServiceGrpc

Provides text analysis operations such as sentiment analysis and entity recognition.

LanguageServiceGrpc.LanguageServiceBlockingStub

Provides text analysis operations such as sentiment analysis and entity recognition.

LanguageServiceGrpc.LanguageServiceFutureStub

Provides text analysis operations such as sentiment analysis and entity recognition.

LanguageServiceGrpc.LanguageServiceImplBase

Provides text analysis operations such as sentiment analysis and entity recognition.

LanguageServiceGrpc.LanguageServiceStub

Provides text analysis operations such as sentiment analysis and entity recognition.

LanguageServiceProto

LanguageServiceSettings

Settings class to configure an instance of LanguageServiceClient.

The default instance has everything set to sensible defaults:

  • The default service address (language.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of analyzeSentiment to 30 seconds:


 LanguageServiceSettings.Builder languageServiceSettingsBuilder =
     LanguageServiceSettings.newBuilder();
 languageServiceSettingsBuilder
     .analyzeSentimentSettings()
     .setRetrySettings(
         languageServiceSettingsBuilder
             .analyzeSentimentSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 LanguageServiceSettings languageServiceSettings = languageServiceSettingsBuilder.build();
 

LanguageServiceSettings.Builder

Builder for LanguageServiceSettings.

PartOfSpeech

Represents part of speech information for a token.

Protobuf type google.cloud.language.v1beta2.PartOfSpeech

PartOfSpeech.Builder

Represents part of speech information for a token.

Protobuf type google.cloud.language.v1beta2.PartOfSpeech

Sentence

Represents a sentence in the input document.

Protobuf type google.cloud.language.v1beta2.Sentence

Sentence.Builder

Represents a sentence in the input document.

Protobuf type google.cloud.language.v1beta2.Sentence

Sentiment

Represents the feeling associated with the entire text or entities in the text. Next ID: 6

Protobuf type google.cloud.language.v1beta2.Sentiment

Sentiment.Builder

Represents the feeling associated with the entire text or entities in the text. Next ID: 6

Protobuf type google.cloud.language.v1beta2.Sentiment

TextSpan

Represents an output piece of text.

Protobuf type google.cloud.language.v1beta2.TextSpan

TextSpan.Builder

Represents an output piece of text.

Protobuf type google.cloud.language.v1beta2.TextSpan

Token

Represents the smallest syntactic building block of the text.

Protobuf type google.cloud.language.v1beta2.Token

Token.Builder

Represents the smallest syntactic building block of the text.

Protobuf type google.cloud.language.v1beta2.Token

Interfaces

AnalyzeEntitiesRequestOrBuilder

AnalyzeEntitiesResponseOrBuilder

AnalyzeEntitySentimentRequestOrBuilder

AnalyzeEntitySentimentResponseOrBuilder

AnalyzeSentimentRequestOrBuilder

AnalyzeSentimentResponseOrBuilder

AnalyzeSyntaxRequestOrBuilder

AnalyzeSyntaxResponseOrBuilder

AnnotateTextRequest.FeaturesOrBuilder

AnnotateTextRequestOrBuilder

AnnotateTextResponseOrBuilder

ClassificationCategoryOrBuilder

ClassifyTextRequestOrBuilder

ClassifyTextResponseOrBuilder

DependencyEdgeOrBuilder

DocumentOrBuilder

EntityMentionOrBuilder

EntityOrBuilder

PartOfSpeechOrBuilder

SentenceOrBuilder

SentimentOrBuilder

TextSpanOrBuilder

TokenOrBuilder

Enums

DependencyEdge.Label

The parse label enum for the token.

Protobuf enum google.cloud.language.v1beta2.DependencyEdge.Label

Document.SourceCase

Document.Type

The document types enum.

Protobuf enum google.cloud.language.v1beta2.Document.Type

EncodingType

Represents the text encoding that the caller uses to process the output. Providing an EncodingType is recommended because the API provides the beginning offsets for various outputs, such as tokens and mentions, and languages that natively use different text encodings may access offsets differently.

Protobuf enum google.cloud.language.v1beta2.EncodingType

Entity.Type

The type of the entity. For most entity types, the associated metadata is a Wikipedia URL (wikipedia_url) and Knowledge Graph MID (mid). The table below lists the associated fields for entities that have different metadata.

Protobuf enum google.cloud.language.v1beta2.Entity.Type

EntityMention.Type

The supported types of mentions.

Protobuf enum google.cloud.language.v1beta2.EntityMention.Type

PartOfSpeech.Aspect

The characteristic of a verb that expresses time flow during an event.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Aspect

PartOfSpeech.Case

The grammatical function performed by a noun or pronoun in a phrase, clause, or sentence. In some languages, other parts of speech, such as adjective and determiner, take case inflection in agreement with the noun.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Case

PartOfSpeech.Form

Depending on the language, Form can be categorizing different forms of verbs, adjectives, adverbs, etc. For example, categorizing inflected endings of verbs and adjectives or distinguishing between short and long forms of adjectives and participles

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Form

PartOfSpeech.Gender

Gender classes of nouns reflected in the behaviour of associated words.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Gender

PartOfSpeech.Mood

The grammatical feature of verbs, used for showing modality and attitude.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Mood

PartOfSpeech.Number

Count distinctions.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Number

PartOfSpeech.Person

The distinction between the speaker, second person, third person, etc.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Person

PartOfSpeech.Proper

This category shows if the token is part of a proper name.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Proper

PartOfSpeech.Reciprocity

Reciprocal features of a pronoun.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Reciprocity

PartOfSpeech.Tag

The part of speech tags enum.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Tag

PartOfSpeech.Tense

Time reference.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Tense

PartOfSpeech.Voice

The relationship between the action that a verb expresses and the participants identified by its arguments.

Protobuf enum google.cloud.language.v1beta2.PartOfSpeech.Voice