Movatterモバイル変換


[0]ホーム

URL:


language

package
v0.257.0Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:16Imported by:3

Details

Repository

github.com/googleapis/google-api-go-client

Links

Documentation

Overview

Package language provides access to the Cloud Natural Language API.

This package is DEPRECATED. Use package cloud.google.com/go/language/apiv1 instead.

For product documentation, see:https://cloud.google.com/natural-language/

Creating a client

Usage example:

import "google.golang.org/api/language/v1beta1"...ctx := context.Background()languageService, err := language.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, seehttps://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:

languageService, err := language.NewService(ctx, option.WithScopes(language.CloudPlatformScope))

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

languageService, err := language.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}// ...token, err := config.Exchange(ctx, ...)languageService, err := language.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

Seehttps://godoc.org/google.golang.org/api/option/ for details on options.

Index

Constants

View Source
const (// Apply machine learning models to reveal the structure and meaning of// textCloudLanguageScope = "https://www.googleapis.com/auth/cloud-language"// See, edit, configure, and delete your Google Cloud data and see the// email address for your Google Account.CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform")

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

typeAnalyzeEntitiesRequest

type AnalyzeEntitiesRequest struct {// Document: Input document.Document *Document `json:"document,omitempty"`// EncodingType: The encoding type used by the API to calculate offsets.//// Possible values://   "NONE" - If `EncodingType` is not specified, encoding-dependent// information (such as `begin_offset`) will be set at `-1`.//   "UTF8" - 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.//   "UTF16" - 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.//   "UTF32" - 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.EncodingTypestring `json:"encodingType,omitempty"`// ForceSendFields is a list of field names (e.g. "Document") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Document") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

AnalyzeEntitiesRequest: The entity analysis request message.

func (*AnalyzeEntitiesRequest)MarshalJSON

func (s *AnalyzeEntitiesRequest) MarshalJSON() ([]byte,error)

typeAnalyzeEntitiesResponse

type AnalyzeEntitiesResponse struct {// Entities: The recognized entities in the input document.Entities []*Entity `json:"entities,omitempty"`// Language: 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.Languagestring `json:"language,omitempty"`// ServerResponse contains the HTTP response code and headers from the// server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "Entities") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Entities") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

AnalyzeEntitiesResponse: The entity analysis response message.

func (*AnalyzeEntitiesResponse)MarshalJSON

func (s *AnalyzeEntitiesResponse) MarshalJSON() ([]byte,error)

typeAnalyzeSentimentRequest

type AnalyzeSentimentRequest struct {// Document: Input document.Document *Document `json:"document,omitempty"`// EncodingType: The encoding type used by the API to calculate sentence// offsets for the sentence sentiment.//// Possible values://   "NONE" - If `EncodingType` is not specified, encoding-dependent// information (such as `begin_offset`) will be set at `-1`.//   "UTF8" - 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.//   "UTF16" - 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.//   "UTF32" - 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.EncodingTypestring `json:"encodingType,omitempty"`// ForceSendFields is a list of field names (e.g. "Document") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Document") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

AnalyzeSentimentRequest: The sentiment analysis request message.

func (*AnalyzeSentimentRequest)MarshalJSON

func (s *AnalyzeSentimentRequest) MarshalJSON() ([]byte,error)

typeAnalyzeSentimentResponse

type AnalyzeSentimentResponse struct {// DocumentSentiment: The overall sentiment of the input document.DocumentSentiment *Sentiment `json:"documentSentiment,omitempty"`// Language: 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.Languagestring `json:"language,omitempty"`// Sentences: The sentiment for all the sentences in the document.Sentences []*Sentence `json:"sentences,omitempty"`// ServerResponse contains the HTTP response code and headers from the// server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "DocumentSentiment")// to unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "DocumentSentiment") to// include in API requests with the JSON null value. By default, fields// with empty values are omitted from API requests. However, any field// with an empty value appearing in NullFields will be sent to the// server as null. It is an error if a field in this list has a// non-empty value. This may be used to include null fields in Patch// requests.NullFields []string `json:"-"`}

AnalyzeSentimentResponse: The sentiment analysis response message.

func (*AnalyzeSentimentResponse)MarshalJSON

func (s *AnalyzeSentimentResponse) MarshalJSON() ([]byte,error)

typeAnalyzeSyntaxRequest

type AnalyzeSyntaxRequest struct {// Document: Input document.Document *Document `json:"document,omitempty"`// EncodingType: The encoding type used by the API to calculate offsets.//// Possible values://   "NONE" - If `EncodingType` is not specified, encoding-dependent// information (such as `begin_offset`) will be set at `-1`.//   "UTF8" - 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.//   "UTF16" - 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.//   "UTF32" - 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.EncodingTypestring `json:"encodingType,omitempty"`// ForceSendFields is a list of field names (e.g. "Document") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Document") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

AnalyzeSyntaxRequest: The syntax analysis request message.

func (*AnalyzeSyntaxRequest)MarshalJSON

func (s *AnalyzeSyntaxRequest) MarshalJSON() ([]byte,error)

typeAnalyzeSyntaxResponse

type AnalyzeSyntaxResponse struct {// Language: 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.Languagestring `json:"language,omitempty"`// Sentences: Sentences in the input document.Sentences []*Sentence `json:"sentences,omitempty"`// Tokens: Tokens, along with their syntactic information, in the input// document.Tokens []*Token `json:"tokens,omitempty"`// ServerResponse contains the HTTP response code and headers from the// server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "Language") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Language") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

AnalyzeSyntaxResponse: The syntax analysis response message.

func (*AnalyzeSyntaxResponse)MarshalJSON

func (s *AnalyzeSyntaxResponse) MarshalJSON() ([]byte,error)

typeAnnotateTextRequest

type AnnotateTextRequest struct {// Document: Input document.Document *Document `json:"document,omitempty"`// EncodingType: The encoding type used by the API to calculate offsets.//// Possible values://   "NONE" - If `EncodingType` is not specified, encoding-dependent// information (such as `begin_offset`) will be set at `-1`.//   "UTF8" - 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.//   "UTF16" - 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.//   "UTF32" - 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.EncodingTypestring `json:"encodingType,omitempty"`// Features: The enabled features.Features *Features `json:"features,omitempty"`// ForceSendFields is a list of field names (e.g. "Document") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Document") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

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

func (*AnnotateTextRequest)MarshalJSON

func (s *AnnotateTextRequest) MarshalJSON() ([]byte,error)

typeAnnotateTextResponse

type AnnotateTextResponse struct {// DocumentSentiment: The overall sentiment for the document. Populated// if the user enables// AnnotateTextRequest.Features.extract_document_sentiment.DocumentSentiment *Sentiment `json:"documentSentiment,omitempty"`// Entities: Entities, along with their semantic information, in the// input document. Populated if the user enables// AnnotateTextRequest.Features.extract_entities.Entities []*Entity `json:"entities,omitempty"`// Language: 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.Languagestring `json:"language,omitempty"`// Sentences: Sentences in the input document. Populated if the user// enables AnnotateTextRequest.Features.extract_syntax.Sentences []*Sentence `json:"sentences,omitempty"`// Tokens: Tokens, along with their syntactic information, in the input// document. Populated if the user enables// AnnotateTextRequest.Features.extract_syntax.Tokens []*Token `json:"tokens,omitempty"`// ServerResponse contains the HTTP response code and headers from the// server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "DocumentSentiment")// to unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "DocumentSentiment") to// include in API requests with the JSON null value. By default, fields// with empty values are omitted from API requests. However, any field// with an empty value appearing in NullFields will be sent to the// server as null. It is an error if a field in this list has a// non-empty value. This may be used to include null fields in Patch// requests.NullFields []string `json:"-"`}

AnnotateTextResponse: The text annotations response message.

func (*AnnotateTextResponse)MarshalJSON

func (s *AnnotateTextResponse) MarshalJSON() ([]byte,error)

typeDependencyEdge

type DependencyEdge struct {// HeadTokenIndex: 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.HeadTokenIndexint64 `json:"headTokenIndex,omitempty"`// Label: The parse label for the token.//// Possible values://   "UNKNOWN" - Unknown//   "ABBREV" - Abbreviation modifier//   "ACOMP" - Adjectival complement//   "ADVCL" - Adverbial clause modifier//   "ADVMOD" - Adverbial modifier//   "AMOD" - Adjectival modifier of an NP//   "APPOS" - Appositional modifier of an NP//   "ATTR" - Attribute dependent of a copular verb//   "AUX" - Auxiliary (non-main) verb//   "AUXPASS" - Passive auxiliary//   "CC" - Coordinating conjunction//   "CCOMP" - Clausal complement of a verb or adjective//   "CONJ" - Conjunct//   "CSUBJ" - Clausal subject//   "CSUBJPASS" - Clausal passive subject//   "DEP" - Dependency (unable to determine)//   "DET" - Determiner//   "DISCOURSE" - Discourse//   "DOBJ" - Direct object//   "EXPL" - Expletive//   "GOESWITH" - Goes with (part of a word in a text not well edited)//   "IOBJ" - Indirect object//   "MARK" - Marker (word introducing a subordinate clause)//   "MWE" - Multi-word expression//   "MWV" - Multi-word verbal expression//   "NEG" - Negation modifier//   "NN" - Noun compound modifier//   "NPADVMOD" - Noun phrase used as an adverbial modifier//   "NSUBJ" - Nominal subject//   "NSUBJPASS" - Passive nominal subject//   "NUM" - Numeric modifier of a noun//   "NUMBER" - Element of compound number//   "P" - Punctuation mark//   "PARATAXIS" - Parataxis relation//   "PARTMOD" - Participial modifier//   "PCOMP" - The complement of a preposition is a clause//   "POBJ" - Object of a preposition//   "POSS" - Possession modifier//   "POSTNEG" - Postverbal negative particle//   "PRECOMP" - Predicate complement//   "PRECONJ" - Preconjunt//   "PREDET" - Predeterminer//   "PREF" - Prefix//   "PREP" - Prepositional modifier//   "PRONL" - The relationship between a verb and verbal morpheme//   "PRT" - Particle//   "PS" - Associative or possessive marker//   "QUANTMOD" - Quantifier phrase modifier//   "RCMOD" - Relative clause modifier//   "RCMODREL" - Complementizer in relative clause//   "RDROP" - Ellipsis without a preceding predicate//   "REF" - Referent//   "REMNANT" - Remnant//   "REPARANDUM" - Reparandum//   "ROOT" - Root//   "SNUM" - Suffix specifying a unit of number//   "SUFF" - Suffix//   "TMOD" - Temporal modifier//   "TOPIC" - Topic marker//   "VMOD" - Clause headed by an infinite form of the verb that// modifies a noun//   "VOCATIVE" - Vocative//   "XCOMP" - Open clausal complement//   "SUFFIX" - Name suffix//   "TITLE" - Name title//   "ADVPHMOD" - Adverbial phrase modifier//   "AUXCAUS" - Causative auxiliary//   "AUXVV" - Helper auxiliary//   "DTMOD" - Rentaishi (Prenominal modifier)//   "FOREIGN" - Foreign words//   "KW" - Keyword//   "LIST" - List for chains of comparable items//   "NOMC" - Nominalized clause//   "NOMCSUBJ" - Nominalized clausal subject//   "NOMCSUBJPASS" - Nominalized clausal passive//   "NUMC" - Compound of numeric modifier//   "COP" - Copula//   "DISLOCATED" - Dislocated relation (for fronted/topicalized// elements)//   "ASP" - Aspect marker//   "GMOD" - Genitive modifier//   "GOBJ" - Genitive object//   "INFMOD" - Infinitival modifier//   "MES" - Measure//   "NCOMP" - Nominal complement of a nounLabelstring `json:"label,omitempty"`// ForceSendFields is a list of field names (e.g. "HeadTokenIndex") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "HeadTokenIndex") to// include in API requests with the JSON null value. By default, fields// with empty values are omitted from API requests. However, any field// with an empty value appearing in NullFields will be sent to the// server as null. It is an error if a field in this list has a// non-empty value. This may be used to include null fields in Patch// requests.NullFields []string `json:"-"`}

DependencyEdge: Represents dependency parse tree information for atoken.

func (*DependencyEdge)MarshalJSON

func (s *DependencyEdge) MarshalJSON() ([]byte,error)

typeDocument

type Document struct {// Content: The content of the input in string format. Cloud audit// logging exempt since it is based on user data.Contentstring `json:"content,omitempty"`// GcsContentUri: 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.GcsContentUristring `json:"gcsContentUri,omitempty"`// Language: 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.Languagestring `json:"language,omitempty"`// Type: Required. If the type is not set or is `TYPE_UNSPECIFIED`,// returns an `INVALID_ARGUMENT` error.//// Possible values://   "TYPE_UNSPECIFIED" - The content type is not specified.//   "PLAIN_TEXT" - Plain text//   "HTML" - HTMLTypestring `json:"type,omitempty"`// ForceSendFields is a list of field names (e.g. "Content") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Content") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

Document: Represents the input to API methods.

func (*Document)MarshalJSON

func (s *Document) MarshalJSON() ([]byte,error)

typeDocumentsAnalyzeEntitiesCall

type DocumentsAnalyzeEntitiesCall struct {// contains filtered or unexported fields}

func (*DocumentsAnalyzeEntitiesCall)Context

Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.

func (*DocumentsAnalyzeEntitiesCall)Do

Do executes the "language.documents.analyzeEntities" call.Exactly one of *AnalyzeEntitiesResponse or error will be non-nil. Anynon-2xx status code is an error. Response headers are in either*AnalyzeEntitiesResponse.ServerResponse.Header or (if a response wasreturned at all) in error.(*googleapi.Error).Header. Usegoogleapi.IsNotModified to check whether the returned error wasbecause http.StatusNotModified was returned.

func (*DocumentsAnalyzeEntitiesCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.

func (*DocumentsAnalyzeEntitiesCall)Header

Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.

typeDocumentsAnalyzeSentimentCall

type DocumentsAnalyzeSentimentCall struct {// contains filtered or unexported fields}

func (*DocumentsAnalyzeSentimentCall)Context

Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.

func (*DocumentsAnalyzeSentimentCall)Do

Do executes the "language.documents.analyzeSentiment" call.Exactly one of *AnalyzeSentimentResponse or error will be non-nil.Any non-2xx status code is an error. Response headers are in either*AnalyzeSentimentResponse.ServerResponse.Header or (if a response wasreturned at all) in error.(*googleapi.Error).Header. Usegoogleapi.IsNotModified to check whether the returned error wasbecause http.StatusNotModified was returned.

func (*DocumentsAnalyzeSentimentCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.

func (*DocumentsAnalyzeSentimentCall)Header

Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.

typeDocumentsAnalyzeSyntaxCall

type DocumentsAnalyzeSyntaxCall struct {// contains filtered or unexported fields}

func (*DocumentsAnalyzeSyntaxCall)Context

Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.

func (*DocumentsAnalyzeSyntaxCall)Do

Do executes the "language.documents.analyzeSyntax" call.Exactly one of *AnalyzeSyntaxResponse or error will be non-nil. Anynon-2xx status code is an error. Response headers are in either*AnalyzeSyntaxResponse.ServerResponse.Header or (if a response wasreturned at all) in error.(*googleapi.Error).Header. Usegoogleapi.IsNotModified to check whether the returned error wasbecause http.StatusNotModified was returned.

func (*DocumentsAnalyzeSyntaxCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.

func (*DocumentsAnalyzeSyntaxCall)Header

Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.

typeDocumentsAnnotateTextCall

type DocumentsAnnotateTextCall struct {// contains filtered or unexported fields}

func (*DocumentsAnnotateTextCall)Context

Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.

func (*DocumentsAnnotateTextCall)Do

Do executes the "language.documents.annotateText" call.Exactly one of *AnnotateTextResponse or error will be non-nil. Anynon-2xx status code is an error. Response headers are in either*AnnotateTextResponse.ServerResponse.Header or (if a response wasreturned at all) in error.(*googleapi.Error).Header. Usegoogleapi.IsNotModified to check whether the returned error wasbecause http.StatusNotModified was returned.

func (*DocumentsAnnotateTextCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.

func (*DocumentsAnnotateTextCall)Header

Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.

typeDocumentsService

type DocumentsService struct {// contains filtered or unexported fields}

funcNewDocumentsService

func NewDocumentsService(s *Service) *DocumentsService

func (*DocumentsService)AnalyzeEntities

func (r *DocumentsService) AnalyzeEntities(analyzeentitiesrequest *AnalyzeEntitiesRequest) *DocumentsAnalyzeEntitiesCall

AnalyzeEntities: Finds named entities (currently proper names andcommon nouns) in the text along with entity types, salience, mentionsfor each entity, and other properties.

func (*DocumentsService)AnalyzeSentiment

func (r *DocumentsService) AnalyzeSentiment(analyzesentimentrequest *AnalyzeSentimentRequest) *DocumentsAnalyzeSentimentCall

AnalyzeSentiment: Analyzes the sentiment of the provided text.

func (*DocumentsService)AnalyzeSyntax

func (r *DocumentsService) AnalyzeSyntax(analyzesyntaxrequest *AnalyzeSyntaxRequest) *DocumentsAnalyzeSyntaxCall

AnalyzeSyntax: Analyzes the syntax of the text and provides sentenceboundaries and tokenization along with part of speech tags,dependency trees, and other properties.

func (*DocumentsService)AnnotateText

func (r *DocumentsService) AnnotateText(annotatetextrequest *AnnotateTextRequest) *DocumentsAnnotateTextCall

AnnotateText: A convenience method that provides all the featuresthat analyzeSentiment, analyzeEntities, and analyzeSyntax provide inone call.

typeEntity

type Entity struct {// Mentions: The mentions of this entity in the input document. The API// currently supports proper noun mentions.Mentions []*EntityMention `json:"mentions,omitempty"`// Metadata: 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.Metadata map[string]string `json:"metadata,omitempty"`// Name: The representative name for the entity.Namestring `json:"name,omitempty"`// Salience: 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.Saliencefloat64 `json:"salience,omitempty"`// Type: The entity type.//// Possible values://   "UNKNOWN" - Unknown//   "PERSON" - Person//   "LOCATION" - Location//   "ORGANIZATION" - Organization//   "EVENT" - Event//   "WORK_OF_ART" - Work of art//   "CONSUMER_GOOD" - Consumer goods//   "OTHER" - Other typesTypestring `json:"type,omitempty"`// ForceSendFields is a list of field names (e.g. "Mentions") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Mentions") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

Entity: Represents a phrase in the text that is a known entity, suchas a person, an organization, or location. The API associatesinformation, such as salience and mentions, with entities.

func (*Entity)MarshalJSON

func (s *Entity) MarshalJSON() ([]byte,error)

func (*Entity)UnmarshalJSON

func (s *Entity) UnmarshalJSON(data []byte)error

typeEntityMention

type EntityMention struct {// Text: The mention text.Text *TextSpan `json:"text,omitempty"`// Type: The type of the entity mention.//// Possible values://   "TYPE_UNKNOWN" - Unknown//   "PROPER" - Proper name//   "COMMON" - Common noun (or noun compound)Typestring `json:"type,omitempty"`// ForceSendFields is a list of field names (e.g. "Text") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Text") to include in API// requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

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

func (*EntityMention)MarshalJSON

func (s *EntityMention) MarshalJSON() ([]byte,error)

typeFeatures

type Features struct {// ExtractDocumentSentiment: Extract document-level sentiment.ExtractDocumentSentimentbool `json:"extractDocumentSentiment,omitempty"`// ExtractEntities: Extract entities.ExtractEntitiesbool `json:"extractEntities,omitempty"`// ExtractSyntax: Extract syntax information.ExtractSyntaxbool `json:"extractSyntax,omitempty"`// ForceSendFields is a list of field names (e.g.// "ExtractDocumentSentiment") to unconditionally include in API// requests. By default, fields with empty or default values are omitted// from API requests. However, any non-pointer, non-interface field// appearing in ForceSendFields will be sent to the server regardless of// whether the field is empty or not. This may be used to include empty// fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "ExtractDocumentSentiment")// to include in API requests with the JSON null value. By default,// fields with empty values are omitted from API requests. However, any// field with an empty value appearing in NullFields will be sent to the// server as null. It is an error if a field in this list has a// non-empty value. This may be used to include null fields in Patch// requests.NullFields []string `json:"-"`}

Features: All available features for sentiment, syntax, and semanticanalysis. Setting each one to true will enable that specific analysisfor the input.

func (*Features)MarshalJSON

func (s *Features) MarshalJSON() ([]byte,error)

typePartOfSpeech

type PartOfSpeech struct {// Aspect: The grammatical aspect.//// Possible values://   "ASPECT_UNKNOWN" - Aspect is not applicable in the analyzed// language or is not predicted.//   "PERFECTIVE" - Perfective//   "IMPERFECTIVE" - Imperfective//   "PROGRESSIVE" - ProgressiveAspectstring `json:"aspect,omitempty"`// Case: The grammatical case.//// Possible values://   "CASE_UNKNOWN" - Case is not applicable in the analyzed language or// is not predicted.//   "ACCUSATIVE" - Accusative//   "ADVERBIAL" - Adverbial//   "COMPLEMENTIVE" - Complementive//   "DATIVE" - Dative//   "GENITIVE" - Genitive//   "INSTRUMENTAL" - Instrumental//   "LOCATIVE" - Locative//   "NOMINATIVE" - Nominative//   "OBLIQUE" - Oblique//   "PARTITIVE" - Partitive//   "PREPOSITIONAL" - Prepositional//   "REFLEXIVE_CASE" - Reflexive//   "RELATIVE_CASE" - Relative//   "VOCATIVE" - VocativeCasestring `json:"case,omitempty"`// Form: The grammatical form.//// Possible values://   "FORM_UNKNOWN" - Form is not applicable in the analyzed language or// is not predicted.//   "ADNOMIAL" - Adnomial//   "AUXILIARY" - Auxiliary//   "COMPLEMENTIZER" - Complementizer//   "FINAL_ENDING" - Final ending//   "GERUND" - Gerund//   "REALIS" - Realis//   "IRREALIS" - Irrealis//   "SHORT" - Short form//   "LONG" - Long form//   "ORDER" - Order form//   "SPECIFIC" - Specific formFormstring `json:"form,omitempty"`// Gender: The grammatical gender.//// Possible values://   "GENDER_UNKNOWN" - Gender is not applicable in the analyzed// language or is not predicted.//   "FEMININE" - Feminine//   "MASCULINE" - Masculine//   "NEUTER" - NeuterGenderstring `json:"gender,omitempty"`// Mood: The grammatical mood.//// Possible values://   "MOOD_UNKNOWN" - Mood is not applicable in the analyzed language or// is not predicted.//   "CONDITIONAL_MOOD" - Conditional//   "IMPERATIVE" - Imperative//   "INDICATIVE" - Indicative//   "INTERROGATIVE" - Interrogative//   "JUSSIVE" - Jussive//   "SUBJUNCTIVE" - SubjunctiveMoodstring `json:"mood,omitempty"`// Number: The grammatical number.//// Possible values://   "NUMBER_UNKNOWN" - Number is not applicable in the analyzed// language or is not predicted.//   "SINGULAR" - Singular//   "PLURAL" - Plural//   "DUAL" - DualNumberstring `json:"number,omitempty"`// Person: The grammatical person.//// Possible values://   "PERSON_UNKNOWN" - Person is not applicable in the analyzed// language or is not predicted.//   "FIRST" - First//   "SECOND" - Second//   "THIRD" - Third//   "REFLEXIVE_PERSON" - ReflexivePersonstring `json:"person,omitempty"`// Proper: The grammatical properness.//// Possible values://   "PROPER_UNKNOWN" - Proper is not applicable in the analyzed// language or is not predicted.//   "PROPER" - Proper//   "NOT_PROPER" - Not properProperstring `json:"proper,omitempty"`// Reciprocity: The grammatical reciprocity.//// Possible values://   "RECIPROCITY_UNKNOWN" - Reciprocity is not applicable in the// analyzed language or is not predicted.//   "RECIPROCAL" - Reciprocal//   "NON_RECIPROCAL" - Non-reciprocalReciprocitystring `json:"reciprocity,omitempty"`// Tag: The part of speech tag.//// Possible values://   "UNKNOWN" - Unknown//   "ADJ" - Adjective//   "ADP" - Adposition (preposition and postposition)//   "ADV" - Adverb//   "CONJ" - Conjunction//   "DET" - Determiner//   "NOUN" - Noun (common and proper)//   "NUM" - Cardinal number//   "PRON" - Pronoun//   "PRT" - Particle or other function word//   "PUNCT" - Punctuation//   "VERB" - Verb (all tenses and modes)//   "X" - Other: foreign words, typos, abbreviations//   "AFFIX" - AffixTagstring `json:"tag,omitempty"`// Tense: The grammatical tense.//// Possible values://   "TENSE_UNKNOWN" - Tense is not applicable in the analyzed language// or is not predicted.//   "CONDITIONAL_TENSE" - Conditional//   "FUTURE" - Future//   "PAST" - Past//   "PRESENT" - Present//   "IMPERFECT" - Imperfect//   "PLUPERFECT" - PluperfectTensestring `json:"tense,omitempty"`// Voice: The grammatical voice.//// Possible values://   "VOICE_UNKNOWN" - Voice is not applicable in the analyzed language// or is not predicted.//   "ACTIVE" - Active//   "CAUSATIVE" - Causative//   "PASSIVE" - PassiveVoicestring `json:"voice,omitempty"`// ForceSendFields is a list of field names (e.g. "Aspect") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Aspect") to include in API// requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

PartOfSpeech: Represents part of speech information for a token.

func (*PartOfSpeech)MarshalJSON

func (s *PartOfSpeech) MarshalJSON() ([]byte,error)

typeSentence

type Sentence struct {// Sentiment: For calls to AnalyzeSentiment or if// AnnotateTextRequest.Features.extract_document_sentiment is set to// true, this field will contain the sentiment for the sentence.Sentiment *Sentiment `json:"sentiment,omitempty"`// Text: The sentence text.Text *TextSpan `json:"text,omitempty"`// ForceSendFields is a list of field names (e.g. "Sentiment") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Sentiment") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

Sentence: Represents a sentence in the input document.

func (*Sentence)MarshalJSON

func (s *Sentence) MarshalJSON() ([]byte,error)

typeSentiment

type Sentiment struct {// Magnitude: A non-negative number in the [0, +inf) range, which// represents the absolute magnitude of sentiment regardless of score// (positive or negative).Magnitudefloat64 `json:"magnitude,omitempty"`// Polarity: DEPRECATED 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.Polarityfloat64 `json:"polarity,omitempty"`// Score: Sentiment score between -1.0 (negative sentiment) and 1.0// (positive sentiment).Scorefloat64 `json:"score,omitempty"`// ForceSendFields is a list of field names (e.g. "Magnitude") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Magnitude") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

Sentiment: Represents the feeling associated with the entire text orentities in the text.

func (*Sentiment)MarshalJSON

func (s *Sentiment) MarshalJSON() ([]byte,error)

func (*Sentiment)UnmarshalJSON

func (s *Sentiment) UnmarshalJSON(data []byte)error

typeService

type Service struct {BasePathstring// API endpoint base URLUserAgentstring// optional additional User-Agent fragmentDocuments *DocumentsService// contains filtered or unexported fields}

funcNewdeprecated

func New(client *http.Client) (*Service,error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead.To provide a custom HTTP client, use option.WithHTTPClient.If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

funcNewServiceadded inv0.3.0

func NewService(ctxcontext.Context, opts ...option.ClientOption) (*Service,error)

NewService creates a new Service.

typeStatus

type Status struct {// Code: The status code, which should be an enum value of// google.rpc.Code.Codeint64 `json:"code,omitempty"`// Details: A list of messages that carry the error details. There is a// common set of message types for APIs to use.Details []googleapi.RawMessage `json:"details,omitempty"`// Message: A developer-facing error message, which should be in// English. Any user-facing error message should be localized and sent// in the google.rpc.Status.details field, or localized by the client.Messagestring `json:"message,omitempty"`// ForceSendFields is a list of field names (e.g. "Code") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Code") to include in API// requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

Status: The `Status` type defines a logical error model that issuitable for different programming environments, including REST APIsand RPC APIs. It is used by gRPC (https://github.com/grpc). Each`Status` message contains three pieces of data: error code, errormessage, and error details. You can find out more about this errormodel and how to work with it in the API Design Guide(https://cloud.google.com/apis/design/errors).

func (*Status)MarshalJSON

func (s *Status) MarshalJSON() ([]byte,error)

typeTextSpan

type TextSpan struct {// BeginOffset: The API calculates the beginning offset of the content// in the original document according to the EncodingType specified in// the API request.BeginOffsetint64 `json:"beginOffset,omitempty"`// Content: The content of the output text.Contentstring `json:"content,omitempty"`// ForceSendFields is a list of field names (e.g. "BeginOffset") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "BeginOffset") to include// in API requests with the JSON null value. By default, fields with// empty values are omitted from API requests. However, any field with// an empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

TextSpan: Represents an output piece of text.

func (*TextSpan)MarshalJSON

func (s *TextSpan) MarshalJSON() ([]byte,error)

typeToken

type Token struct {// DependencyEdge: Dependency tree parse for this token.DependencyEdge *DependencyEdge `json:"dependencyEdge,omitempty"`// Lemma: Lemma (https://en.wikipedia.org/wiki/Lemma_%28morphology%29)// of the token.Lemmastring `json:"lemma,omitempty"`// PartOfSpeech: Parts of speech tag for this token.PartOfSpeech *PartOfSpeech `json:"partOfSpeech,omitempty"`// Text: The token text.Text *TextSpan `json:"text,omitempty"`// ForceSendFields is a list of field names (e.g. "DependencyEdge") to// unconditionally include in API requests. By default, fields with// empty or default values are omitted from API requests. However, any// non-pointer, non-interface field appearing in ForceSendFields will be// sent to the server regardless of whether the field is empty or not.// This may be used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "DependencyEdge") to// include in API requests with the JSON null value. By default, fields// with empty values are omitted from API requests. However, any field// with an empty value appearing in NullFields will be sent to the// server as null. It is an error if a field in this list has a// non-empty value. This may be used to include null fields in Patch// requests.NullFields []string `json:"-"`}

Token: Represents the smallest syntactic building block of the text.

func (*Token)MarshalJSON

func (s *Token) MarshalJSON() ([]byte,error)

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp