Service Client: Google::Cloud::Language::V1beta2::LanguageService::LanguageServiceClient

Client stub representing the remote LanguageService gRPC service. Delegates call dispatching to Google::gRPC::Client.

target

The endpoint target address. Defaults to language.googleapis.com:443.

credentials

The authentication credentials provider. Defaults to application default credentials via Google::Auth.

NAME

Google::Cloud::Language::V1beta2::LanguageService - Compiled Protocol Buffers messages for google/cloud/language/v1beta2/language_service.proto

SYNOPSIS

use Google::Cloud::Language::V1beta2::LanguageService;

my $msg = Google::Cloud::Language::V1beta2::LanguageService::Document->new({
    type => $type,
    content => $content,
    gcs_content_uri => $gcs_content_uri,
    language => $language,
});

# Read or update a field
my $val = $msg->type();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Language::V1beta2::LanguageService::Document->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/language/v1beta2/language_service.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Language::V1beta2::LanguageService::Document

Represents the input to API methods.

Inherits from Protobuf::Message.

Accessors

  • $msg->type() / $msg->type($value)

    Type: Enum (Google::Cloud::Language::V1beta2::Document::Type)

    Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.

  • $msg->content() / $msg->content($value)

    Type: String

    The content of the input in string format. Cloud audit logging exempt since it is based on user data.

  • $msg->gcs_content_uri() / $msg->gcs_content_uri($value)

    Type: String

    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.

  • $msg->language() / $msg->language($value)

    Type: String

    The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted.<br> [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.

  • $msg->reference_web_uri() / $msg->reference_web_uri($value)

    Type: String

    The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document.

  • $msg->boilerplate_handling() / $msg->boilerplate_handling($value)

    Type: Enum (Google::Cloud::Language::V1beta2::Document::BoilerplateHandling)

    Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content.

Enum: Document::Type

  • TYPE_UNSPECIFIED => 0

  • PLAIN_TEXT => 1

  • HTML => 2

Enum: Document::BoilerplateHandling

  • BOILERPLATE_HANDLING_UNSPECIFIED => 0

  • SKIP_BOILERPLATE => 1

  • KEEP_BOILERPLATE => 2

Google::Cloud::Language::V1beta2::LanguageService::Sentence

Represents a sentence in the input document.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::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.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    The representative name for the entity.

  • $msg->type() / $msg->type($value)

    Type: Enum (Google::Cloud::Language::V1beta2::Entity::Type)

    The entity type.

  • $msg->metadata() / $msg->metadata($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Entity::MetadataEntry)

    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.

  • $msg->salience() / $msg->salience($value)

    Type: Float

    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.

  • $msg->mentions() / $msg->mentions($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::EntityMention)

    The mentions of this entity in the input document. The API currently supports proper noun mentions.

  • $msg->sentiment() / $msg->sentiment($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Sentiment)

    For calls to [AnalyzeEntitySentiment][] or if [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.

Enum: Entity::Type

  • UNKNOWN => 0

  • PERSON => 1

  • LOCATION => 2

  • ORGANIZATION => 3

  • EVENT => 4

  • WORK_OF_ART => 5

  • CONSUMER_GOOD => 6

  • OTHER => 7

  • PHONE_NUMBER => 9

  • ADDRESS => 10

  • DATE => 11

  • NUMBER => 12

  • PRICE => 13

Google::Cloud::Language::V1beta2::LanguageService::Token

Represents the smallest syntactic building block of the text.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::Sentiment

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

Inherits from Protobuf::Message.

Accessors

  • $msg->magnitude() / $msg->magnitude($value)

    Type: Float

    A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

  • $msg->score() / $msg->score($value)

    Type: Float

    Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

Google::Cloud::Language::V1beta2::LanguageService::PartOfSpeech

Represents part of speech information for a token.

Inherits from Protobuf::Message.

Accessors

Enum: PartOfSpeech::Tag

  • UNKNOWN => 0

  • ADJ => 1

  • ADP => 2

  • ADV => 3

  • CONJ => 4

  • DET => 5

  • NOUN => 6

  • NUM => 7

  • PRON => 8

  • PRT => 9

  • PUNCT => 10

  • VERB => 11

  • X => 12

  • AFFIX => 13

Enum: PartOfSpeech::Aspect

  • ASPECT_UNKNOWN => 0

  • PERFECTIVE => 1

  • IMPERFECTIVE => 2

  • PROGRESSIVE => 3

Enum: PartOfSpeech::Case

  • CASE_UNKNOWN => 0

  • ACCUSATIVE => 1

  • ADVERBIAL => 2

  • COMPLEMENTIVE => 3

  • DATIVE => 4

  • GENITIVE => 5

  • INSTRUMENTAL => 6

  • LOCATIVE => 7

  • NOMINATIVE => 8

  • OBLIQUE => 9

  • PARTITIVE => 10

  • PREPOSITIONAL => 11

  • REFLEXIVE_CASE => 12

  • RELATIVE_CASE => 13

  • VOCATIVE => 14

Enum: PartOfSpeech::Form

  • FORM_UNKNOWN => 0

  • ADNOMIAL => 1

  • AUXILIARY => 2

  • COMPLEMENTIZER => 3

  • FINAL_ENDING => 4

  • GERUND => 5

  • REALIS => 6

  • IRREALIS => 7

  • SHORT => 8

  • LONG => 9

  • ORDER => 10

  • SPECIFIC => 11

Enum: PartOfSpeech::Gender

  • GENDER_UNKNOWN => 0

  • FEMININE => 1

  • MASCULINE => 2

  • NEUTER => 3

Enum: PartOfSpeech::Mood

  • MOOD_UNKNOWN => 0

  • CONDITIONAL_MOOD => 1

  • IMPERATIVE => 2

  • INDICATIVE => 3

  • INTERROGATIVE => 4

  • JUSSIVE => 5

  • SUBJUNCTIVE => 6

Enum: PartOfSpeech::Number

  • NUMBER_UNKNOWN => 0

  • SINGULAR => 1

  • PLURAL => 2

  • DUAL => 3

Enum: PartOfSpeech::Person

  • PERSON_UNKNOWN => 0

  • FIRST => 1

  • SECOND => 2

  • THIRD => 3

  • REFLEXIVE_PERSON => 4

Enum: PartOfSpeech::Proper

  • PROPER_UNKNOWN => 0

  • PROPER => 1

  • NOT_PROPER => 2

Enum: PartOfSpeech::Reciprocity

  • RECIPROCITY_UNKNOWN => 0

  • RECIPROCAL => 1

  • NON_RECIPROCAL => 2

Enum: PartOfSpeech::Tense

  • TENSE_UNKNOWN => 0

  • CONDITIONAL_TENSE => 1

  • FUTURE => 2

  • PAST => 3

  • PRESENT => 4

  • IMPERFECT => 5

  • PLUPERFECT => 6

Enum: PartOfSpeech::Voice

  • VOICE_UNKNOWN => 0

  • ACTIVE => 1

  • CAUSATIVE => 2

  • PASSIVE => 3

Google::Cloud::Language::V1beta2::LanguageService::DependencyEdge

Represents dependency parse tree information for a token.

Inherits from Protobuf::Message.

Accessors

  • $msg->head_token_index() / $msg->head_token_index($value)

    Type: Int32

    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.

  • $msg->label() / $msg->label($value)

    Type: Enum (Google::Cloud::Language::V1beta2::DependencyEdge::Label)

    The parse label for the token.

Enum: DependencyEdge::Label

  • UNKNOWN => 0

  • ABBREV => 1

  • ACOMP => 2

  • ADVCL => 3

  • ADVMOD => 4

  • AMOD => 5

  • APPOS => 6

  • ATTR => 7

  • AUX => 8

  • AUXPASS => 9

  • CC => 10

  • CCOMP => 11

  • CONJ => 12

  • CSUBJ => 13

  • CSUBJPASS => 14

  • DEP => 15

  • DET => 16

  • DISCOURSE => 17

  • DOBJ => 18

  • EXPL => 19

  • GOESWITH => 20

  • IOBJ => 21

  • MARK => 22

  • MWE => 23

  • MWV => 24

  • NEG => 25

  • NN => 26

  • NPADVMOD => 27

  • NSUBJ => 28

  • NSUBJPASS => 29

  • NUM => 30

  • NUMBER => 31

  • P => 32

  • PARATAXIS => 33

  • PARTMOD => 34

  • PCOMP => 35

  • POBJ => 36

  • POSS => 37

  • POSTNEG => 38

  • PRECOMP => 39

  • PRECONJ => 40

  • PREDET => 41

  • PREF => 42

  • PREP => 43

  • PRONL => 44

  • PRT => 45

  • PS => 46

  • QUANTMOD => 47

  • RCMOD => 48

  • RCMODREL => 49

  • RDROP => 50

  • REF => 51

  • REMNANT => 52

  • REPARANDUM => 53

  • ROOT => 54

  • SNUM => 55

  • SUFF => 56

  • TMOD => 57

  • TOPIC => 58

  • VMOD => 59

  • VOCATIVE => 60

  • XCOMP => 61

  • SUFFIX => 62

  • TITLE => 63

  • ADVPHMOD => 64

  • AUXCAUS => 65

  • AUXVV => 66

  • DTMOD => 67

  • FOREIGN => 68

  • KW => 69

  • LIST => 70

  • NOMC => 71

  • NOMCSUBJ => 72

  • NOMCSUBJPASS => 73

  • NUMC => 74

  • COP => 75

  • DISLOCATED => 76

  • ASP => 77

  • GMOD => 78

  • GOBJ => 79

  • INFMOD => 80

  • MES => 81

  • NCOMP => 82

Google::Cloud::Language::V1beta2::LanguageService::EntityMention

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

Inherits from Protobuf::Message.

Accessors

Enum: EntityMention::Type

  • TYPE_UNKNOWN => 0

  • PROPER => 1

  • COMMON => 2

Google::Cloud::Language::V1beta2::LanguageService::TextSpan

Represents an output piece of text.

Inherits from Protobuf::Message.

Accessors

  • $msg->content() / $msg->content($value)

    Type: String

    The content of the output text.

  • $msg->begin_offset() / $msg->begin_offset($value)

    Type: Int32

    The API calculates the beginning offset of the content in the original document according to the [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the API request.

Google::Cloud::Language::V1beta2::LanguageService::ClassificationCategory

Represents a category returned from the text classifier.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    The name of the category representing the document.

  • $msg->confidence() / $msg->confidence($value)

    Type: Float

    The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text.

Google::Cloud::Language::V1beta2::LanguageService::ClassificationModelOptions

Model options available for classification requests.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeSentimentRequest

The sentiment analysis request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeSentimentResponse

The sentiment analysis response message.

Inherits from Protobuf::Message.

Accessors

  • $msg->document_sentiment() / $msg->document_sentiment($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Sentiment)

    The overall sentiment of the input document.

  • $msg->language() / $msg->language($value)

    Type: 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][google.cloud.language.v1beta2.Document.language] field for more details.

  • $msg->sentences() / $msg->sentences($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Sentence)

    The sentiment for all the sentences in the document.

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeEntitySentimentRequest

The entity-level sentiment analysis request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeEntitySentimentResponse

The entity-level sentiment analysis response message.

Inherits from Protobuf::Message.

Accessors

  • $msg->entities() / $msg->entities($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Entity)

    The recognized entities in the input document with associated sentiments.

  • $msg->language() / $msg->language($value)

    Type: 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][google.cloud.language.v1beta2.Document.language] field for more details.

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeEntitiesRequest

The entity analysis request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeEntitiesResponse

The entity analysis response message.

Inherits from Protobuf::Message.

Accessors

  • $msg->entities() / $msg->entities($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Entity)

    The recognized entities in the input document.

  • $msg->language() / $msg->language($value)

    Type: 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][google.cloud.language.v1beta2.Document.language] field for more details.

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeSyntaxRequest

