Service Client: Google::Cloud::Language::V2::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::V2::LanguageService - Compiled Protocol Buffers messages for google/cloud/language/v2/language_service.proto

SYNOPSIS

use Google::Cloud::Language::V2::LanguageService;

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

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

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

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

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/language/v2/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::V2::LanguageService::Document

Represents the input to API methods.

Inherits from Protobuf::Message.

Accessors

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

    Type: Enum (Google::Cloud::Language::V2::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_code() / $msg->language_code($value)

    Type: String

    Optional. 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.

Enum: Document::Type

  • TYPE_UNSPECIFIED => 0

  • PLAIN_TEXT => 1

  • HTML => 2

Google::Cloud::Language::V2::LanguageService::Sentence

Represents a sentence in the input document.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V2::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 probability and mentions, with entities.

Inherits from Protobuf::Message.

Accessors

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::V2::LanguageService::Sentiment

Represents the feeling associated with the entire text or entities in the text.

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::V2::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::V2::LanguageService::TextSpan)

    The mention text.

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

    Type: Enum (Google::Cloud::Language::V2::EntityMention::Type)

    The type of the entity mention.

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

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

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

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

    Type: Float

    Probability score associated with the entity.

    The score shows the probability of the entity mention being the entity type. The score is in (0, 1] range.

Enum: EntityMention::Type

  • TYPE_UNKNOWN => 0

  • PROPER => 1

  • COMMON => 2

Google::Cloud::Language::V2::LanguageService::TextSpan

Represents a text span in the input document.

Inherits from Protobuf::Message.

Accessors

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

    Type: String

    The content of the text span, which is a substring of the document.

  • $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.v2.EncodingType] specified in the API request.

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

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

    Type: Float

    Optional. The classifier's severity of the category. This is only present when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and the corresponding category has a severity score.

Google::Cloud::Language::V2::LanguageService::AnalyzeSentimentRequest

The sentiment analysis request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V2::LanguageService::AnalyzeSentimentResponse

The sentiment analysis response message.

Inherits from Protobuf::Message.

Accessors

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

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

    The overall sentiment of the input document.

  • $msg->language_code() / $msg->language_code($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][] field for more details.

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

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

    The sentiment for all the sentences in the document.

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

    Type: Bool

    Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.

Google::Cloud::Language::V2::LanguageService::AnalyzeEntitiesRequest

The entity analysis request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V2::LanguageService::AnalyzeEntitiesResponse

The entity analysis response message.

Inherits from Protobuf::Message.

Accessors

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

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

    The recognized entities in the input document.

  • $msg->language_code() / $msg->language_code($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][] field for more details.

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

    Type: Bool

    Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.

Google::Cloud::Language::V2::LanguageService::ClassifyTextRequest

The document classification request message.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V2::LanguageService::ClassifyTextResponse

The document classification response message.

Inherits from Protobuf::Message.

Accessors

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

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

    Categories representing the input document.

  • $msg->language_code() / $msg->language_code($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][] field for more details.

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

    Type: Bool

    Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.

Google::Cloud::Language::V2::LanguageService::ModerateTextRequest

The document moderation request message.

Inherits from Protobuf::Message.

Accessors

Enum: ModerateTextRequest::ModelVersion

  • MODEL_VERSION_UNSPECIFIED => 0

  • MODEL_VERSION_1 => 1

  • MODEL_VERSION_2 => 2

Google::Cloud::Language::V2::LanguageService::ModerateTextResponse

The document moderation response message.

Inherits from Protobuf::Message.

Accessors

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

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

    Harmful and sensitive categories representing the input document.

  • $msg->language_code() / $msg->language_code($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][] field for more details.

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

    Type: Bool

    Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.

Google::Cloud::Language::V2::LanguageService::AnnotateTextRequest

The request message for the text annotation API, which can perform multiple analysis types in one call.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Language::V2::LanguageService::AnnotateTextResponse

The text annotations response message.

Inherits from Protobuf::Message.

Accessors

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

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

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

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

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

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

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

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

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

  • $msg->language_code() / $msg->language_code($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][] field for more details.

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

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

    Categories identified in the input document.

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

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

    Harmful and sensitive categories identified in the input document.

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

    Type: Bool

    Whether the language is officially supported by all requested features. The API may still return a response when the language is not supported, but it is on a best effort basis.

SEE ALSO

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

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.