Variables
EncodingType_name, EncodingType_value
var
(
EncodingType_name
=
map
[
int32
]
string
{
0
:
"NONE"
,
1
:
"UTF8"
,
2
:
"UTF16"
,
3
:
"UTF32"
,
}
EncodingType_value
=
map
[
string
]
int32
{
"NONE"
:
0
,
"UTF8"
:
1
,
"UTF16"
:
2
,
"UTF32"
:
3
,
}
)
Enum value maps for EncodingType.
Document_Type_name, Document_Type_value
var
(
Document_Type_name
=
map
[
int32
]
string
{
0
:
"TYPE_UNSPECIFIED"
,
1
:
"PLAIN_TEXT"
,
2
:
"HTML"
,
}
Document_Type_value
=
map
[
string
]
int32
{
"TYPE_UNSPECIFIED"
:
0
,
"PLAIN_TEXT"
:
1
,
"HTML"
:
2
,
}
)
Enum value maps for Document_Type.
Entity_Type_name, Entity_Type_value
var
(
Entity_Type_name
=
map
[
int32
]
string
{
0
:
"UNKNOWN"
,
1
:
"PERSON"
,
2
:
"LOCATION"
,
3
:
"ORGANIZATION"
,
4
:
"EVENT"
,
5
:
"WORK_OF_ART"
,
6
:
"CONSUMER_GOOD"
,
7
:
"OTHER"
,
9
:
"PHONE_NUMBER"
,
10
:
"ADDRESS"
,
11
:
"DATE"
,
12
:
"NUMBER"
,
13
:
"PRICE"
,
}
Entity_Type_value
=
map
[
string
]
int32
{
"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
,
}
)
Enum value maps for Entity_Type.
EntityMention_Type_name, EntityMention_Type_value
var
(
EntityMention_Type_name
=
map
[
int32
]
string
{
0
:
"TYPE_UNKNOWN"
,
1
:
"PROPER"
,
2
:
"COMMON"
,
}
EntityMention_Type_value
=
map
[
string
]
int32
{
"TYPE_UNKNOWN"
:
0
,
"PROPER"
:
1
,
"COMMON"
:
2
,
}
)
Enum value maps for EntityMention_Type.
File_google_cloud_language_v2_language_service_proto
var
File_google_cloud_language_v2_language_service_proto
protoreflect
.
FileDescriptor
Functions
func RegisterLanguageServiceServer
func
RegisterLanguageServiceServer
(
s
*
grpc
.
Server
,
srv
LanguageServiceServer
)
AnalyzeEntitiesRequest
type
AnalyzeEntitiesRequest
struct
{
Document
*
Document
`protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
EncodingType
EncodingType
""
/* 141 byte string literal not displayed */
}
The entity analysis request message.
func (*AnalyzeEntitiesRequest) Descriptor
func
(
*
AnalyzeEntitiesRequest
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use AnalyzeEntitiesRequest.ProtoReflect.Descriptor instead.
func (*AnalyzeEntitiesRequest) GetDocument
func
(
x
*
AnalyzeEntitiesRequest
)
GetDocument
()
*
Document
func (*AnalyzeEntitiesRequest) GetEncodingType
func
(
x
*
AnalyzeEntitiesRequest
)
GetEncodingType
()
EncodingType
func (*AnalyzeEntitiesRequest) ProtoMessage
func
(
*
AnalyzeEntitiesRequest
)
ProtoMessage
()
func (*AnalyzeEntitiesRequest) ProtoReflect
func
(
x
*
AnalyzeEntitiesRequest
)
ProtoReflect
()
protoreflect
.
Message
func (*AnalyzeEntitiesRequest) Reset
func
(
x
*
AnalyzeEntitiesRequest
)
Reset
()
func (*AnalyzeEntitiesRequest) String
func
(
x
*
AnalyzeEntitiesRequest
)
String
()
string
AnalyzeEntitiesResponse
type
AnalyzeEntitiesResponse
struct
{
// The recognized entities in the input document.
Entities
[]
*
Entity
`protobuf:"bytes,1,rep,name=entities,proto3" json:"entities,omitempty"`
// 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.
LanguageCode
string
`protobuf:"bytes,2,opt,name=language_code,json=languageCode,proto3" json:"language_code,omitempty"`
// 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.
LanguageSupported
bool
`protobuf:"varint,3,opt,name=language_supported,json=languageSupported,proto3" json:"language_supported,omitempty"`
// contains filtered or unexported fields
}
The entity analysis response message.
func (*AnalyzeEntitiesResponse) Descriptor
func
(
*
AnalyzeEntitiesResponse
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use AnalyzeEntitiesResponse.ProtoReflect.Descriptor instead.
func (*AnalyzeEntitiesResponse) GetEntities
func
(
x
*
AnalyzeEntitiesResponse
)
GetEntities
()
[]
*
Entity
func (*AnalyzeEntitiesResponse) GetLanguageCode
func
(
x
*
AnalyzeEntitiesResponse
)
GetLanguageCode
()
string
func (*AnalyzeEntitiesResponse) GetLanguageSupported
func
(
x
*
AnalyzeEntitiesResponse
)
GetLanguageSupported
()
bool
func (*AnalyzeEntitiesResponse) ProtoMessage
func
(
*
AnalyzeEntitiesResponse
)
ProtoMessage
()
func (*AnalyzeEntitiesResponse) ProtoReflect
func
(
x
*
AnalyzeEntitiesResponse
)
ProtoReflect
()
protoreflect
.
Message
func (*AnalyzeEntitiesResponse) Reset
func
(
x
*
AnalyzeEntitiesResponse
)
Reset
()
func (*AnalyzeEntitiesResponse) String
func
(
x
*
AnalyzeEntitiesResponse
)
String
()
string
AnalyzeSentimentRequest
type
AnalyzeSentimentRequest
struct
{
Document
*
Document
`protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
EncodingType
EncodingType
""
/* 141 byte string literal not displayed */
}
The sentiment analysis request message.
func (*AnalyzeSentimentRequest) Descriptor
func
(
*
AnalyzeSentimentRequest
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use AnalyzeSentimentRequest.ProtoReflect.Descriptor instead.
func (*AnalyzeSentimentRequest) GetDocument
func
(
x
*
AnalyzeSentimentRequest
)
GetDocument
()
*
Document
func (*AnalyzeSentimentRequest) GetEncodingType
func
(
x
*
AnalyzeSentimentRequest
)
GetEncodingType
()
EncodingType
func (*AnalyzeSentimentRequest) ProtoMessage
func
(
*
AnalyzeSentimentRequest
)
ProtoMessage
()
func (*AnalyzeSentimentRequest) ProtoReflect
func
(
x
*
AnalyzeSentimentRequest
)
ProtoReflect
()
protoreflect
.
Message
func (*AnalyzeSentimentRequest) Reset
func
(
x
*
AnalyzeSentimentRequest
)
Reset
()
func (*AnalyzeSentimentRequest) String
func
(
x
*
AnalyzeSentimentRequest
)
String
()
string
AnalyzeSentimentResponse
type
AnalyzeSentimentResponse
struct
{
// The overall sentiment of the input document.
DocumentSentiment
*
Sentiment
`protobuf:"bytes,1,opt,name=document_sentiment,json=documentSentiment,proto3" json:"document_sentiment,omitempty"`
// 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.
LanguageCode
string
`protobuf:"bytes,2,opt,name=language_code,json=languageCode,proto3" json:"language_code,omitempty"`
// The sentiment for all the sentences in the document.
Sentences
[]
*
Sentence
`protobuf:"bytes,3,rep,name=sentences,proto3" json:"sentences,omitempty"`
// 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.
LanguageSupported
bool
`protobuf:"varint,4,opt,name=language_supported,json=languageSupported,proto3" json:"language_supported,omitempty"`
// contains filtered or unexported fields
}
The sentiment analysis response message.
func (*AnalyzeSentimentResponse) Descriptor
func
(
*
AnalyzeSentimentResponse
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use AnalyzeSentimentResponse.ProtoReflect.Descriptor instead.
func (*AnalyzeSentimentResponse) GetDocumentSentiment
func
(
x
*
AnalyzeSentimentResponse
)
GetDocumentSentiment
()
*
Sentiment
func (*AnalyzeSentimentResponse) GetLanguageCode
func
(
x
*
AnalyzeSentimentResponse
)
GetLanguageCode
()
string
func (*AnalyzeSentimentResponse) GetLanguageSupported
func
(
x
*
AnalyzeSentimentResponse
)
GetLanguageSupported
()
bool
func (*AnalyzeSentimentResponse) GetSentences
func
(
x
*
AnalyzeSentimentResponse
)
GetSentences
()
[]
*
Sentence
func (*AnalyzeSentimentResponse) ProtoMessage
func
(
*
AnalyzeSentimentResponse
)
ProtoMessage
()
func (*AnalyzeSentimentResponse) ProtoReflect
func
(
x
*
AnalyzeSentimentResponse
)
ProtoReflect
()
protoreflect
.
Message
func (*AnalyzeSentimentResponse) Reset
func
(
x
*
AnalyzeSentimentResponse
)
Reset
()
func (*AnalyzeSentimentResponse) String
func
(
x
*
AnalyzeSentimentResponse
)
String
()
string
AnnotateTextRequest
type
AnnotateTextRequest
struct
{
Document
*
Document
`protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
Features
*
AnnotateTextRequest_Features
`protobuf:"bytes,2,opt,name=features,proto3" json:"features,omitempty"`
EncodingType
EncodingType
""
/* 141 byte string literal not displayed */
}
The request message for the text annotation API, which can perform multiple analysis types in one call.
func (*AnnotateTextRequest) Descriptor
func
(
*
AnnotateTextRequest
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use AnnotateTextRequest.ProtoReflect.Descriptor instead.
func (*AnnotateTextRequest) GetDocument
func
(
x
*
AnnotateTextRequest
)
GetDocument
()
*
Document
func (*AnnotateTextRequest) GetEncodingType
func
(
x
*
AnnotateTextRequest
)
GetEncodingType
()
EncodingType
func (*AnnotateTextRequest) GetFeatures
func
(
x
*
AnnotateTextRequest
)
GetFeatures
()
*
AnnotateTextRequest_Features
func (*AnnotateTextRequest) ProtoMessage
func
(
*
AnnotateTextRequest
)
ProtoMessage
()
func (*AnnotateTextRequest) ProtoReflect
func
(
x
*
AnnotateTextRequest
)
ProtoReflect
()
protoreflect
.
Message
func (*AnnotateTextRequest) Reset
func
(
x
*
AnnotateTextRequest
)
Reset
()
func (*AnnotateTextRequest) String
func
(
x
*
AnnotateTextRequest
)
String
()
string
AnnotateTextRequest_Features
type
AnnotateTextRequest_Features
struct
{
ExtractEntities
bool
`protobuf:"varint,1,opt,name=extract_entities,json=extractEntities,proto3" json:"extract_entities,omitempty"`
ExtractDocumentSentiment
bool
""
/* 136 byte string literal not displayed */
ClassifyText
bool
`protobuf:"varint,4,opt,name=classify_text,json=classifyText,proto3" json:"classify_text,omitempty"`
ModerateText
bool
`protobuf:"varint,5,opt,name=moderate_text,json=moderateText,proto3" json:"moderate_text,omitempty"`
}
All available features. Setting each one to true will enable that specific analysis for the input.
func (*AnnotateTextRequest_Features) Descriptor
func
(
*
AnnotateTextRequest_Features
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use AnnotateTextRequest_Features.ProtoReflect.Descriptor instead.
func (*AnnotateTextRequest_Features) GetClassifyText
func
(
x
*
AnnotateTextRequest_Features
)
GetClassifyText
()
bool
func (*AnnotateTextRequest_Features) GetExtractDocumentSentiment
func
(
x
*
AnnotateTextRequest_Features
)
GetExtractDocumentSentiment
()
bool
func (*AnnotateTextRequest_Features) GetExtractEntities
func
(
x
*
AnnotateTextRequest_Features
)
GetExtractEntities
()
bool
func (*AnnotateTextRequest_Features) GetModerateText
func
(
x
*
AnnotateTextRequest_Features
)
GetModerateText
()
bool
func (*AnnotateTextRequest_Features) ProtoMessage
func
(
*
AnnotateTextRequest_Features
)
ProtoMessage
()
func (*AnnotateTextRequest_Features) ProtoReflect
func
(
x
*
AnnotateTextRequest_Features
)
ProtoReflect
()
protoreflect
.
Message
func (*AnnotateTextRequest_Features) Reset
func
(
x
*
AnnotateTextRequest_Features
)
Reset
()
func (*AnnotateTextRequest_Features) String
func
(
x
*
AnnotateTextRequest_Features
)
String
()
string
AnnotateTextResponse
type
AnnotateTextResponse
struct
{
// Sentences in the input document. Populated if the user enables
// [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment].
Sentences
[]
*
Sentence
`protobuf:"bytes,1,rep,name=sentences,proto3" json:"sentences,omitempty"`
// 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].
Entities
[]
*
Entity
`protobuf:"bytes,2,rep,name=entities,proto3" json:"entities,omitempty"`
// 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].
DocumentSentiment
*
Sentiment
`protobuf:"bytes,3,opt,name=document_sentiment,json=documentSentiment,proto3" json:"document_sentiment,omitempty"`
// 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.
LanguageCode
string
`protobuf:"bytes,4,opt,name=language_code,json=languageCode,proto3" json:"language_code,omitempty"`
// Categories identified in the input document.
Categories
[]
*
ClassificationCategory
`protobuf:"bytes,5,rep,name=categories,proto3" json:"categories,omitempty"`
// Harmful and sensitive categories identified in the input document.
ModerationCategories
[]
*
ClassificationCategory
`protobuf:"bytes,6,rep,name=moderation_categories,json=moderationCategories,proto3" json:"moderation_categories,omitempty"`
// 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.
LanguageSupported
bool
`protobuf:"varint,7,opt,name=language_supported,json=languageSupported,proto3" json:"language_supported,omitempty"`
// contains filtered or unexported fields
}
The text annotations response message.
func (*AnnotateTextResponse) Descriptor
func
(
*
AnnotateTextResponse
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use AnnotateTextResponse.ProtoReflect.Descriptor instead.
func (*AnnotateTextResponse) GetCategories
func
(
x
*
AnnotateTextResponse
)
GetCategories
()
[]
*
ClassificationCategory
func (*AnnotateTextResponse) GetDocumentSentiment
func
(
x
*
AnnotateTextResponse
)
GetDocumentSentiment
()
*
Sentiment
func (*AnnotateTextResponse) GetEntities
func
(
x
*
AnnotateTextResponse
)
GetEntities
()
[]
*
Entity
func (*AnnotateTextResponse) GetLanguageCode
func
(
x
*
AnnotateTextResponse
)
GetLanguageCode
()
string
func (*AnnotateTextResponse) GetLanguageSupported
func
(
x
*
AnnotateTextResponse
)
GetLanguageSupported
()
bool
func (*AnnotateTextResponse) GetModerationCategories
func
(
x
*
AnnotateTextResponse
)
GetModerationCategories
()
[]
*
ClassificationCategory
func (*AnnotateTextResponse) GetSentences
func
(
x
*
AnnotateTextResponse
)
GetSentences
()
[]
*
Sentence
func (*AnnotateTextResponse) ProtoMessage
func
(
*
AnnotateTextResponse
)
ProtoMessage
()
func (*AnnotateTextResponse) ProtoReflect
func
(
x
*
AnnotateTextResponse
)
ProtoReflect
()
protoreflect
.
Message
func (*AnnotateTextResponse) Reset
func
(
x
*
AnnotateTextResponse
)
Reset
()
func (*AnnotateTextResponse) String
func
(
x
*
AnnotateTextResponse
)
String
()
string
ClassificationCategory
type
ClassificationCategory
struct
{
// The name of the category representing the document.
Name
string
`protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// The classifier's confidence of the category. Number represents how certain
// the classifier is that this category represents the given text.
Confidence
float32
`protobuf:"fixed32,2,opt,name=confidence,proto3" json:"confidence,omitempty"`
// contains filtered or unexported fields
}
Represents a category returned from the text classifier.
func (*ClassificationCategory) Descriptor
func
(
*
ClassificationCategory
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use ClassificationCategory.ProtoReflect.Descriptor instead.
func (*ClassificationCategory) GetConfidence
func
(
x
*
ClassificationCategory
)
GetConfidence
()
float32
func (*ClassificationCategory) GetName
func
(
x
*
ClassificationCategory
)
GetName
()
string
func (*ClassificationCategory) ProtoMessage
func
(
*
ClassificationCategory
)
ProtoMessage
()
func (*ClassificationCategory) ProtoReflect
func
(
x
*
ClassificationCategory
)
ProtoReflect
()
protoreflect
.
Message
func (*ClassificationCategory) Reset
func
(
x
*
ClassificationCategory
)
Reset
()
func (*ClassificationCategory) String
func
(
x
*
ClassificationCategory
)
String
()
string
ClassifyTextRequest
type
ClassifyTextRequest
struct
{
// Required. Input document.
Document
*
Document
`protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
// contains filtered or unexported fields
}
The document classification request message.
func (*ClassifyTextRequest) Descriptor
func
(
*
ClassifyTextRequest
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use ClassifyTextRequest.ProtoReflect.Descriptor instead.
func (*ClassifyTextRequest) GetDocument
func
(
x
*
ClassifyTextRequest
)
GetDocument
()
*
Document
func (*ClassifyTextRequest) ProtoMessage
func
(
*
ClassifyTextRequest
)
ProtoMessage
()
func (*ClassifyTextRequest) ProtoReflect
func
(
x
*
ClassifyTextRequest
)
ProtoReflect
()
protoreflect
.
Message
func (*ClassifyTextRequest) Reset
func
(
x
*
ClassifyTextRequest
)
Reset
()
func (*ClassifyTextRequest) String
func
(
x
*
ClassifyTextRequest
)
String
()
string
ClassifyTextResponse
type
ClassifyTextResponse
struct
{
// Categories representing the input document.
Categories
[]
*
ClassificationCategory
`protobuf:"bytes,1,rep,name=categories,proto3" json:"categories,omitempty"`
// 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.
LanguageCode
string
`protobuf:"bytes,2,opt,name=language_code,json=languageCode,proto3" json:"language_code,omitempty"`
// 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.
LanguageSupported
bool
`protobuf:"varint,3,opt,name=language_supported,json=languageSupported,proto3" json:"language_supported,omitempty"`
// contains filtered or unexported fields
}
The document classification response message.
func (*ClassifyTextResponse) Descriptor
func
(
*
ClassifyTextResponse
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use ClassifyTextResponse.ProtoReflect.Descriptor instead.
func (*ClassifyTextResponse) GetCategories
func
(
x
*
ClassifyTextResponse
)
GetCategories
()
[]
*
ClassificationCategory
func (*ClassifyTextResponse) GetLanguageCode
func
(
x
*
ClassifyTextResponse
)
GetLanguageCode
()
string
func (*ClassifyTextResponse) GetLanguageSupported
func
(
x
*
ClassifyTextResponse
)
GetLanguageSupported
()
bool
func (*ClassifyTextResponse) ProtoMessage
func
(
*
ClassifyTextResponse
)
ProtoMessage
()
func (*ClassifyTextResponse) ProtoReflect
func
(
x
*
ClassifyTextResponse
)
ProtoReflect
()
protoreflect
.
Message
func (*ClassifyTextResponse) Reset
func
(
x
*
ClassifyTextResponse
)
Reset
()
func (*ClassifyTextResponse) String
func
(
x
*
ClassifyTextResponse
)
String
()
string
Document
type
Document
struct
{
// Required. If the type is not set or is `TYPE_UNSPECIFIED`,
// returns an `INVALID_ARGUMENT` error.
Type
Document_Type
`protobuf:"varint,1,opt,name=type,proto3,enum=google.cloud.language.v2.Document_Type" json:"type,omitempty"`
// The source of the document: a string containing the content or a
// Google Cloud Storage URI.
//
// Types that are assignable to Source:
//
// *Document_Content
// *Document_GcsContentUri
Source
isDocument_Source
`protobuf_oneof:"source"`
// Optional. The language of the document (if not specified, the language is
// automatically detected). Both ISO and BCP-47 language codes are
// accepted.
// [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.
LanguageCode
string
`protobuf:"bytes,4,opt,name=language_code,json=languageCode,proto3" json:"language_code,omitempty"`
// contains filtered or unexported fields
}
Represents the input to API methods.
func (*Document) Descriptor
Deprecated: Use Document.ProtoReflect.Descriptor instead.
func (*Document) GetContent
func (*Document) GetGcsContentUri
func (*Document) GetLanguageCode
func (*Document) GetSource
func
(
m
*
Document
)
GetSource
()
isDocument_Source
func (*Document) GetType
func
(
x
*
Document
)
GetType
()
Document_Type
func (*Document) ProtoMessage
func
(
*
Document
)
ProtoMessage
()
func (*Document) ProtoReflect
func
(
x
*
Document
)
ProtoReflect
()
protoreflect
.
Message
func (*Document) Reset
func
(
x
*
Document
)
Reset
()
func (*Document) String
Document_Content
type
Document_Content
struct
{
// The content of the input in string format.
// Cloud audit logging exempt since it is based on user data.
Content
string
`protobuf:"bytes,2,opt,name=content,proto3,oneof"`
}
Document_GcsContentUri
type
Document_GcsContentUri
struct
{
// 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.
GcsContentUri
string
`protobuf:"bytes,3,opt,name=gcs_content_uri,json=gcsContentUri,proto3,oneof"`
}
Document_Type
type
Document_Type
int32
The document types enum.
Document_TYPE_UNSPECIFIED, Document_PLAIN_TEXT, Document_HTML
const
(
// The content type is not specified.
Document_TYPE_UNSPECIFIED
Document_Type
=
0
// Plain text
Document_PLAIN_TEXT
Document_Type
=
1
// HTML
Document_HTML
Document_Type
=
2
)
func (Document_Type) Descriptor
func
(
Document_Type
)
Descriptor
()
protoreflect
.
EnumDescriptor
func (Document_Type) Enum
func
(
x
Document_Type
)
Enum
()
*
Document_Type
func (Document_Type) EnumDescriptor
func
(
Document_Type
)
EnumDescriptor
()
([]
byte
,
[]
int
)
Deprecated: Use Document_Type.Descriptor instead.
func (Document_Type) Number
func
(
x
Document_Type
)
Number
()
protoreflect
.
EnumNumber
func (Document_Type) String
func
(
x
Document_Type
)
String
()
string
func (Document_Type) Type
func
(
Document_Type
)
Type
()
protoreflect
.
EnumType
EncodingType
type
EncodingType
int32
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.
EncodingType_NONE, EncodingType_UTF8, EncodingType_UTF16, EncodingType_UTF32
const
(
// If `EncodingType` is not specified, encoding-dependent information (such as
// `begin_offset`) will be set at `-1`.
EncodingType_NONE
EncodingType
=
0
// Encoding-dependent information (such as `begin_offset`) is calculated based
// on the UTF-8 encoding of the input. C++ and Go are examples of languages
// that use this encoding natively.
EncodingType_UTF8
EncodingType
=
1
// Encoding-dependent information (such as `begin_offset`) is calculated based
// on the UTF-16 encoding of the input. Java and JavaScript are examples of
// languages that use this encoding natively.
EncodingType_UTF16
EncodingType
=
2
// Encoding-dependent information (such as `begin_offset`) is calculated based
// on the UTF-32 encoding of the input. Python is an example of a language
// that uses this encoding natively.
EncodingType_UTF32
EncodingType
=
3
)
func (EncodingType) Descriptor
func
(
EncodingType
)
Descriptor
()
protoreflect
.
EnumDescriptor
func (EncodingType) Enum
func
(
x
EncodingType
)
Enum
()
*
EncodingType
func (EncodingType) EnumDescriptor
func
(
EncodingType
)
EnumDescriptor
()
([]
byte
,
[]
int
)
Deprecated: Use EncodingType.Descriptor instead.
func (EncodingType) Number
func
(
x
EncodingType
)
Number
()
protoreflect
.
EnumNumber
func (EncodingType) String
func
(
x
EncodingType
)
String
()
string
func (EncodingType) Type
func
(
EncodingType
)
Type
()
protoreflect
.
EnumType
Entity
type
Entity
struct
{
Name
string
`protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Type
Entity_Type
`protobuf:"varint,2,opt,name=type,proto3,enum=google.cloud.language.v2.Entity_Type" json:"type,omitempty"`
Metadata
map
[
string
]
string
""
/* 157 byte string literal not displayed */
Mentions
[]
*
EntityMention
`protobuf:"bytes,5,rep,name=mentions,proto3" json:"mentions,omitempty"`
Sentiment
*
Sentiment
`protobuf:"bytes,6,opt,name=sentiment,proto3" json:"sentiment,omitempty"`
}
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.
func (*Entity) Descriptor
Deprecated: Use Entity.ProtoReflect.Descriptor instead.
func (*Entity) GetMentions
func
(
x
*
Entity
)
GetMentions
()
[]
*
EntityMention
func (*Entity) GetMetadata
func (*Entity) GetName
func (*Entity) GetSentiment
func (*Entity) GetType
func
(
x
*
Entity
)
GetType
()
Entity_Type
func (*Entity) ProtoMessage
func
(
*
Entity
)
ProtoMessage
()
func (*Entity) ProtoReflect
func
(
x
*
Entity
)
ProtoReflect
()
protoreflect
.
Message
func (*Entity) Reset
func
(
x
*
Entity
)
Reset
()
func (*Entity) String
EntityMention
type
EntityMention
struct
{
// The mention text.
Text
*
TextSpan
`protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
// The type of the entity mention.
Type
EntityMention_Type
`protobuf:"varint,2,opt,name=type,proto3,enum=google.cloud.language.v2.EntityMention_Type" json:"type,omitempty"`
// 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.
Sentiment
*
Sentiment
`protobuf:"bytes,3,opt,name=sentiment,proto3" json:"sentiment,omitempty"`
// 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.
Probability
float32
`protobuf:"fixed32,4,opt,name=probability,proto3" json:"probability,omitempty"`
// contains filtered or unexported fields
}
Represents a mention for an entity in the text. Currently, proper noun mentions are supported.
func (*EntityMention) Descriptor
func
(
*
EntityMention
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use EntityMention.ProtoReflect.Descriptor instead.
func (*EntityMention) GetProbability
func
(
x
*
EntityMention
)
GetProbability
()
float32
func (*EntityMention) GetSentiment
func
(
x
*
EntityMention
)
GetSentiment
()
*
Sentiment
func (*EntityMention) GetText
func
(
x
*
EntityMention
)
GetText
()
*
TextSpan
func (*EntityMention) GetType
func
(
x
*
EntityMention
)
GetType
()
EntityMention_Type
func (*EntityMention) ProtoMessage
func
(
*
EntityMention
)
ProtoMessage
()
func (*EntityMention) ProtoReflect
func
(
x
*
EntityMention
)
ProtoReflect
()
protoreflect
.
Message
func (*EntityMention) Reset
func
(
x
*
EntityMention
)
Reset
()
func (*EntityMention) String
func
(
x
*
EntityMention
)
String
()
string
EntityMention_Type
type
EntityMention_Type
int32
The supported types of mentions.
EntityMention_TYPE_UNKNOWN, EntityMention_PROPER, EntityMention_COMMON
const
(
// Unknown
EntityMention_TYPE_UNKNOWN
EntityMention_Type
=
0
// Proper name
EntityMention_PROPER
EntityMention_Type
=
1
// Common noun (or noun compound)
EntityMention_COMMON
EntityMention_Type
=
2
)
func (EntityMention_Type) Descriptor
func
(
EntityMention_Type
)
Descriptor
()
protoreflect
.
EnumDescriptor
func (EntityMention_Type) Enum
func
(
x
EntityMention_Type
)
Enum
()
*
EntityMention_Type
func (EntityMention_Type) EnumDescriptor
func
(
EntityMention_Type
)
EnumDescriptor
()
([]
byte
,
[]
int
)
Deprecated: Use EntityMention_Type.Descriptor instead.
func (EntityMention_Type) Number
func
(
x
EntityMention_Type
)
Number
()
protoreflect
.
EnumNumber
func (EntityMention_Type) String
func
(
x
EntityMention_Type
)
String
()
string
func (EntityMention_Type) Type
func
(
EntityMention_Type
)
Type
()
protoreflect
.
EnumType
Entity_Type
type
Entity_Type
int32
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.
Entity_UNKNOWN, Entity_PERSON, Entity_LOCATION, Entity_ORGANIZATION, Entity_EVENT, Entity_WORK_OF_ART, Entity_CONSUMER_GOOD, Entity_OTHER, Entity_PHONE_NUMBER, Entity_ADDRESS, Entity_DATE, Entity_NUMBER, Entity_PRICE
const
(
// Unknown
Entity_UNKNOWN
Entity_Type
=
0
// Person
Entity_PERSON
Entity_Type
=
1
// Location
Entity_LOCATION
Entity_Type
=
2
// Organization
Entity_ORGANIZATION
Entity_Type
=
3
// Event
Entity_EVENT
Entity_Type
=
4
// Artwork
Entity_WORK_OF_ART
Entity_Type
=
5
// Consumer product
Entity_CONSUMER_GOOD
Entity_Type
=
6
// Other types of entities
Entity_OTHER
Entity_Type
=
7
// Phone number
//
// The metadata lists the phone number, formatted according to local
// convention, plus whichever additional elements appear in the text:
//
// * `number` - the actual number, broken down into sections as per local
// convention
// * `national_prefix` - country code, if detected
// * `area_code` - region or area code, if detected
// * `extension` - phone extension (to be dialed after connection), if
// detected
Entity_PHONE_NUMBER
Entity_Type
=
9
// Address
//
// The metadata identifies the street number and locality plus whichever
// additional elements appear in the text:
//
// * `street_number` - street number
// * `locality` - city or town
// * `street_name` - street/route name, if detected
// * `postal_code` - postal code, if detected
// * `country` - country, if detected< *="" `broad_region`="" -="" administrative="" area,="" such="" as="" the="" state,="" if="" detected="" *="" `narrow_region`="" -="" smaller="" administrative="" area,="" such="" as="" county,="" if="" detected="" *="" `sublocality`="" -="" used="" in="" asian="" addresses="" to="" demark="" a="" district="" within="" a="" city,="" if="" detected="" entity_address=""> Entity_Type
= 10
// Date
//
// The metadata identifies the components of the date:
//
// * `year` - four digit year, if detected
// * `month` - two digit month number, if detected
// * `day` - two digit day number, if detected
Entity_DATE
Entity_Type
=
11
// Number
//
// The metadata is the number itself.
Entity_NUMBER
Entity_Type
=
12
// Price
//
// The metadata identifies the `value` and `currency`.
Entity_PRICE
Entity_Type
=
13
)
func (Entity_Type) Descriptor
func
(
Entity_Type
)
Descriptor
()
protoreflect
.
EnumDescriptor
func (Entity_Type) Enum
func
(
x
Entity_Type
)
Enum
()
*
Entity_Type
func (Entity_Type) EnumDescriptor
func
(
Entity_Type
)
EnumDescriptor
()
([]
byte
,
[]
int
)
Deprecated: Use Entity_Type.Descriptor instead.
func (Entity_Type) Number
func
(
x
Entity_Type
)
Number
()
protoreflect
.
EnumNumber
func (Entity_Type) String
func
(
x
Entity_Type
)
String
()
string
func (Entity_Type) Type
func
(
Entity_Type
)
Type
()
protoreflect
.
EnumType
LanguageServiceClient
type
LanguageServiceClient
interface
{
// Analyzes the sentiment of the provided text.
AnalyzeSentiment
(
ctx
context
.
Context
,
in
*
AnalyzeSentimentRequest
,
opts
...
grpc
.
CallOption
)
(
*
AnalyzeSentimentResponse
,
error
)
// Finds named entities (currently proper names and common nouns) in the text
// along with entity types, probability, mentions for each entity, and
// other properties.
AnalyzeEntities
(
ctx
context
.
Context
,
in
*
AnalyzeEntitiesRequest
,
opts
...
grpc
.
CallOption
)
(
*
AnalyzeEntitiesResponse
,
error
)
// Classifies a document into categories.
ClassifyText
(
ctx
context
.
Context
,
in
*
ClassifyTextRequest
,
opts
...
grpc
.
CallOption
)
(
*
ClassifyTextResponse
,
error
)
// Moderates a document for harmful and sensitive categories.
ModerateText
(
ctx
context
.
Context
,
in
*
ModerateTextRequest
,
opts
...
grpc
.
CallOption
)
(
*
ModerateTextResponse
,
error
)
// A convenience method that provides all features in one call.
AnnotateText
(
ctx
context
.
Context
,
in
*
AnnotateTextRequest
,
opts
...
grpc
.
CallOption
)
(
*
AnnotateTextResponse
,
error
)
}
LanguageServiceClient is the client API for LanguageService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream .
func NewLanguageServiceClient
func
NewLanguageServiceClient
(
cc
grpc
.
ClientConnInterface
)
LanguageServiceClient
LanguageServiceServer
type
LanguageServiceServer
interface
{
// Analyzes the sentiment of the provided text.
AnalyzeSentiment
(
context
.
Context
,
*
AnalyzeSentimentRequest
)
(
*
AnalyzeSentimentResponse
,
error
)
// Finds named entities (currently proper names and common nouns) in the text
// along with entity types, probability, mentions for each entity, and
// other properties.
AnalyzeEntities
(
context
.
Context
,
*
AnalyzeEntitiesRequest
)
(
*
AnalyzeEntitiesResponse
,
error
)
// Classifies a document into categories.
ClassifyText
(
context
.
Context
,
*
ClassifyTextRequest
)
(
*
ClassifyTextResponse
,
error
)
// Moderates a document for harmful and sensitive categories.
ModerateText
(
context
.
Context
,
*
ModerateTextRequest
)
(
*
ModerateTextResponse
,
error
)
// A convenience method that provides all features in one call.
AnnotateText
(
context
.
Context
,
*
AnnotateTextRequest
)
(
*
AnnotateTextResponse
,
error
)
}
LanguageServiceServer is the server API for LanguageService service.
ModerateTextRequest
type
ModerateTextRequest
struct
{
// Required. Input document.
Document
*
Document
`protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
// contains filtered or unexported fields
}
The document moderation request message.
func (*ModerateTextRequest) Descriptor
func
(
*
ModerateTextRequest
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use ModerateTextRequest.ProtoReflect.Descriptor instead.
func (*ModerateTextRequest) GetDocument
func
(
x
*
ModerateTextRequest
)
GetDocument
()
*
Document
func (*ModerateTextRequest) ProtoMessage
func
(
*
ModerateTextRequest
)
ProtoMessage
()
func (*ModerateTextRequest) ProtoReflect
func
(
x
*
ModerateTextRequest
)
ProtoReflect
()
protoreflect
.
Message
func (*ModerateTextRequest) Reset
func
(
x
*
ModerateTextRequest
)
Reset
()
func (*ModerateTextRequest) String
func
(
x
*
ModerateTextRequest
)
String
()
string
ModerateTextResponse
type
ModerateTextResponse
struct
{
// Harmful and sensitive categories representing the input document.
ModerationCategories
[]
*
ClassificationCategory
`protobuf:"bytes,1,rep,name=moderation_categories,json=moderationCategories,proto3" json:"moderation_categories,omitempty"`
// 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.
LanguageCode
string
`protobuf:"bytes,2,opt,name=language_code,json=languageCode,proto3" json:"language_code,omitempty"`
// 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.
LanguageSupported
bool
`protobuf:"varint,3,opt,name=language_supported,json=languageSupported,proto3" json:"language_supported,omitempty"`
// contains filtered or unexported fields
}
The document moderation response message.
func (*ModerateTextResponse) Descriptor
func
(
*
ModerateTextResponse
)
Descriptor
()
([]
byte
,
[]
int
)
Deprecated: Use ModerateTextResponse.ProtoReflect.Descriptor instead.
func (*ModerateTextResponse) GetLanguageCode
func
(
x
*
ModerateTextResponse
)
GetLanguageCode
()
string
func (*ModerateTextResponse) GetLanguageSupported
func
(
x
*
ModerateTextResponse
)
GetLanguageSupported
()
bool
func (*ModerateTextResponse) GetModerationCategories
func
(
x
*
ModerateTextResponse
)
GetModerationCategories
()
[]
*
ClassificationCategory
func (*ModerateTextResponse) ProtoMessage
func
(
*
ModerateTextResponse
)
ProtoMessage
()
func (*ModerateTextResponse) ProtoReflect
func
(
x
*
ModerateTextResponse
)
ProtoReflect
()
protoreflect
.
Message
func (*ModerateTextResponse) Reset
func
(
x
*
ModerateTextResponse
)
Reset
()
func (*ModerateTextResponse) String
func
(
x
*
ModerateTextResponse
)
String
()
string
Sentence
type
Sentence
struct
{
// The sentence text.
Text
*
TextSpan
`protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
// For calls to [AnalyzeSentiment][] or if
// [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_document_sentiment]
// is set to true, this field will contain the sentiment for the sentence.
Sentiment
*
Sentiment
`protobuf:"bytes,2,opt,name=sentiment,proto3" json:"sentiment,omitempty"`
// contains filtered or unexported fields
}
Represents a sentence in the input document.
func (*Sentence) Descriptor
Deprecated: Use Sentence.ProtoReflect.Descriptor instead.
func (*Sentence) GetSentiment
func (*Sentence) GetText
func (*Sentence) ProtoMessage
func
(
*
Sentence
)
ProtoMessage
()
func (*Sentence) ProtoReflect
func
(
x
*
Sentence
)
ProtoReflect
()
protoreflect
.
Message
func (*Sentence) Reset
func
(
x
*
Sentence
)
Reset
()
func (*Sentence) String
Sentiment
type
Sentiment
struct
{
// A non-negative number in the [0, +inf) range, which represents
// the absolute magnitude of sentiment regardless of score (positive or
// negative).
Magnitude
float32
`protobuf:"fixed32,1,opt,name=magnitude,proto3" json:"magnitude,omitempty"`
// Sentiment score between -1.0 (negative sentiment) and 1.0
// (positive sentiment).
Score
float32
`protobuf:"fixed32,2,opt,name=score,proto3" json:"score,omitempty"`
// contains filtered or unexported fields
}
Represents the feeling associated with the entire text or entities in the text.
func (*Sentiment) Descriptor
Deprecated: Use Sentiment.ProtoReflect.Descriptor instead.
func (*Sentiment) GetMagnitude
func (*Sentiment) GetScore
func (*Sentiment) ProtoMessage
func
(
*
Sentiment
)
ProtoMessage
()
func (*Sentiment) ProtoReflect
func
(
x
*
Sentiment
)
ProtoReflect
()
protoreflect
.
Message
func (*Sentiment) Reset
func
(
x
*
Sentiment
)
Reset
()
func (*Sentiment) String
TextSpan
type
TextSpan
struct
{
// The content of the text span, which is a substring of the document.
Content
string
`protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
// 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.
BeginOffset
int32
`protobuf:"varint,2,opt,name=begin_offset,json=beginOffset,proto3" json:"begin_offset,omitempty"`
// contains filtered or unexported fields
}
Represents a text span in the input document.
func (*TextSpan) Descriptor
Deprecated: Use TextSpan.ProtoReflect.Descriptor instead.
func (*TextSpan) GetBeginOffset
func (*TextSpan) GetContent
func (*TextSpan) ProtoMessage
func
(
*
TextSpan
)
ProtoMessage
()
func (*TextSpan) ProtoReflect
func
(
x
*
TextSpan
)
ProtoReflect
()
protoreflect
.
Message
func (*TextSpan) Reset
func
(
x
*
TextSpan
)
Reset
()
func (*TextSpan) String
UnimplementedLanguageServiceServer
type
UnimplementedLanguageServiceServer
struct
{
}
UnimplementedLanguageServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedLanguageServiceServer) AnalyzeEntities
func
(
*
UnimplementedLanguageServiceServer
)
AnalyzeEntities
(
context
.
Context
,
*
AnalyzeEntitiesRequest
)
(
*
AnalyzeEntitiesResponse
,
error
)
func (*UnimplementedLanguageServiceServer) AnalyzeSentiment
func
(
*
UnimplementedLanguageServiceServer
)
AnalyzeSentiment
(
context
.
Context
,
*
AnalyzeSentimentRequest
)
(
*
AnalyzeSentimentResponse
,
error
)
func (*UnimplementedLanguageServiceServer) AnnotateText
func
(
*
UnimplementedLanguageServiceServer
)
AnnotateText
(
context
.
Context
,
*
AnnotateTextRequest
)
(
*
AnnotateTextResponse
,
error
)
func (*UnimplementedLanguageServiceServer) ClassifyText
func
(
*
UnimplementedLanguageServiceServer
)
ClassifyText
(
context
.
Context
,
*
ClassifyTextRequest
)
(
*
ClassifyTextResponse
,
error
)
func (*UnimplementedLanguageServiceServer) ModerateText
func
(
*
UnimplementedLanguageServiceServer
)
ModerateText
(
context
.
Context
,
*
ModerateTextRequest
)
(
*
ModerateTextResponse
,
error
)