@google-cloud/language
Version:
Google Cloud Natural Language API client for Node.js
970 lines (795 loc) • 770 kB
TypeScript
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import type {protobuf as $protobuf} from "google-gax";
import Long = require("long");
/** Namespace google. */
export namespace google {
/** Namespace cloud. */
namespace cloud {
/** Namespace language. */
namespace language {
/** Namespace v1. */
namespace v1 {
/** Represents a LanguageService */
class LanguageService extends $protobuf.rpc.Service {
/**
* Constructs a new LanguageService service.
* @param rpcImpl RPC implementation
* @param [requestDelimited=false] Whether requests are length-delimited
* @param [responseDelimited=false] Whether responses are length-delimited
*/
constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
/**
* Creates new LanguageService service using the specified rpc implementation.
* @param rpcImpl RPC implementation
* @param [requestDelimited=false] Whether requests are length-delimited
* @param [responseDelimited=false] Whether responses are length-delimited
* @returns RPC service. Useful where requests and/or responses are streamed.
*/
public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): LanguageService;
/**
* Calls AnalyzeSentiment.
* @param request AnalyzeSentimentRequest message or plain object
* @param callback Node-style callback called with the error, if any, and AnalyzeSentimentResponse
*/
public analyzeSentiment(request: google.cloud.language.v1.IAnalyzeSentimentRequest, callback: google.cloud.language.v1.LanguageService.AnalyzeSentimentCallback): void;
/**
* Calls AnalyzeSentiment.
* @param request AnalyzeSentimentRequest message or plain object
* @returns Promise
*/
public analyzeSentiment(request: google.cloud.language.v1.IAnalyzeSentimentRequest): Promise<google.cloud.language.v1.AnalyzeSentimentResponse>;
/**
* Calls AnalyzeEntities.
* @param request AnalyzeEntitiesRequest message or plain object
* @param callback Node-style callback called with the error, if any, and AnalyzeEntitiesResponse
*/
public analyzeEntities(request: google.cloud.language.v1.IAnalyzeEntitiesRequest, callback: google.cloud.language.v1.LanguageService.AnalyzeEntitiesCallback): void;
/**
* Calls AnalyzeEntities.
* @param request AnalyzeEntitiesRequest message or plain object
* @returns Promise
*/
public analyzeEntities(request: google.cloud.language.v1.IAnalyzeEntitiesRequest): Promise<google.cloud.language.v1.AnalyzeEntitiesResponse>;
/**
* Calls AnalyzeEntitySentiment.
* @param request AnalyzeEntitySentimentRequest message or plain object
* @param callback Node-style callback called with the error, if any, and AnalyzeEntitySentimentResponse
*/
public analyzeEntitySentiment(request: google.cloud.language.v1.IAnalyzeEntitySentimentRequest, callback: google.cloud.language.v1.LanguageService.AnalyzeEntitySentimentCallback): void;
/**
* Calls AnalyzeEntitySentiment.
* @param request AnalyzeEntitySentimentRequest message or plain object
* @returns Promise
*/
public analyzeEntitySentiment(request: google.cloud.language.v1.IAnalyzeEntitySentimentRequest): Promise<google.cloud.language.v1.AnalyzeEntitySentimentResponse>;
/**
* Calls AnalyzeSyntax.
* @param request AnalyzeSyntaxRequest message or plain object
* @param callback Node-style callback called with the error, if any, and AnalyzeSyntaxResponse
*/
public analyzeSyntax(request: google.cloud.language.v1.IAnalyzeSyntaxRequest, callback: google.cloud.language.v1.LanguageService.AnalyzeSyntaxCallback): void;
/**
* Calls AnalyzeSyntax.
* @param request AnalyzeSyntaxRequest message or plain object
* @returns Promise
*/
public analyzeSyntax(request: google.cloud.language.v1.IAnalyzeSyntaxRequest): Promise<google.cloud.language.v1.AnalyzeSyntaxResponse>;
/**
* Calls ClassifyText.
* @param request ClassifyTextRequest message or plain object
* @param callback Node-style callback called with the error, if any, and ClassifyTextResponse
*/
public classifyText(request: google.cloud.language.v1.IClassifyTextRequest, callback: google.cloud.language.v1.LanguageService.ClassifyTextCallback): void;
/**
* Calls ClassifyText.
* @param request ClassifyTextRequest message or plain object
* @returns Promise
*/
public classifyText(request: google.cloud.language.v1.IClassifyTextRequest): Promise<google.cloud.language.v1.ClassifyTextResponse>;
/**
* Calls ModerateText.
* @param request ModerateTextRequest message or plain object
* @param callback Node-style callback called with the error, if any, and ModerateTextResponse
*/
public moderateText(request: google.cloud.language.v1.IModerateTextRequest, callback: google.cloud.language.v1.LanguageService.ModerateTextCallback): void;
/**
* Calls ModerateText.
* @param request ModerateTextRequest message or plain object
* @returns Promise
*/
public moderateText(request: google.cloud.language.v1.IModerateTextRequest): Promise<google.cloud.language.v1.ModerateTextResponse>;
/**
* Calls AnnotateText.
* @param request AnnotateTextRequest message or plain object
* @param callback Node-style callback called with the error, if any, and AnnotateTextResponse
*/
public annotateText(request: google.cloud.language.v1.IAnnotateTextRequest, callback: google.cloud.language.v1.LanguageService.AnnotateTextCallback): void;
/**
* Calls AnnotateText.
* @param request AnnotateTextRequest message or plain object
* @returns Promise
*/
public annotateText(request: google.cloud.language.v1.IAnnotateTextRequest): Promise<google.cloud.language.v1.AnnotateTextResponse>;
}
namespace LanguageService {
/**
* Callback as used by {@link google.cloud.language.v1.LanguageService|analyzeSentiment}.
* @param error Error, if any
* @param [response] AnalyzeSentimentResponse
*/
type AnalyzeSentimentCallback = (error: (Error|null), response?: google.cloud.language.v1.AnalyzeSentimentResponse) => void;
/**
* Callback as used by {@link google.cloud.language.v1.LanguageService|analyzeEntities}.
* @param error Error, if any
* @param [response] AnalyzeEntitiesResponse
*/
type AnalyzeEntitiesCallback = (error: (Error|null), response?: google.cloud.language.v1.AnalyzeEntitiesResponse) => void;
/**
* Callback as used by {@link google.cloud.language.v1.LanguageService|analyzeEntitySentiment}.
* @param error Error, if any
* @param [response] AnalyzeEntitySentimentResponse
*/
type AnalyzeEntitySentimentCallback = (error: (Error|null), response?: google.cloud.language.v1.AnalyzeEntitySentimentResponse) => void;
/**
* Callback as used by {@link google.cloud.language.v1.LanguageService|analyzeSyntax}.
* @param error Error, if any
* @param [response] AnalyzeSyntaxResponse
*/
type AnalyzeSyntaxCallback = (error: (Error|null), response?: google.cloud.language.v1.AnalyzeSyntaxResponse) => void;
/**
* Callback as used by {@link google.cloud.language.v1.LanguageService|classifyText}.
* @param error Error, if any
* @param [response] ClassifyTextResponse
*/
type ClassifyTextCallback = (error: (Error|null), response?: google.cloud.language.v1.ClassifyTextResponse) => void;
/**
* Callback as used by {@link google.cloud.language.v1.LanguageService|moderateText}.
* @param error Error, if any
* @param [response] ModerateTextResponse
*/
type ModerateTextCallback = (error: (Error|null), response?: google.cloud.language.v1.ModerateTextResponse) => void;
/**
* Callback as used by {@link google.cloud.language.v1.LanguageService|annotateText}.
* @param error Error, if any
* @param [response] AnnotateTextResponse
*/
type AnnotateTextCallback = (error: (Error|null), response?: google.cloud.language.v1.AnnotateTextResponse) => void;
}
/** Properties of a Document. */
interface IDocument {
/** Document type */
type?: (google.cloud.language.v1.Document.Type|keyof typeof google.cloud.language.v1.Document.Type|null);
/** Document content */
content?: (string|null);
/** Document gcsContentUri */
gcsContentUri?: (string|null);
/** Document language */
language?: (string|null);
}
/** Represents a Document. */
class Document implements IDocument {
/**
* Constructs a new Document.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.language.v1.IDocument);
/** Document type. */
public type: (google.cloud.language.v1.Document.Type|keyof typeof google.cloud.language.v1.Document.Type);
/** Document content. */
public content?: (string|null);
/** Document gcsContentUri. */
public gcsContentUri?: (string|null);
/** Document language. */
public language: string;
/** Document source. */
public source?: ("content"|"gcsContentUri");
/**
* Creates a new Document instance using the specified properties.
* @param [properties] Properties to set
* @returns Document instance
*/
public static create(properties?: google.cloud.language.v1.IDocument): google.cloud.language.v1.Document;
/**
* Encodes the specified Document message. Does not implicitly {@link google.cloud.language.v1.Document.verify|verify} messages.
* @param message Document message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.language.v1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.language.v1.Document.verify|verify} messages.
* @param message Document message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.language.v1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Document message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Document
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.language.v1.Document;
/**
* Decodes a Document message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Document
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.language.v1.Document;
/**
* Verifies a Document message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a Document message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Document
*/
public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.Document;
/**
* Creates a plain object from a Document message. Also converts values to other types if specified.
* @param message Document
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.language.v1.Document, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Document to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Document
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
namespace Document {
/** Type enum. */
enum Type {
TYPE_UNSPECIFIED = 0,
PLAIN_TEXT = 1,
HTML = 2
}
}
/** Properties of a Sentence. */
interface ISentence {
/** Sentence text */
text?: (google.cloud.language.v1.ITextSpan|null);
/** Sentence sentiment */
sentiment?: (google.cloud.language.v1.ISentiment|null);
}
/** Represents a Sentence. */
class Sentence implements ISentence {
/**
* Constructs a new Sentence.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.language.v1.ISentence);
/** Sentence text. */
public text?: (google.cloud.language.v1.ITextSpan|null);
/** Sentence sentiment. */
public sentiment?: (google.cloud.language.v1.ISentiment|null);
/**
* Creates a new Sentence instance using the specified properties.
* @param [properties] Properties to set
* @returns Sentence instance
*/
public static create(properties?: google.cloud.language.v1.ISentence): google.cloud.language.v1.Sentence;
/**
* Encodes the specified Sentence message. Does not implicitly {@link google.cloud.language.v1.Sentence.verify|verify} messages.
* @param message Sentence message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.language.v1.ISentence, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Sentence message, length delimited. Does not implicitly {@link google.cloud.language.v1.Sentence.verify|verify} messages.
* @param message Sentence message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.language.v1.ISentence, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Sentence message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Sentence
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.language.v1.Sentence;
/**
* Decodes a Sentence message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Sentence
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.language.v1.Sentence;
/**
* Verifies a Sentence message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a Sentence message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Sentence
*/
public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.Sentence;
/**
* Creates a plain object from a Sentence message. Also converts values to other types if specified.
* @param message Sentence
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.language.v1.Sentence, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Sentence to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Sentence
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** EncodingType enum. */
enum EncodingType {
NONE = 0,
UTF8 = 1,
UTF16 = 2,
UTF32 = 3
}
/** Properties of an Entity. */
interface IEntity {
/** Entity name */
name?: (string|null);
/** Entity type */
type?: (google.cloud.language.v1.Entity.Type|keyof typeof google.cloud.language.v1.Entity.Type|null);
/** Entity metadata */
metadata?: ({ [k: string]: string }|null);
/** Entity salience */
salience?: (number|null);
/** Entity mentions */
mentions?: (google.cloud.language.v1.IEntityMention[]|null);
/** Entity sentiment */
sentiment?: (google.cloud.language.v1.ISentiment|null);
}
/** Represents an Entity. */
class Entity implements IEntity {
/**
* Constructs a new Entity.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.language.v1.IEntity);
/** Entity name. */
public name: string;
/** Entity type. */
public type: (google.cloud.language.v1.Entity.Type|keyof typeof google.cloud.language.v1.Entity.Type);
/** Entity metadata. */
public metadata: { [k: string]: string };
/** Entity salience. */
public salience: number;
/** Entity mentions. */
public mentions: google.cloud.language.v1.IEntityMention[];
/** Entity sentiment. */
public sentiment?: (google.cloud.language.v1.ISentiment|null);
/**
* Creates a new Entity instance using the specified properties.
* @param [properties] Properties to set
* @returns Entity instance
*/
public static create(properties?: google.cloud.language.v1.IEntity): google.cloud.language.v1.Entity;
/**
* Encodes the specified Entity message. Does not implicitly {@link google.cloud.language.v1.Entity.verify|verify} messages.
* @param message Entity message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.language.v1.IEntity, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.language.v1.Entity.verify|verify} messages.
* @param message Entity message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.language.v1.IEntity, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes an Entity message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Entity
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.language.v1.Entity;
/**
* Decodes an Entity message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Entity
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.language.v1.Entity;
/**
* Verifies an Entity message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates an Entity message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Entity
*/
public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.Entity;
/**
* Creates a plain object from an Entity message. Also converts values to other types if specified.
* @param message Entity
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.language.v1.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Entity to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Entity
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
namespace Entity {
/** Type enum. */
enum 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
}
}
/** Properties of a Token. */
interface IToken {
/** Token text */
text?: (google.cloud.language.v1.ITextSpan|null);
/** Token partOfSpeech */
partOfSpeech?: (google.cloud.language.v1.IPartOfSpeech|null);
/** Token dependencyEdge */
dependencyEdge?: (google.cloud.language.v1.IDependencyEdge|null);
/** Token lemma */
lemma?: (string|null);
}
/** Represents a Token. */
class Token implements IToken {
/**
* Constructs a new Token.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.language.v1.IToken);
/** Token text. */
public text?: (google.cloud.language.v1.ITextSpan|null);
/** Token partOfSpeech. */
public partOfSpeech?: (google.cloud.language.v1.IPartOfSpeech|null);
/** Token dependencyEdge. */
public dependencyEdge?: (google.cloud.language.v1.IDependencyEdge|null);
/** Token lemma. */
public lemma: string;
/**
* Creates a new Token instance using the specified properties.
* @param [properties] Properties to set
* @returns Token instance
*/
public static create(properties?: google.cloud.language.v1.IToken): google.cloud.language.v1.Token;
/**
* Encodes the specified Token message. Does not implicitly {@link google.cloud.language.v1.Token.verify|verify} messages.
* @param message Token message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.language.v1.IToken, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.language.v1.Token.verify|verify} messages.
* @param message Token message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.language.v1.IToken, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Token message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Token
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.language.v1.Token;
/**
* Decodes a Token message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Token
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.language.v1.Token;
/**
* Verifies a Token message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a Token message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Token
*/
public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.Token;
/**
* Creates a plain object from a Token message. Also converts values to other types if specified.
* @param message Token
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.language.v1.Token, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Token to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Token
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a Sentiment. */
interface ISentiment {
/** Sentiment magnitude */
magnitude?: (number|null);
/** Sentiment score */
score?: (number|null);
}
/** Represents a Sentiment. */
class Sentiment implements ISentiment {
/**
* Constructs a new Sentiment.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.language.v1.ISentiment);
/** Sentiment magnitude. */
public magnitude: number;
/** Sentiment score. */
public score: number;
/**
* Creates a new Sentiment instance using the specified properties.
* @param [properties] Properties to set
* @returns Sentiment instance
*/
public static create(properties?: google.cloud.language.v1.ISentiment): google.cloud.language.v1.Sentiment;
/**
* Encodes the specified Sentiment message. Does not implicitly {@link google.cloud.language.v1.Sentiment.verify|verify} messages.
* @param message Sentiment message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.language.v1.ISentiment, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Sentiment message, length delimited. Does not implicitly {@link google.cloud.language.v1.Sentiment.verify|verify} messages.
* @param message Sentiment message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.language.v1.ISentiment, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Sentiment message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Sentiment
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.language.v1.Sentiment;
/**
* Decodes a Sentiment message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Sentiment
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.language.v1.Sentiment;
/**
* Verifies a Sentiment message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a Sentiment message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Sentiment
*/
public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.Sentiment;
/**
* Creates a plain object from a Sentiment message. Also converts values to other types if specified.
* @param message Sentiment
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.language.v1.Sentiment, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Sentiment to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Sentiment
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a PartOfSpeech. */
interface IPartOfSpeech {
/** PartOfSpeech tag */
tag?: (google.cloud.language.v1.PartOfSpeech.Tag|keyof typeof google.cloud.language.v1.PartOfSpeech.Tag|null);
/** PartOfSpeech aspect */
aspect?: (google.cloud.language.v1.PartOfSpeech.Aspect|keyof typeof google.cloud.language.v1.PartOfSpeech.Aspect|null);
/** PartOfSpeech case */
"case"?: (google.cloud.language.v1.PartOfSpeech.Case|keyof typeof google.cloud.language.v1.PartOfSpeech.Case|null);
/** PartOfSpeech form */
form?: (google.cloud.language.v1.PartOfSpeech.Form|keyof typeof google.cloud.language.v1.PartOfSpeech.Form|null);
/** PartOfSpeech gender */
gender?: (google.cloud.language.v1.PartOfSpeech.Gender|keyof typeof google.cloud.language.v1.PartOfSpeech.Gender|null);
/** PartOfSpeech mood */
mood?: (google.cloud.language.v1.PartOfSpeech.Mood|keyof typeof google.cloud.language.v1.PartOfSpeech.Mood|null);
/** PartOfSpeech number */
number?: (google.cloud.language.v1.PartOfSpeech.Number|keyof typeof google.cloud.language.v1.PartOfSpeech.Number|null);
/** PartOfSpeech person */
person?: (google.cloud.language.v1.PartOfSpeech.Person|keyof typeof google.cloud.language.v1.PartOfSpeech.Person|null);
/** PartOfSpeech proper */
proper?: (google.cloud.language.v1.PartOfSpeech.Proper|keyof typeof google.cloud.language.v1.PartOfSpeech.Proper|null);
/** PartOfSpeech reciprocity */
reciprocity?: (google.cloud.language.v1.PartOfSpeech.Reciprocity|keyof typeof google.cloud.language.v1.PartOfSpeech.Reciprocity|null);
/** PartOfSpeech tense */
tense?: (google.cloud.language.v1.PartOfSpeech.Tense|keyof typeof google.cloud.language.v1.PartOfSpeech.Tense|null);
/** PartOfSpeech voice */
voice?: (google.cloud.language.v1.PartOfSpeech.Voice|keyof typeof google.cloud.language.v1.PartOfSpeech.Voice|null);
}
/** Represents a PartOfSpeech. */
class PartOfSpeech implements IPartOfSpeech {
/**
* Constructs a new PartOfSpeech.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.language.v1.IPartOfSpeech);
/** PartOfSpeech tag. */
public tag: (google.cloud.language.v1.PartOfSpeech.Tag|keyof typeof google.cloud.language.v1.PartOfSpeech.Tag);
/** PartOfSpeech aspect. */
public aspect: (google.cloud.language.v1.PartOfSpeech.Aspect|keyof typeof google.cloud.language.v1.PartOfSpeech.Aspect);
/** PartOfSpeech case. */
public case: (google.cloud.language.v1.PartOfSpeech.Case|keyof typeof google.cloud.language.v1.PartOfSpeech.Case);
/** PartOfSpeech form. */
public form: (google.cloud.language.v1.PartOfSpeech.Form|keyof typeof google.cloud.language.v1.PartOfSpeech.Form);
/** PartOfSpeech gender. */
public gender: (google.cloud.language.v1.PartOfSpeech.Gender|keyof typeof google.cloud.language.v1.PartOfSpeech.Gender);
/** PartOfSpeech mood. */
public mood: (google.cloud.language.v1.PartOfSpeech.Mood|keyof typeof google.cloud.language.v1.PartOfSpeech.Mood);
/** PartOfSpeech number. */
public number: (google.cloud.language.v1.PartOfSpeech.Number|keyof typeof google.cloud.language.v1.PartOfSpeech.Number);
/** PartOfSpeech person. */
public person: (google.cloud.language.v1.PartOfSpeech.Person|keyof typeof google.cloud.language.v1.PartOfSpeech.Person);
/** PartOfSpeech proper. */
public proper: (google.cloud.language.v1.PartOfSpeech.Proper|keyof typeof google.cloud.language.v1.PartOfSpeech.Proper);
/** PartOfSpeech reciprocity. */
public reciprocity: (google.cloud.language.v1.PartOfSpeech.Reciprocity|keyof typeof google.cloud.language.v1.PartOfSpeech.Reciprocity);
/** PartOfSpeech tense. */
public tense: (google.cloud.language.v1.PartOfSpeech.Tense|keyof typeof google.cloud.language.v1.PartOfSpeech.Tense);
/** PartOfSpeech voice. */
public voice: (google.cloud.language.v1.PartOfSpeech.Voice|keyof typeof google.cloud.language.v1.PartOfSpeech.Voice);
/**
* Creates a new PartOfSpeech instance using the specified properties.
* @param [properties] Properties to set
* @returns PartOfSpeech instance
*/
public static create(properties?: google.cloud.language.v1.IPartOfSpeech): google.cloud.language.v1.PartOfSpeech;
/**
* Encodes the specified PartOfSpeech message. Does not implicitly {@link google.cloud.language.v1.PartOfSpeech.verify|verify} messages.
* @param message PartOfSpeech message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.language.v1.IPartOfSpeech, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified PartOfSpeech message, length delimited. Does not implicitly {@link google.cloud.language.v1.PartOfSpeech.verify|verify} messages.
* @param message PartOfSpeech message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.language.v1.IPartOfSpeech, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a PartOfSpeech message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns PartOfSpeech
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.language.v1.PartOfSpeech;
/**
* Decodes a PartOfSpeech message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns PartOfSpeech
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.language.v1.PartOfSpeech;
/**
* Verifies a PartOfSpeech message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a PartOfSpeech message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns PartOfSpeech
*/
public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.PartOfSpeech;
/**
* Creates a plain object from a PartOfSpeech message. Also converts values to other types if specified.
* @param message PartOfSpeech
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.language.v1.PartOfSpeech, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this PartOfSpeech to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for PartOfSpeech
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
namespace PartOfSpeech {
/** Tag enum. */
enum Tag