Service Client: Google::Cloud::Language::V1beta1::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::V1beta1::LanguageService - Compiled Protocol Buffers messages for google/cloud/language/v1beta1/language_service.proto
SYNOPSIS
use Google::Cloud::Language::V1beta1::LanguageService;
my $msg = Google::Cloud::Language::V1beta1::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::V1beta1::LanguageService::Document->parse($bytes);
# Canonical ProtoJSON
my $json = $msg->to_json();
DESCRIPTION
Auto-generated Protobuf message classes compiled from google/cloud/language/v1beta1/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::V1beta1::LanguageService::Document
Represents the input to API methods.
Inherits from Protobuf::Message.
Accessors
$msg->type()/$msg->type($value)Type:
Enum(Google::Cloud::Language::V1beta1::Document::Type)Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
$msg->content()/$msg->content($value)Type:
StringThe content of the input in string format.
$msg->gcs_content_uri()/$msg->gcs_content_uri($value)Type:
StringThe 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:
StringThe 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.
Enum: Document::Type
TYPE_UNSPECIFIED=>0PLAIN_TEXT=>1HTML=>2
Google::Cloud::Language::V1beta1::LanguageService::Sentence
Represents a sentence in the input document.
Inherits from Protobuf::Message.
Accessors
$msg->text()/$msg->text($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::TextSpan)The sentence text.
$msg->sentiment()/$msg->sentiment($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Sentiment)For calls to [AnalyzeSentiment][] or if [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_document_sentiment] is set to true, this field will contain the sentiment for the sentence.
Google::Cloud::Language::V1beta1::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:
StringThe representative name for the entity.
$msg->type()/$msg->type($value)Type:
Enum(Google::Cloud::Language::V1beta1::Entity::Type)The entity type.
$msg->metadata()/$msg->metadata($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Entity::MetadataEntry)Metadata associated with the entity.
Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if available. The associated keys are "wikipedia_url" and "mid", respectively.
$msg->salience()/$msg->salience($value)Type:
FloatThe 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::V1beta1::LanguageService::EntityMention)The mentions of this entity in the input document. The API currently supports proper noun mentions.
Enum: Entity::Type
UNKNOWN=>0PERSON=>1LOCATION=>2ORGANIZATION=>3EVENT=>4WORK_OF_ART=>5CONSUMER_GOOD=>6OTHER=>7
Google::Cloud::Language::V1beta1::LanguageService::Token
Represents the smallest syntactic building block of the text.
Inherits from Protobuf::Message.
Accessors
$msg->text()/$msg->text($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::TextSpan)The token text.
$msg->part_of_speech()/$msg->part_of_speech($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::PartOfSpeech)Parts of speech tag for this token.
$msg->dependency_edge()/$msg->dependency_edge($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::DependencyEdge)Dependency tree parse for this token.
$msg->lemma()/$msg->lemma($value)Type:
String[Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
Google::Cloud::Language::V1beta1::LanguageService::Sentiment
Represents the feeling associated with the entire text or entities in the text.
Inherits from Protobuf::Message.
Accessors
$msg->polarity()/$msg->polarity($value)Type:
FloatDEPRECATED FIELD - This field is being deprecated in favor of score. Please refer to our documentation at https://cloud.google.com/natural-language/docs for more information.
$msg->magnitude()/$msg->magnitude($value)Type:
FloatA 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:
FloatSentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).
Google::Cloud::Language::V1beta1::LanguageService::PartOfSpeech
Represents part of speech information for a token.
Inherits from Protobuf::Message.
Accessors
$msg->tag()/$msg->tag($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Tag)The part of speech tag.
$msg->aspect()/$msg->aspect($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Aspect)The grammatical aspect.
$msg->case()/$msg->case($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Case)The grammatical case.
$msg->form()/$msg->form($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Form)The grammatical form.
$msg->gender()/$msg->gender($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Gender)The grammatical gender.
$msg->mood()/$msg->mood($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Mood)The grammatical mood.
$msg->number()/$msg->number($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Number)The grammatical number.
$msg->person()/$msg->person($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Person)The grammatical person.
$msg->proper()/$msg->proper($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Proper)The grammatical properness.
$msg->reciprocity()/$msg->reciprocity($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Reciprocity)The grammatical reciprocity.
$msg->tense()/$msg->tense($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Tense)The grammatical tense.
$msg->voice()/$msg->voice($value)Type:
Enum(Google::Cloud::Language::V1beta1::PartOfSpeech::Voice)The grammatical voice.
Enum: PartOfSpeech::Tag
UNKNOWN=>0ADJ=>1ADP=>2ADV=>3CONJ=>4DET=>5NOUN=>6NUM=>7PRON=>8PRT=>9PUNCT=>10VERB=>11X=>12AFFIX=>13
Enum: PartOfSpeech::Aspect
ASPECT_UNKNOWN=>0PERFECTIVE=>1IMPERFECTIVE=>2PROGRESSIVE=>3
Enum: PartOfSpeech::Case
CASE_UNKNOWN=>0ACCUSATIVE=>1ADVERBIAL=>2COMPLEMENTIVE=>3DATIVE=>4GENITIVE=>5INSTRUMENTAL=>6LOCATIVE=>7NOMINATIVE=>8OBLIQUE=>9PARTITIVE=>10PREPOSITIONAL=>11REFLEXIVE_CASE=>12RELATIVE_CASE=>13VOCATIVE=>14
Enum: PartOfSpeech::Form
FORM_UNKNOWN=>0ADNOMIAL=>1AUXILIARY=>2COMPLEMENTIZER=>3FINAL_ENDING=>4GERUND=>5REALIS=>6IRREALIS=>7SHORT=>8LONG=>9ORDER=>10SPECIFIC=>11
Enum: PartOfSpeech::Gender
GENDER_UNKNOWN=>0FEMININE=>1MASCULINE=>2NEUTER=>3
Enum: PartOfSpeech::Mood
MOOD_UNKNOWN=>0CONDITIONAL_MOOD=>1IMPERATIVE=>2INDICATIVE=>3INTERROGATIVE=>4JUSSIVE=>5SUBJUNCTIVE=>6
Enum: PartOfSpeech::Number
NUMBER_UNKNOWN=>0SINGULAR=>1PLURAL=>2DUAL=>3
Enum: PartOfSpeech::Person
PERSON_UNKNOWN=>0FIRST=>1SECOND=>2THIRD=>3REFLEXIVE_PERSON=>4
Enum: PartOfSpeech::Proper
PROPER_UNKNOWN=>0PROPER=>1NOT_PROPER=>2
Enum: PartOfSpeech::Reciprocity
RECIPROCITY_UNKNOWN=>0RECIPROCAL=>1NON_RECIPROCAL=>2
Enum: PartOfSpeech::Tense
TENSE_UNKNOWN=>0CONDITIONAL_TENSE=>1FUTURE=>2PAST=>3PRESENT=>4IMPERFECT=>5PLUPERFECT=>6
Enum: PartOfSpeech::Voice
VOICE_UNKNOWN=>0ACTIVE=>1CAUSATIVE=>2PASSIVE=>3
Google::Cloud::Language::V1beta1::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:
Int32Represents 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::V1beta1::DependencyEdge::Label)The parse label for the token.
Enum: DependencyEdge::Label
UNKNOWN=>0ABBREV=>1ACOMP=>2ADVCL=>3ADVMOD=>4AMOD=>5APPOS=>6ATTR=>7AUX=>8AUXPASS=>9CC=>10CCOMP=>11CONJ=>12CSUBJ=>13CSUBJPASS=>14DEP=>15DET=>16DISCOURSE=>17DOBJ=>18EXPL=>19GOESWITH=>20IOBJ=>21MARK=>22MWE=>23MWV=>24NEG=>25NN=>26NPADVMOD=>27NSUBJ=>28NSUBJPASS=>29NUM=>30NUMBER=>31P=>32PARATAXIS=>33PARTMOD=>34PCOMP=>35POBJ=>36POSS=>37POSTNEG=>38PRECOMP=>39PRECONJ=>40PREDET=>41PREF=>42PREP=>43PRONL=>44PRT=>45PS=>46QUANTMOD=>47RCMOD=>48RCMODREL=>49RDROP=>50REF=>51REMNANT=>52REPARANDUM=>53ROOT=>54SNUM=>55SUFF=>56TMOD=>57TOPIC=>58VMOD=>59VOCATIVE=>60XCOMP=>61SUFFIX=>62TITLE=>63ADVPHMOD=>64AUXCAUS=>65AUXVV=>66DTMOD=>67FOREIGN=>68KW=>69LIST=>70NOMC=>71NOMCSUBJ=>72NOMCSUBJPASS=>73NUMC=>74COP=>75DISLOCATED=>76
Google::Cloud::Language::V1beta1::LanguageService::EntityMention
Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
Inherits from Protobuf::Message.
Accessors
$msg->text()/$msg->text($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::TextSpan)The mention text.
$msg->type()/$msg->type($value)Type:
Enum(Google::Cloud::Language::V1beta1::EntityMention::Type)The type of the entity mention.
Enum: EntityMention::Type
TYPE_UNKNOWN=>0PROPER=>1COMMON=>2
Google::Cloud::Language::V1beta1::LanguageService::TextSpan
Represents an output piece of text.
Inherits from Protobuf::Message.
Accessors
$msg->content()/$msg->content($value)Type:
StringThe content of the output text.
$msg->begin_offset()/$msg->begin_offset($value)Type:
Int32The API calculates the beginning offset of the content in the original document according to the [EncodingType][google.cloud.language.v1beta1.EncodingType] specified in the API request.
Google::Cloud::Language::V1beta1::LanguageService::AnalyzeSentimentRequest
The sentiment analysis request message.
Inherits from Protobuf::Message.
Accessors
$msg->document()/$msg->document($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Document)Input document.
$msg->encoding_type()/$msg->encoding_type($value)Type:
Enum(Google::Cloud::Language::V1beta1::EncodingType)The encoding type used by the API to calculate sentence offsets for the sentence sentiment.
Google::Cloud::Language::V1beta1::LanguageService::AnalyzeSentimentResponse
The sentiment analysis response message.
Inherits from Protobuf::Message.
Accessors
$msg->document_sentiment()/$msg->document_sentiment($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Sentiment)The overall sentiment of the input document.
$msg->language()/$msg->language($value)Type:
StringThe 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.v1beta1.Document.language] field for more details.
$msg->sentences()/$msg->sentences($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Sentence)The sentiment for all the sentences in the document.
Google::Cloud::Language::V1beta1::LanguageService::AnalyzeEntitiesRequest
The entity analysis request message.
Inherits from Protobuf::Message.
Accessors
$msg->document()/$msg->document($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Document)Input document.
$msg->encoding_type()/$msg->encoding_type($value)Type:
Enum(Google::Cloud::Language::V1beta1::EncodingType)The encoding type used by the API to calculate offsets.
Google::Cloud::Language::V1beta1::LanguageService::AnalyzeEntitiesResponse
The entity analysis response message.
Inherits from Protobuf::Message.
Accessors
$msg->entities()/$msg->entities($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Entity)The recognized entities in the input document.
$msg->language()/$msg->language($value)Type:
StringThe 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.v1beta1.Document.language] field for more details.
Google::Cloud::Language::V1beta1::LanguageService::AnalyzeSyntaxRequest
The syntax analysis request message.
Inherits from Protobuf::Message.
Accessors
$msg->document()/$msg->document($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Document)Input document.
$msg->encoding_type()/$msg->encoding_type($value)Type:
Enum(Google::Cloud::Language::V1beta1::EncodingType)The encoding type used by the API to calculate offsets.
Google::Cloud::Language::V1beta1::LanguageService::AnalyzeSyntaxResponse
The syntax analysis response message.
Inherits from Protobuf::Message.
Accessors
$msg->sentences()/$msg->sentences($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Sentence)Sentences in the input document.
$msg->tokens()/$msg->tokens($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Token)Tokens, along with their syntactic information, in the input document.
$msg->language()/$msg->language($value)Type:
StringThe 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.v1beta1.Document.language] field for more details.
Google::Cloud::Language::V1beta1::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
$msg->document()/$msg->document($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Document)Input document.
$msg->features()/$msg->features($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::AnnotateTextRequest::Features)The enabled features.
$msg->encoding_type()/$msg->encoding_type($value)Type:
Enum(Google::Cloud::Language::V1beta1::EncodingType)The encoding type used by the API to calculate offsets.
Google::Cloud::Language::V1beta1::LanguageService::AnnotateTextResponse
The text annotations response message.
Inherits from Protobuf::Message.
Accessors
$msg->sentences()/$msg->sentences($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Sentence)Sentences in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_syntax].
$msg->tokens()/$msg->tokens($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Token)Tokens, along with their syntactic information, in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_syntax].
$msg->entities()/$msg->entities($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Entity)Entities, along with their semantic information, in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_entities].
$msg->document_sentiment()/$msg->document_sentiment($value)Type:
Message(Google::Cloud::Language::V1beta1::LanguageService::Sentiment)The overall sentiment for the document. Populated if the user enables [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta1.AnnotateTextRequest.Features.extract_document_sentiment].
$msg->language()/$msg->language($value)Type:
StringThe 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.v1beta1.Document.language] field for more details.
SEE ALSO
Protobuf, Protobuf::Message, Google::Cloud::Language::V1beta1::LanguageService::Types, https://protobuf.dev/
LICENSE AND COPYRIGHT
Copyright (C) 2026 Google LLC
This program is released under the Apache 2.0 license.