The syntax analysis request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::AnalyzeSyntaxResponse

The syntax analysis response message.

Inherits from Protobuf::Message.

Accessors

  • $msg->sentences() / $msg->sentences($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Sentence)

    Sentences in the input document.

  • $msg->tokens() / $msg->tokens($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Token)

    Tokens, along with their syntactic information, in the input document.

  • $msg->language() / $msg->language($value)

    Type: 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][google.cloud.language.v1beta2.Document.language] field for more details.

Google::Cloud::Language::V1beta2::LanguageService::ClassifyTextRequest

The document classification request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::ClassifyTextResponse

The document classification response message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::ModerateTextRequest

The document moderation request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::ModerateTextResponse

The document moderation response message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::AnnotateTextRequest

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

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V1beta2::LanguageService::AnnotateTextResponse

The text annotations response message.

Inherits from Protobuf::Message.

Accessors

  • $msg->sentences() / $msg->sentences($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Sentence)

    Sentences in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax].

  • $msg->tokens() / $msg->tokens($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Token)

    Tokens, along with their syntactic information, in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax].

  • $msg->entities() / $msg->entities($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Entity)

    Entities, along with their semantic information, in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities].

  • $msg->document_sentiment() / $msg->document_sentiment($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::Sentiment)

    The overall sentiment for the document. Populated if the user enables [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment].

  • $msg->language() / $msg->language($value)

    Type: 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][google.cloud.language.v1beta2.Document.language] field for more details.

  • $msg->categories() / $msg->categories($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::ClassificationCategory)

    Categories identified in the input document.

  • $msg->moderation_categories() / $msg->moderation_categories($value)

    Type: Message (Google::Cloud::Language::V1beta2::LanguageService::ClassificationCategory)

    Harmful and sensitive categories identified in the input document.

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Language::V1beta2::LanguageService::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.