diff --git a/packages/google-cloud-language/protos/google/cloud/language/v1/language_service.proto b/packages/google-cloud-language/protos/google/cloud/language/v1/language_service.proto index 304eab073a3..06c68a27935 100644 --- a/packages/google-cloud-language/protos/google/cloud/language/v1/language_service.proto +++ b/packages/google-cloud-language/protos/google/cloud/language/v1/language_service.proto @@ -11,7 +11,6 @@ // 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. -// syntax = "proto3"; @@ -26,16 +25,17 @@ option java_multiple_files = true; option java_outer_classname = "LanguageServiceProto"; option java_package = "com.google.cloud.language.v1"; - // Provides text analysis operations such as sentiment analysis and entity // recognition. service LanguageService { option (google.api.default_host) = "language.googleapis.com"; option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-language," - "https://www.googleapis.com/auth/cloud-platform"; + "https://www.googleapis.com/auth/cloud-language," + "https://www.googleapis.com/auth/cloud-platform"; + // Analyzes the sentiment of the provided text. - rpc AnalyzeSentiment(AnalyzeSentimentRequest) returns (AnalyzeSentimentResponse) { + rpc AnalyzeSentiment(AnalyzeSentimentRequest) + returns (AnalyzeSentimentResponse) { option (google.api.http) = { post: "/v1/documents:analyzeSentiment" body: "*" @@ -47,7 +47,8 @@ service LanguageService { // Finds named entities (currently proper names and common nouns) in the text // along with entity types, salience, mentions for each entity, and // other properties. - rpc AnalyzeEntities(AnalyzeEntitiesRequest) returns (AnalyzeEntitiesResponse) { + rpc AnalyzeEntities(AnalyzeEntitiesRequest) + returns (AnalyzeEntitiesResponse) { option (google.api.http) = { post: "/v1/documents:analyzeEntities" body: "*" @@ -56,9 +57,12 @@ service LanguageService { option (google.api.method_signature) = "document"; } - // Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes - // sentiment associated with each entity and its mentions. - rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) returns (AnalyzeEntitySentimentResponse) { + // Finds entities, similar to + // [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] + // in the text and analyzes sentiment associated with each entity and its + // mentions. + rpc AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest) + returns (AnalyzeEntitySentimentResponse) { option (google.api.http) = { post: "/v1/documents:analyzeEntitySentiment" body: "*" @@ -100,7 +104,7 @@ service LanguageService { } } - +// ################################################################ # // // Represents the input to API methods. message Document { @@ -151,11 +155,37 @@ message Sentence { TextSpan text = 1; // For calls to [AnalyzeSentiment][] or if - // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] is set to - // true, this field will contain the sentiment for the sentence. + // [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment] + // is set to true, this field will contain the sentiment for the sentence. Sentiment sentiment = 2; } +// 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. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 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. + UTF8 = 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. + UTF16 = 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. + UTF32 = 3; +} + // Represents a phrase in the text that is a known entity, such as // a person, an organization, or location. The API associates information, such // as salience and mentions, with entities. @@ -189,44 +219,53 @@ message Entity { // Other types of entities OTHER = 7; - // Phone number

+ // Phone number + // // The metadata lists the phone number, formatted according to local - // convention, plus whichever additional elements appear in the text: + // 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 PHONE_NUMBER = 9; - // Address

+ // Address + // // The metadata identifies the street number and locality plus whichever - // additional elements appear in the text: + // 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 ADDRESS = 10; - // Date

- // The metadata identifies the components of the date: + // 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 DATE = 11; - // Number

+ // Number + // // The metadata is the number itself. NUMBER = 12; - // Price

- // The metadata identifies the value and currency. + // Price + // + // The metadata identifies the `value` and `currency`. PRICE = 13; } @@ -256,38 +295,12 @@ message Entity { repeated EntityMention mentions = 5; // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] is set to - // true, this field will contain the aggregate sentiment expressed for this - // entity in the provided document. + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entity_sentiment] + // is set to true, this field will contain the aggregate sentiment expressed + // for this entity in the provided document. Sentiment sentiment = 6; } -// 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. -enum EncodingType { - // If `EncodingType` is not specified, encoding-dependent information (such as - // `begin_offset`) will be set at `-1`. - NONE = 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. - UTF8 = 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. - UTF16 = 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. - UTF32 = 3; -} - // Represents the smallest syntactic building block of the text. message Token { // The token text. @@ -935,9 +948,9 @@ message EntityMention { Type type = 2; // For calls to [AnalyzeEntitySentiment][] or if - // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.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. + // [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1.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 = 3; } @@ -947,7 +960,9 @@ message TextSpan { string content = 1; // The API calculates the beginning offset of the content in the original - // document according to the [EncodingType][google.cloud.language.v1.EncodingType] specified in the API request. + // document according to the + // [EncodingType][google.cloud.language.v1.EncodingType] specified in the API + // request. int32 begin_offset = 2; } @@ -962,9 +977,46 @@ message ClassificationCategory { float confidence = 2; } +// Model options available for classification requests. +message ClassificationModelOptions { + // Options for the V1 model. + message V1Model {} + + // Options for the V2 model. + message V2Model { + // The content categories used for classification. + enum ContentCategoriesVersion { + // If `ContentCategoriesVersion` is not specified, this option will + // default to `V1`. + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + + // Legacy content categories of our initial launch in 2017. + V1 = 1; + + // Updated content categories in 2022. + V2 = 2; + } + + // The content categories used for classification. + ContentCategoriesVersion content_categories_version = 1; + } + + // If this field is not set, then the `v1_model` will be used by default. + oneof model_type { + // Setting this field will use the V1 model and V1 content categories + // version. The V1 model is a legacy model; support for this will be + // discontinued in the future. + V1Model v1_model = 1; + + // Setting this field will use the V2 model with the appropriate content + // categories version. The V2 model is a better performing model. + V2Model v2_model = 2; + } +} + // The sentiment analysis request message. message AnalyzeSentimentRequest { - // Input document. + // Required. Input document. Document document = 1 [(google.api.field_behavior) = REQUIRED]; // The encoding type used by the API to calculate sentence offsets. @@ -978,7 +1030,8 @@ message AnalyzeSentimentResponse { // 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][google.cloud.language.v1.Document.language] field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. string language = 2; // The sentiment for all the sentences in the document. @@ -987,7 +1040,7 @@ message AnalyzeSentimentResponse { // The entity-level sentiment analysis request message. message AnalyzeEntitySentimentRequest { - // Input document. + // Required. Input document. Document document = 1 [(google.api.field_behavior) = REQUIRED]; // The encoding type used by the API to calculate offsets. @@ -1001,13 +1054,14 @@ message AnalyzeEntitySentimentResponse { // 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][google.cloud.language.v1.Document.language] field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. string language = 2; } // The entity analysis request message. message AnalyzeEntitiesRequest { - // Input document. + // Required. Input document. Document document = 1 [(google.api.field_behavior) = REQUIRED]; // The encoding type used by the API to calculate offsets. @@ -1021,13 +1075,14 @@ message AnalyzeEntitiesResponse { // 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][google.cloud.language.v1.Document.language] field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. string language = 2; } // The syntax analysis request message. message AnalyzeSyntaxRequest { - // Input document. + // Required. Input document. Document document = 1 [(google.api.field_behavior) = REQUIRED]; // The encoding type used by the API to calculate offsets. @@ -1044,14 +1099,19 @@ message AnalyzeSyntaxResponse { // 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][google.cloud.language.v1.Document.language] field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. string language = 3; } // The document classification request message. message ClassifyTextRequest { - // Input document. + // Required. Input document. Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Model options to use for classification. Defaults to v1 options if not + // specified. + ClassificationModelOptions classification_model_options = 3; } // The document classification response message. @@ -1080,12 +1140,16 @@ message AnnotateTextRequest { // Classify the full document into categories. bool classify_text = 6; + + // The model options to use for classification. Defaults to v1 options + // if not specified. Only used if `classify_text` is set to true. + ClassificationModelOptions classification_model_options = 10; } - // Input document. + // Required. Input document. Document document = 1 [(google.api.field_behavior) = REQUIRED]; - // The enabled features. + // Required. The enabled features. Features features = 2 [(google.api.field_behavior) = REQUIRED]; // The encoding type used by the API to calculate offsets. @@ -1114,7 +1178,8 @@ message AnnotateTextResponse { // 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][google.cloud.language.v1.Document.language] field for more details. + // See [Document.language][google.cloud.language.v1.Document.language] field + // for more details. string language = 5; // Categories identified in the input document. diff --git a/packages/google-cloud-language/protos/google/cloud/language/v1beta2/language_service.proto b/packages/google-cloud-language/protos/google/cloud/language/v1beta2/language_service.proto index 7d77376e985..fd51d48652d 100644 --- a/packages/google-cloud-language/protos/google/cloud/language/v1beta2/language_service.proto +++ b/packages/google-cloud-language/protos/google/cloud/language/v1beta2/language_service.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // 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. -// syntax = "proto3"; @@ -68,7 +67,7 @@ service LanguageService { } // Analyzes the syntax of the text and provides sentence boundaries and - // tokenization along with part-of-speech tags, dependency trees, and other + // tokenization along with part of speech tags, dependency trees, and other // properties. rpc AnalyzeSyntax(AnalyzeSyntaxRequest) returns (AnalyzeSyntaxResponse) { option (google.api.http) = { @@ -100,7 +99,7 @@ service LanguageService { } } - +// ################################################################ # // // Represents the input to API methods. message Document { @@ -116,6 +115,19 @@ message Document { HTML = 2; } + // Ways of handling boilerplate detected in the document + enum BoilerplateHandling { + // The boilerplate handling is not specified. + BOILERPLATE_HANDLING_UNSPECIFIED = 0; + + // Do not analyze detected boilerplate. Reference web URI is required for + // detecting boilerplate. + SKIP_BOILERPLATE = 1; + + // Treat boilerplate the same as content. + KEEP_BOILERPLATE = 2; + } + // Required. If the type is not set or is `TYPE_UNSPECIFIED`, // returns an `INVALID_ARGUMENT` error. Type type = 1; @@ -143,6 +155,15 @@ message Document { // specified by the caller or automatically detected) is not supported by the // called API method, an `INVALID_ARGUMENT` error is returned. string language = 4; + + // The web URI where the document comes from. This URI is not used for + // fetching the content, but as a hint for analyzing the document. + string reference_web_uri = 5; + + // Indicates how detected boilerplate(e.g. advertisements, copyright + // declarations, banners) should be handled for this document. If not + // specified, boilerplate will be treated the same as content. + BoilerplateHandling boilerplate_handling = 6; } // Represents a sentence in the input document. @@ -156,6 +177,32 @@ message Sentence { Sentiment sentiment = 2; } +// 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. +enum EncodingType { + // If `EncodingType` is not specified, encoding-dependent information (such as + // `begin_offset`) will be set at `-1`. + NONE = 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. + UTF8 = 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. + UTF16 = 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. + UTF32 = 3; +} + // Represents a phrase in the text that is a known entity, such as // a person, an organization, or location. The API associates information, such // as salience and mentions, with entities. @@ -286,32 +333,6 @@ message Token { string lemma = 4; } -// 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. -enum EncodingType { - // If `EncodingType` is not specified, encoding-dependent information (such as - // `begin_offset`) will be set at `-1`. - NONE = 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. - UTF8 = 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. - UTF16 = 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. - UTF32 = 3; -} - // Represents the feeling associated with the entire text or entities in // the text. // Next ID: 6 @@ -968,6 +989,45 @@ message ClassificationCategory { float confidence = 2; } +// Model options available for classification requests. +message ClassificationModelOptions { + // Options for the V1 model. + message V1Model { + + } + + // Options for the V2 model. + message V2Model { + // The content categories used for classification. + enum ContentCategoriesVersion { + // If `ContentCategoriesVersion` is not specified, this option will + // default to `V1`. + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + + // Legacy content categories of our initial launch in 2017. + V1 = 1; + + // Updated content categories in 2022. + V2 = 2; + } + + // The content categories used for classification. + ContentCategoriesVersion content_categories_version = 1; + } + + // If this field is not set, then the `v1_model` will be used by default. + oneof model_type { + // Setting this field will use the V1 model and V1 content categories + // version. The V1 model is a legacy model; support for this will be + // discontinued in the future. + V1Model v1_model = 1; + + // Setting this field will use the V2 model with the appropriate content + // categories version. The V2 model is a better performing model. + V2Model v2_model = 2; + } +} + // The sentiment analysis request message. message AnalyzeSentimentRequest { // Required. Input document. @@ -1059,6 +1119,10 @@ message AnalyzeSyntaxResponse { message ClassifyTextRequest { // Required. Input document. Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Model options to use for classification. Defaults to v1 options if not + // specified. + ClassificationModelOptions classification_model_options = 3; } // The document classification response message. @@ -1072,7 +1136,7 @@ message ClassifyTextResponse { message AnnotateTextRequest { // All available features for sentiment, syntax, and semantic analysis. // Setting each one to true will enable that specific analysis for the input. - // Next ID: 10 + // Next ID: 11 message Features { // Extract syntax information. bool extract_syntax = 1; @@ -1091,6 +1155,10 @@ message AnnotateTextRequest { // [predefined // taxonomy](https://cloud.google.com/natural-language/docs/categories). bool classify_text = 6; + + // The model options to use for classification. Defaults to v1 options + // if not specified. Only used if `classify_text` is set to true. + ClassificationModelOptions classification_model_options = 10; } // Required. Input document. diff --git a/packages/google-cloud-language/protos/protos.d.ts b/packages/google-cloud-language/protos/protos.d.ts index d90d7662743..2783b9278ae 100644 --- a/packages/google-cloud-language/protos/protos.d.ts +++ b/packages/google-cloud-language/protos/protos.d.ts @@ -407,6 +407,14 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** EncodingType enum. */ + enum EncodingType { + NONE = 0, + UTF8 = 1, + UTF16 = 2, + UTF32 = 3 + } + /** Properties of an Entity. */ interface IEntity { @@ -554,14 +562,6 @@ export namespace google { } } - /** EncodingType enum. */ - enum EncodingType { - NONE = 0, - UTF8 = 1, - UTF16 = 2, - UTF32 = 3 - } - /** Properties of a Token. */ interface IToken { @@ -1594,6 +1594,313 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a ClassificationModelOptions. */ + interface IClassificationModelOptions { + + /** ClassificationModelOptions v1Model */ + v1Model?: (google.cloud.language.v1.ClassificationModelOptions.IV1Model|null); + + /** ClassificationModelOptions v2Model */ + v2Model?: (google.cloud.language.v1.ClassificationModelOptions.IV2Model|null); + } + + /** Represents a ClassificationModelOptions. */ + class ClassificationModelOptions implements IClassificationModelOptions { + + /** + * Constructs a new ClassificationModelOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.language.v1.IClassificationModelOptions); + + /** ClassificationModelOptions v1Model. */ + public v1Model?: (google.cloud.language.v1.ClassificationModelOptions.IV1Model|null); + + /** ClassificationModelOptions v2Model. */ + public v2Model?: (google.cloud.language.v1.ClassificationModelOptions.IV2Model|null); + + /** ClassificationModelOptions modelType. */ + public modelType?: ("v1Model"|"v2Model"); + + /** + * Creates a new ClassificationModelOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ClassificationModelOptions instance + */ + public static create(properties?: google.cloud.language.v1.IClassificationModelOptions): google.cloud.language.v1.ClassificationModelOptions; + + /** + * Encodes the specified ClassificationModelOptions message. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.verify|verify} messages. + * @param message ClassificationModelOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.language.v1.IClassificationModelOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClassificationModelOptions message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.verify|verify} messages. + * @param message ClassificationModelOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.language.v1.IClassificationModelOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClassificationModelOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClassificationModelOptions + * @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.ClassificationModelOptions; + + /** + * Decodes a ClassificationModelOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClassificationModelOptions + * @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.ClassificationModelOptions; + + /** + * Verifies a ClassificationModelOptions 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 ClassificationModelOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClassificationModelOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.ClassificationModelOptions; + + /** + * Creates a plain object from a ClassificationModelOptions message. Also converts values to other types if specified. + * @param message ClassificationModelOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.language.v1.ClassificationModelOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClassificationModelOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClassificationModelOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ClassificationModelOptions { + + /** Properties of a V1Model. */ + interface IV1Model { + } + + /** Represents a V1Model. */ + class V1Model implements IV1Model { + + /** + * Constructs a new V1Model. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.language.v1.ClassificationModelOptions.IV1Model); + + /** + * Creates a new V1Model instance using the specified properties. + * @param [properties] Properties to set + * @returns V1Model instance + */ + public static create(properties?: google.cloud.language.v1.ClassificationModelOptions.IV1Model): google.cloud.language.v1.ClassificationModelOptions.V1Model; + + /** + * Encodes the specified V1Model message. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V1Model.verify|verify} messages. + * @param message V1Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.language.v1.ClassificationModelOptions.IV1Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified V1Model message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V1Model.verify|verify} messages. + * @param message V1Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.language.v1.ClassificationModelOptions.IV1Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a V1Model message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns V1Model + * @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.ClassificationModelOptions.V1Model; + + /** + * Decodes a V1Model message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns V1Model + * @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.ClassificationModelOptions.V1Model; + + /** + * Verifies a V1Model 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 V1Model message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns V1Model + */ + public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.ClassificationModelOptions.V1Model; + + /** + * Creates a plain object from a V1Model message. Also converts values to other types if specified. + * @param message V1Model + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.language.v1.ClassificationModelOptions.V1Model, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this V1Model to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for V1Model + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a V2Model. */ + interface IV2Model { + + /** V2Model contentCategoriesVersion */ + contentCategoriesVersion?: (google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion|keyof typeof google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion|null); + } + + /** Represents a V2Model. */ + class V2Model implements IV2Model { + + /** + * Constructs a new V2Model. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.language.v1.ClassificationModelOptions.IV2Model); + + /** V2Model contentCategoriesVersion. */ + public contentCategoriesVersion: (google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion|keyof typeof google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion); + + /** + * Creates a new V2Model instance using the specified properties. + * @param [properties] Properties to set + * @returns V2Model instance + */ + public static create(properties?: google.cloud.language.v1.ClassificationModelOptions.IV2Model): google.cloud.language.v1.ClassificationModelOptions.V2Model; + + /** + * Encodes the specified V2Model message. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V2Model.verify|verify} messages. + * @param message V2Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.language.v1.ClassificationModelOptions.IV2Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified V2Model message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V2Model.verify|verify} messages. + * @param message V2Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.language.v1.ClassificationModelOptions.IV2Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a V2Model message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns V2Model + * @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.ClassificationModelOptions.V2Model; + + /** + * Decodes a V2Model message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns V2Model + * @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.ClassificationModelOptions.V2Model; + + /** + * Verifies a V2Model 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 V2Model message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns V2Model + */ + public static fromObject(object: { [k: string]: any }): google.cloud.language.v1.ClassificationModelOptions.V2Model; + + /** + * Creates a plain object from a V2Model message. Also converts values to other types if specified. + * @param message V2Model + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.language.v1.ClassificationModelOptions.V2Model, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this V2Model to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for V2Model + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace V2Model { + + /** ContentCategoriesVersion enum. */ + enum ContentCategoriesVersion { + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0, + V1 = 1, + V2 = 2 + } + } + } + /** Properties of an AnalyzeSentimentRequest. */ interface IAnalyzeSentimentRequest { @@ -2435,6 +2742,9 @@ export namespace google { /** ClassifyTextRequest document */ document?: (google.cloud.language.v1.IDocument|null); + + /** ClassifyTextRequest classificationModelOptions */ + classificationModelOptions?: (google.cloud.language.v1.IClassificationModelOptions|null); } /** Represents a ClassifyTextRequest. */ @@ -2449,6 +2759,9 @@ export namespace google { /** ClassifyTextRequest document. */ public document?: (google.cloud.language.v1.IDocument|null); + /** ClassifyTextRequest classificationModelOptions. */ + public classificationModelOptions?: (google.cloud.language.v1.IClassificationModelOptions|null); + /** * Creates a new ClassifyTextRequest instance using the specified properties. * @param [properties] Properties to set @@ -2752,6 +3065,9 @@ export namespace google { /** Features classifyText */ classifyText?: (boolean|null); + + /** Features classificationModelOptions */ + classificationModelOptions?: (google.cloud.language.v1.IClassificationModelOptions|null); } /** Represents a Features. */ @@ -2778,6 +3094,9 @@ export namespace google { /** Features classifyText. */ public classifyText: boolean; + /** Features classificationModelOptions. */ + public classificationModelOptions?: (google.cloud.language.v1.IClassificationModelOptions|null); + /** * Creates a new Features instance using the specified properties. * @param [properties] Properties to set @@ -3152,6 +3471,12 @@ export namespace google { /** Document language */ language?: (string|null); + + /** Document referenceWebUri */ + referenceWebUri?: (string|null); + + /** Document boilerplateHandling */ + boilerplateHandling?: (google.cloud.language.v1beta2.Document.BoilerplateHandling|keyof typeof google.cloud.language.v1beta2.Document.BoilerplateHandling|null); } /** Represents a Document. */ @@ -3175,6 +3500,12 @@ export namespace google { /** Document language. */ public language: string; + /** Document referenceWebUri. */ + public referenceWebUri: string; + + /** Document boilerplateHandling. */ + public boilerplateHandling: (google.cloud.language.v1beta2.Document.BoilerplateHandling|keyof typeof google.cloud.language.v1beta2.Document.BoilerplateHandling); + /** Document source. */ public source?: ("content"|"gcsContentUri"); @@ -3264,6 +3595,13 @@ export namespace google { PLAIN_TEXT = 1, HTML = 2 } + + /** BoilerplateHandling enum. */ + enum BoilerplateHandling { + BOILERPLATE_HANDLING_UNSPECIFIED = 0, + SKIP_BOILERPLATE = 1, + KEEP_BOILERPLATE = 2 + } } /** Properties of a Sentence. */ @@ -3369,6 +3707,14 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** EncodingType enum. */ + enum EncodingType { + NONE = 0, + UTF8 = 1, + UTF16 = 2, + UTF32 = 3 + } + /** Properties of an Entity. */ interface IEntity { @@ -3631,14 +3977,6 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** EncodingType enum. */ - enum EncodingType { - NONE = 0, - UTF8 = 1, - UTF16 = 2, - UTF32 = 3 - } - /** Properties of a Sentiment. */ interface ISentiment { @@ -4556,6 +4894,313 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a ClassificationModelOptions. */ + interface IClassificationModelOptions { + + /** ClassificationModelOptions v1Model */ + v1Model?: (google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model|null); + + /** ClassificationModelOptions v2Model */ + v2Model?: (google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model|null); + } + + /** Represents a ClassificationModelOptions. */ + class ClassificationModelOptions implements IClassificationModelOptions { + + /** + * Constructs a new ClassificationModelOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.language.v1beta2.IClassificationModelOptions); + + /** ClassificationModelOptions v1Model. */ + public v1Model?: (google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model|null); + + /** ClassificationModelOptions v2Model. */ + public v2Model?: (google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model|null); + + /** ClassificationModelOptions modelType. */ + public modelType?: ("v1Model"|"v2Model"); + + /** + * Creates a new ClassificationModelOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ClassificationModelOptions instance + */ + public static create(properties?: google.cloud.language.v1beta2.IClassificationModelOptions): google.cloud.language.v1beta2.ClassificationModelOptions; + + /** + * Encodes the specified ClassificationModelOptions message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.verify|verify} messages. + * @param message ClassificationModelOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.language.v1beta2.IClassificationModelOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClassificationModelOptions message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.verify|verify} messages. + * @param message ClassificationModelOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.language.v1beta2.IClassificationModelOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClassificationModelOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClassificationModelOptions + * @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.v1beta2.ClassificationModelOptions; + + /** + * Decodes a ClassificationModelOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClassificationModelOptions + * @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.v1beta2.ClassificationModelOptions; + + /** + * Verifies a ClassificationModelOptions 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 ClassificationModelOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClassificationModelOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.language.v1beta2.ClassificationModelOptions; + + /** + * Creates a plain object from a ClassificationModelOptions message. Also converts values to other types if specified. + * @param message ClassificationModelOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.language.v1beta2.ClassificationModelOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClassificationModelOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClassificationModelOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ClassificationModelOptions { + + /** Properties of a V1Model. */ + interface IV1Model { + } + + /** Represents a V1Model. */ + class V1Model implements IV1Model { + + /** + * Constructs a new V1Model. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model); + + /** + * Creates a new V1Model instance using the specified properties. + * @param [properties] Properties to set + * @returns V1Model instance + */ + public static create(properties?: google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model): google.cloud.language.v1beta2.ClassificationModelOptions.V1Model; + + /** + * Encodes the specified V1Model message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.verify|verify} messages. + * @param message V1Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified V1Model message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.verify|verify} messages. + * @param message V1Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a V1Model message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns V1Model + * @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.v1beta2.ClassificationModelOptions.V1Model; + + /** + * Decodes a V1Model message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns V1Model + * @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.v1beta2.ClassificationModelOptions.V1Model; + + /** + * Verifies a V1Model 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 V1Model message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns V1Model + */ + public static fromObject(object: { [k: string]: any }): google.cloud.language.v1beta2.ClassificationModelOptions.V1Model; + + /** + * Creates a plain object from a V1Model message. Also converts values to other types if specified. + * @param message V1Model + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.language.v1beta2.ClassificationModelOptions.V1Model, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this V1Model to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for V1Model + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a V2Model. */ + interface IV2Model { + + /** V2Model contentCategoriesVersion */ + contentCategoriesVersion?: (google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion|keyof typeof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion|null); + } + + /** Represents a V2Model. */ + class V2Model implements IV2Model { + + /** + * Constructs a new V2Model. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model); + + /** V2Model contentCategoriesVersion. */ + public contentCategoriesVersion: (google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion|keyof typeof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion); + + /** + * Creates a new V2Model instance using the specified properties. + * @param [properties] Properties to set + * @returns V2Model instance + */ + public static create(properties?: google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model): google.cloud.language.v1beta2.ClassificationModelOptions.V2Model; + + /** + * Encodes the specified V2Model message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.verify|verify} messages. + * @param message V2Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified V2Model message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.verify|verify} messages. + * @param message V2Model message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a V2Model message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns V2Model + * @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.v1beta2.ClassificationModelOptions.V2Model; + + /** + * Decodes a V2Model message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns V2Model + * @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.v1beta2.ClassificationModelOptions.V2Model; + + /** + * Verifies a V2Model 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 V2Model message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns V2Model + */ + public static fromObject(object: { [k: string]: any }): google.cloud.language.v1beta2.ClassificationModelOptions.V2Model; + + /** + * Creates a plain object from a V2Model message. Also converts values to other types if specified. + * @param message V2Model + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.language.v1beta2.ClassificationModelOptions.V2Model, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this V2Model to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for V2Model + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace V2Model { + + /** ContentCategoriesVersion enum. */ + enum ContentCategoriesVersion { + CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0, + V1 = 1, + V2 = 2 + } + } + } + /** Properties of an AnalyzeSentimentRequest. */ interface IAnalyzeSentimentRequest { @@ -5397,6 +6042,9 @@ export namespace google { /** ClassifyTextRequest document */ document?: (google.cloud.language.v1beta2.IDocument|null); + + /** ClassifyTextRequest classificationModelOptions */ + classificationModelOptions?: (google.cloud.language.v1beta2.IClassificationModelOptions|null); } /** Represents a ClassifyTextRequest. */ @@ -5411,6 +6059,9 @@ export namespace google { /** ClassifyTextRequest document. */ public document?: (google.cloud.language.v1beta2.IDocument|null); + /** ClassifyTextRequest classificationModelOptions. */ + public classificationModelOptions?: (google.cloud.language.v1beta2.IClassificationModelOptions|null); + /** * Creates a new ClassifyTextRequest instance using the specified properties. * @param [properties] Properties to set @@ -5714,6 +6365,9 @@ export namespace google { /** Features classifyText */ classifyText?: (boolean|null); + + /** Features classificationModelOptions */ + classificationModelOptions?: (google.cloud.language.v1beta2.IClassificationModelOptions|null); } /** Represents a Features. */ @@ -5740,6 +6394,9 @@ export namespace google { /** Features classifyText. */ public classifyText: boolean; + /** Features classificationModelOptions. */ + public classificationModelOptions?: (google.cloud.language.v1beta2.IClassificationModelOptions|null); + /** * Creates a new Features instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-language/protos/protos.js b/packages/google-cloud-language/protos/protos.js index fa011976e9a..e50960bb002 100644 --- a/packages/google-cloud-language/protos/protos.js +++ b/packages/google-cloud-language/protos/protos.js @@ -868,6 +868,24 @@ return Sentence; })(); + /** + * EncodingType enum. + * @name google.cloud.language.v1.EncodingType + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} UTF8=1 UTF8 value + * @property {number} UTF16=2 UTF16 value + * @property {number} UTF32=3 UTF32 value + */ + v1.EncodingType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "UTF8"] = 1; + values[valuesById[2] = "UTF16"] = 2; + values[valuesById[3] = "UTF32"] = 3; + return values; + })(); + v1.Entity = (function() { /** @@ -1354,24 +1372,6 @@ return Entity; })(); - /** - * EncodingType enum. - * @name google.cloud.language.v1.EncodingType - * @enum {number} - * @property {number} NONE=0 NONE value - * @property {number} UTF8=1 UTF8 value - * @property {number} UTF16=2 UTF16 value - * @property {number} UTF32=3 UTF32 value - */ - v1.EncodingType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NONE"] = 0; - values[valuesById[1] = "UTF8"] = 1; - values[valuesById[2] = "UTF16"] = 2; - values[valuesById[3] = "UTF32"] = 3; - return values; - })(); - v1.Token = (function() { /** @@ -4643,25 +4643,25 @@ return ClassificationCategory; })(); - v1.AnalyzeSentimentRequest = (function() { + v1.ClassificationModelOptions = (function() { /** - * Properties of an AnalyzeSentimentRequest. + * Properties of a ClassificationModelOptions. * @memberof google.cloud.language.v1 - * @interface IAnalyzeSentimentRequest - * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeSentimentRequest document - * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeSentimentRequest encodingType + * @interface IClassificationModelOptions + * @property {google.cloud.language.v1.ClassificationModelOptions.IV1Model|null} [v1Model] ClassificationModelOptions v1Model + * @property {google.cloud.language.v1.ClassificationModelOptions.IV2Model|null} [v2Model] ClassificationModelOptions v2Model */ /** - * Constructs a new AnalyzeSentimentRequest. + * Constructs a new ClassificationModelOptions. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeSentimentRequest. - * @implements IAnalyzeSentimentRequest + * @classdesc Represents a ClassificationModelOptions. + * @implements IClassificationModelOptions * @constructor - * @param {google.cloud.language.v1.IAnalyzeSentimentRequest=} [properties] Properties to set + * @param {google.cloud.language.v1.IClassificationModelOptions=} [properties] Properties to set */ - function AnalyzeSentimentRequest(properties) { + function ClassificationModelOptions(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4669,89 +4669,103 @@ } /** - * AnalyzeSentimentRequest document. - * @member {google.cloud.language.v1.IDocument|null|undefined} document - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * ClassificationModelOptions v1Model. + * @member {google.cloud.language.v1.ClassificationModelOptions.IV1Model|null|undefined} v1Model + * @memberof google.cloud.language.v1.ClassificationModelOptions * @instance */ - AnalyzeSentimentRequest.prototype.document = null; + ClassificationModelOptions.prototype.v1Model = null; /** - * AnalyzeSentimentRequest encodingType. - * @member {google.cloud.language.v1.EncodingType} encodingType - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * ClassificationModelOptions v2Model. + * @member {google.cloud.language.v1.ClassificationModelOptions.IV2Model|null|undefined} v2Model + * @memberof google.cloud.language.v1.ClassificationModelOptions * @instance */ - AnalyzeSentimentRequest.prototype.encodingType = 0; + ClassificationModelOptions.prototype.v2Model = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new AnalyzeSentimentRequest instance using the specified properties. + * ClassificationModelOptions modelType. + * @member {"v1Model"|"v2Model"|undefined} modelType + * @memberof google.cloud.language.v1.ClassificationModelOptions + * @instance + */ + Object.defineProperty(ClassificationModelOptions.prototype, "modelType", { + get: $util.oneOfGetter($oneOfFields = ["v1Model", "v2Model"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ClassificationModelOptions instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static - * @param {google.cloud.language.v1.IAnalyzeSentimentRequest=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest instance + * @param {google.cloud.language.v1.IClassificationModelOptions=} [properties] Properties to set + * @returns {google.cloud.language.v1.ClassificationModelOptions} ClassificationModelOptions instance */ - AnalyzeSentimentRequest.create = function create(properties) { - return new AnalyzeSentimentRequest(properties); + ClassificationModelOptions.create = function create(properties) { + return new ClassificationModelOptions(properties); }; /** - * Encodes the specified AnalyzeSentimentRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentRequest.verify|verify} messages. + * Encodes the specified ClassificationModelOptions message. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static - * @param {google.cloud.language.v1.IAnalyzeSentimentRequest} message AnalyzeSentimentRequest message or plain object to encode + * @param {google.cloud.language.v1.IClassificationModelOptions} message ClassificationModelOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeSentimentRequest.encode = function encode(message, writer) { + ClassificationModelOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.document != null && Object.hasOwnProperty.call(message, "document")) - $root.google.cloud.language.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.encodingType != null && Object.hasOwnProperty.call(message, "encodingType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.encodingType); + if (message.v1Model != null && Object.hasOwnProperty.call(message, "v1Model")) + $root.google.cloud.language.v1.ClassificationModelOptions.V1Model.encode(message.v1Model, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.v2Model != null && Object.hasOwnProperty.call(message, "v2Model")) + $root.google.cloud.language.v1.ClassificationModelOptions.V2Model.encode(message.v2Model, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnalyzeSentimentRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentRequest.verify|verify} messages. + * Encodes the specified ClassificationModelOptions message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static - * @param {google.cloud.language.v1.IAnalyzeSentimentRequest} message AnalyzeSentimentRequest message or plain object to encode + * @param {google.cloud.language.v1.IClassificationModelOptions} message ClassificationModelOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeSentimentRequest.encodeDelimited = function encodeDelimited(message, writer) { + ClassificationModelOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnalyzeSentimentRequest message from the specified reader or buffer. + * Decodes a ClassificationModelOptions message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest + * @returns {google.cloud.language.v1.ClassificationModelOptions} ClassificationModelOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeSentimentRequest.decode = function decode(reader, length) { + ClassificationModelOptions.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSentimentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.ClassificationModelOptions(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.document = $root.google.cloud.language.v1.Document.decode(reader, reader.uint32()); + message.v1Model = $root.google.cloud.language.v1.ClassificationModelOptions.V1Model.decode(reader, reader.uint32()); break; } case 2: { - message.encodingType = reader.int32(); + message.v2Model = $root.google.cloud.language.v1.ClassificationModelOptions.V2Model.decode(reader, reader.uint32()); break; } default: @@ -4763,437 +4777,565 @@ }; /** - * Decodes an AnalyzeSentimentRequest message from the specified reader or buffer, length delimited. + * Decodes a ClassificationModelOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest + * @returns {google.cloud.language.v1.ClassificationModelOptions} ClassificationModelOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeSentimentRequest.decodeDelimited = function decodeDelimited(reader) { + ClassificationModelOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnalyzeSentimentRequest message. + * Verifies a ClassificationModelOptions message. * @function verify - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnalyzeSentimentRequest.verify = function verify(message) { + ClassificationModelOptions.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.document != null && message.hasOwnProperty("document")) { - var error = $root.google.cloud.language.v1.Document.verify(message.document); - if (error) - return "document." + error; + var properties = {}; + if (message.v1Model != null && message.hasOwnProperty("v1Model")) { + properties.modelType = 1; + { + var error = $root.google.cloud.language.v1.ClassificationModelOptions.V1Model.verify(message.v1Model); + if (error) + return "v1Model." + error; + } } - if (message.encodingType != null && message.hasOwnProperty("encodingType")) - switch (message.encodingType) { - default: - return "encodingType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; + if (message.v2Model != null && message.hasOwnProperty("v2Model")) { + if (properties.modelType === 1) + return "modelType: multiple values"; + properties.modelType = 1; + { + var error = $root.google.cloud.language.v1.ClassificationModelOptions.V2Model.verify(message.v2Model); + if (error) + return "v2Model." + error; } + } return null; }; /** - * Creates an AnalyzeSentimentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ClassificationModelOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest + * @returns {google.cloud.language.v1.ClassificationModelOptions} ClassificationModelOptions */ - AnalyzeSentimentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeSentimentRequest) + ClassificationModelOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.ClassificationModelOptions) return object; - var message = new $root.google.cloud.language.v1.AnalyzeSentimentRequest(); - if (object.document != null) { - if (typeof object.document !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeSentimentRequest.document: object expected"); - message.document = $root.google.cloud.language.v1.Document.fromObject(object.document); + var message = new $root.google.cloud.language.v1.ClassificationModelOptions(); + if (object.v1Model != null) { + if (typeof object.v1Model !== "object") + throw TypeError(".google.cloud.language.v1.ClassificationModelOptions.v1Model: object expected"); + message.v1Model = $root.google.cloud.language.v1.ClassificationModelOptions.V1Model.fromObject(object.v1Model); } - switch (object.encodingType) { - case "NONE": - case 0: - message.encodingType = 0; - break; - case "UTF8": - case 1: - message.encodingType = 1; - break; - case "UTF16": - case 2: - message.encodingType = 2; - break; - case "UTF32": - case 3: - message.encodingType = 3; - break; + if (object.v2Model != null) { + if (typeof object.v2Model !== "object") + throw TypeError(".google.cloud.language.v1.ClassificationModelOptions.v2Model: object expected"); + message.v2Model = $root.google.cloud.language.v1.ClassificationModelOptions.V2Model.fromObject(object.v2Model); } return message; }; /** - * Creates a plain object from an AnalyzeSentimentRequest message. Also converts values to other types if specified. + * Creates a plain object from a ClassificationModelOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static - * @param {google.cloud.language.v1.AnalyzeSentimentRequest} message AnalyzeSentimentRequest + * @param {google.cloud.language.v1.ClassificationModelOptions} message ClassificationModelOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyzeSentimentRequest.toObject = function toObject(message, options) { + ClassificationModelOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.document = null; - object.encodingType = options.enums === String ? "NONE" : 0; + if (message.v1Model != null && message.hasOwnProperty("v1Model")) { + object.v1Model = $root.google.cloud.language.v1.ClassificationModelOptions.V1Model.toObject(message.v1Model, options); + if (options.oneofs) + object.modelType = "v1Model"; + } + if (message.v2Model != null && message.hasOwnProperty("v2Model")) { + object.v2Model = $root.google.cloud.language.v1.ClassificationModelOptions.V2Model.toObject(message.v2Model, options); + if (options.oneofs) + object.modelType = "v2Model"; } - if (message.document != null && message.hasOwnProperty("document")) - object.document = $root.google.cloud.language.v1.Document.toObject(message.document, options); - if (message.encodingType != null && message.hasOwnProperty("encodingType")) - object.encodingType = options.enums === String ? $root.google.cloud.language.v1.EncodingType[message.encodingType] : message.encodingType; return object; }; /** - * Converts this AnalyzeSentimentRequest to JSON. + * Converts this ClassificationModelOptions to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @instance * @returns {Object.} JSON object */ - AnalyzeSentimentRequest.prototype.toJSON = function toJSON() { + ClassificationModelOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnalyzeSentimentRequest + * Gets the default type url for ClassificationModelOptions * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeSentimentRequest + * @memberof google.cloud.language.v1.ClassificationModelOptions * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnalyzeSentimentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ClassificationModelOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSentimentRequest"; + return typeUrlPrefix + "/google.cloud.language.v1.ClassificationModelOptions"; }; - return AnalyzeSentimentRequest; - })(); - - v1.AnalyzeSentimentResponse = (function() { - - /** - * Properties of an AnalyzeSentimentResponse. - * @memberof google.cloud.language.v1 - * @interface IAnalyzeSentimentResponse - * @property {google.cloud.language.v1.ISentiment|null} [documentSentiment] AnalyzeSentimentResponse documentSentiment - * @property {string|null} [language] AnalyzeSentimentResponse language - * @property {Array.|null} [sentences] AnalyzeSentimentResponse sentences - */ + ClassificationModelOptions.V1Model = (function() { - /** - * Constructs a new AnalyzeSentimentResponse. - * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeSentimentResponse. - * @implements IAnalyzeSentimentResponse - * @constructor - * @param {google.cloud.language.v1.IAnalyzeSentimentResponse=} [properties] Properties to set - */ - function AnalyzeSentimentResponse(properties) { - this.sentences = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a V1Model. + * @memberof google.cloud.language.v1.ClassificationModelOptions + * @interface IV1Model + */ - /** - * AnalyzeSentimentResponse documentSentiment. - * @member {google.cloud.language.v1.ISentiment|null|undefined} documentSentiment - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @instance - */ - AnalyzeSentimentResponse.prototype.documentSentiment = null; + /** + * Constructs a new V1Model. + * @memberof google.cloud.language.v1.ClassificationModelOptions + * @classdesc Represents a V1Model. + * @implements IV1Model + * @constructor + * @param {google.cloud.language.v1.ClassificationModelOptions.IV1Model=} [properties] Properties to set + */ + function V1Model(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * AnalyzeSentimentResponse language. - * @member {string} language - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @instance - */ - AnalyzeSentimentResponse.prototype.language = ""; + /** + * Creates a new V1Model instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.IV1Model=} [properties] Properties to set + * @returns {google.cloud.language.v1.ClassificationModelOptions.V1Model} V1Model instance + */ + V1Model.create = function create(properties) { + return new V1Model(properties); + }; - /** - * AnalyzeSentimentResponse sentences. - * @member {Array.} sentences - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @instance - */ - AnalyzeSentimentResponse.prototype.sentences = $util.emptyArray; + /** + * Encodes the specified V1Model message. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V1Model.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.IV1Model} message V1Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V1Model.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Creates a new AnalyzeSentimentResponse instance using the specified properties. - * @function create - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {google.cloud.language.v1.IAnalyzeSentimentResponse=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse instance - */ - AnalyzeSentimentResponse.create = function create(properties) { - return new AnalyzeSentimentResponse(properties); - }; + /** + * Encodes the specified V1Model message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V1Model.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.IV1Model} message V1Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V1Model.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified AnalyzeSentimentResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {google.cloud.language.v1.IAnalyzeSentimentResponse} message AnalyzeSentimentResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AnalyzeSentimentResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.documentSentiment != null && Object.hasOwnProperty.call(message, "documentSentiment")) - $root.google.cloud.language.v1.Sentiment.encode(message.documentSentiment, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.language != null && Object.hasOwnProperty.call(message, "language")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.language); - if (message.sentences != null && message.sentences.length) - for (var i = 0; i < message.sentences.length; ++i) - $root.google.cloud.language.v1.Sentence.encode(message.sentences[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified AnalyzeSentimentResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {google.cloud.language.v1.IAnalyzeSentimentResponse} message AnalyzeSentimentResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AnalyzeSentimentResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnalyzeSentimentResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnalyzeSentimentResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSentimentResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.documentSentiment = $root.google.cloud.language.v1.Sentiment.decode(reader, reader.uint32()); - break; - } - case 2: { - message.language = reader.string(); - break; - } - case 3: { - if (!(message.sentences && message.sentences.length)) - message.sentences = []; - message.sentences.push($root.google.cloud.language.v1.Sentence.decode(reader, reader.uint32())); + /** + * Decodes a V1Model message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1.ClassificationModelOptions.V1Model} V1Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V1Model.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.ClassificationModelOptions.V1Model(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; + return message; + }; - /** - * Decodes an AnalyzeSentimentResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnalyzeSentimentResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a V1Model message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1.ClassificationModelOptions.V1Model} V1Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V1Model.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an AnalyzeSentimentResponse message. - * @function verify - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AnalyzeSentimentResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) { - var error = $root.google.cloud.language.v1.Sentiment.verify(message.documentSentiment); - if (error) - return "documentSentiment." + error; - } - if (message.language != null && message.hasOwnProperty("language")) - if (!$util.isString(message.language)) - return "language: string expected"; - if (message.sentences != null && message.hasOwnProperty("sentences")) { - if (!Array.isArray(message.sentences)) - return "sentences: array expected"; - for (var i = 0; i < message.sentences.length; ++i) { - var error = $root.google.cloud.language.v1.Sentence.verify(message.sentences[i]); - if (error) - return "sentences." + error; - } - } - return null; - }; + /** + * Verifies a V1Model message. + * @function verify + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + V1Model.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Creates an AnalyzeSentimentResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse - */ - AnalyzeSentimentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeSentimentResponse) - return object; - var message = new $root.google.cloud.language.v1.AnalyzeSentimentResponse(); - if (object.documentSentiment != null) { - if (typeof object.documentSentiment !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeSentimentResponse.documentSentiment: object expected"); - message.documentSentiment = $root.google.cloud.language.v1.Sentiment.fromObject(object.documentSentiment); - } - if (object.language != null) - message.language = String(object.language); - if (object.sentences) { - if (!Array.isArray(object.sentences)) - throw TypeError(".google.cloud.language.v1.AnalyzeSentimentResponse.sentences: array expected"); - message.sentences = []; - for (var i = 0; i < object.sentences.length; ++i) { - if (typeof object.sentences[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeSentimentResponse.sentences: object expected"); - message.sentences[i] = $root.google.cloud.language.v1.Sentence.fromObject(object.sentences[i]); + /** + * Creates a V1Model message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1.ClassificationModelOptions.V1Model} V1Model + */ + V1Model.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.ClassificationModelOptions.V1Model) + return object; + return new $root.google.cloud.language.v1.ClassificationModelOptions.V1Model(); + }; + + /** + * Creates a plain object from a V1Model message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.V1Model} message V1Model + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + V1Model.toObject = function toObject() { + return {}; + }; + + /** + * Converts this V1Model to JSON. + * @function toJSON + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @instance + * @returns {Object.} JSON object + */ + V1Model.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for V1Model + * @function getTypeUrl + * @memberof google.cloud.language.v1.ClassificationModelOptions.V1Model + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + V1Model.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - } - return message; - }; + return typeUrlPrefix + "/google.cloud.language.v1.ClassificationModelOptions.V1Model"; + }; - /** - * Creates a plain object from an AnalyzeSentimentResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {google.cloud.language.v1.AnalyzeSentimentResponse} message AnalyzeSentimentResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnalyzeSentimentResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.sentences = []; - if (options.defaults) { - object.documentSentiment = null; - object.language = ""; - } - if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) - object.documentSentiment = $root.google.cloud.language.v1.Sentiment.toObject(message.documentSentiment, options); - if (message.language != null && message.hasOwnProperty("language")) - object.language = message.language; - if (message.sentences && message.sentences.length) { - object.sentences = []; - for (var j = 0; j < message.sentences.length; ++j) - object.sentences[j] = $root.google.cloud.language.v1.Sentence.toObject(message.sentences[j], options); - } - return object; - }; + return V1Model; + })(); - /** - * Converts this AnalyzeSentimentResponse to JSON. - * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @instance - * @returns {Object.} JSON object - */ - AnalyzeSentimentResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + ClassificationModelOptions.V2Model = (function() { - /** - * Gets the default type url for AnalyzeSentimentResponse - * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeSentimentResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnalyzeSentimentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + /** + * Properties of a V2Model. + * @memberof google.cloud.language.v1.ClassificationModelOptions + * @interface IV2Model + * @property {google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion|null} [contentCategoriesVersion] V2Model contentCategoriesVersion + */ + + /** + * Constructs a new V2Model. + * @memberof google.cloud.language.v1.ClassificationModelOptions + * @classdesc Represents a V2Model. + * @implements IV2Model + * @constructor + * @param {google.cloud.language.v1.ClassificationModelOptions.IV2Model=} [properties] Properties to set + */ + function V2Model(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSentimentResponse"; - }; - return AnalyzeSentimentResponse; + /** + * V2Model contentCategoriesVersion. + * @member {google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion} contentCategoriesVersion + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @instance + */ + V2Model.prototype.contentCategoriesVersion = 0; + + /** + * Creates a new V2Model instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.IV2Model=} [properties] Properties to set + * @returns {google.cloud.language.v1.ClassificationModelOptions.V2Model} V2Model instance + */ + V2Model.create = function create(properties) { + return new V2Model(properties); + }; + + /** + * Encodes the specified V2Model message. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V2Model.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.IV2Model} message V2Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V2Model.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contentCategoriesVersion != null && Object.hasOwnProperty.call(message, "contentCategoriesVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.contentCategoriesVersion); + return writer; + }; + + /** + * Encodes the specified V2Model message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassificationModelOptions.V2Model.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.IV2Model} message V2Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V2Model.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a V2Model message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1.ClassificationModelOptions.V2Model} V2Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V2Model.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.ClassificationModelOptions.V2Model(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.contentCategoriesVersion = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a V2Model message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1.ClassificationModelOptions.V2Model} V2Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V2Model.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a V2Model message. + * @function verify + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + V2Model.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contentCategoriesVersion != null && message.hasOwnProperty("contentCategoriesVersion")) + switch (message.contentCategoriesVersion) { + default: + return "contentCategoriesVersion: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a V2Model message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1.ClassificationModelOptions.V2Model} V2Model + */ + V2Model.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.ClassificationModelOptions.V2Model) + return object; + var message = new $root.google.cloud.language.v1.ClassificationModelOptions.V2Model(); + switch (object.contentCategoriesVersion) { + case "CONTENT_CATEGORIES_VERSION_UNSPECIFIED": + case 0: + message.contentCategoriesVersion = 0; + break; + case "V1": + case 1: + message.contentCategoriesVersion = 1; + break; + case "V2": + case 2: + message.contentCategoriesVersion = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a V2Model message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1.ClassificationModelOptions.V2Model} message V2Model + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + V2Model.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.contentCategoriesVersion = options.enums === String ? "CONTENT_CATEGORIES_VERSION_UNSPECIFIED" : 0; + if (message.contentCategoriesVersion != null && message.hasOwnProperty("contentCategoriesVersion")) + object.contentCategoriesVersion = options.enums === String ? $root.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion[message.contentCategoriesVersion] : message.contentCategoriesVersion; + return object; + }; + + /** + * Converts this V2Model to JSON. + * @function toJSON + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @instance + * @returns {Object.} JSON object + */ + V2Model.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for V2Model + * @function getTypeUrl + * @memberof google.cloud.language.v1.ClassificationModelOptions.V2Model + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + V2Model.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1.ClassificationModelOptions.V2Model"; + }; + + /** + * ContentCategoriesVersion enum. + * @name google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion + * @enum {number} + * @property {number} CONTENT_CATEGORIES_VERSION_UNSPECIFIED=0 CONTENT_CATEGORIES_VERSION_UNSPECIFIED value + * @property {number} V1=1 V1 value + * @property {number} V2=2 V2 value + */ + V2Model.ContentCategoriesVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONTENT_CATEGORIES_VERSION_UNSPECIFIED"] = 0; + values[valuesById[1] = "V1"] = 1; + values[valuesById[2] = "V2"] = 2; + return values; + })(); + + return V2Model; + })(); + + return ClassificationModelOptions; })(); - v1.AnalyzeEntitySentimentRequest = (function() { + v1.AnalyzeSentimentRequest = (function() { /** - * Properties of an AnalyzeEntitySentimentRequest. + * Properties of an AnalyzeSentimentRequest. * @memberof google.cloud.language.v1 - * @interface IAnalyzeEntitySentimentRequest - * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeEntitySentimentRequest document - * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeEntitySentimentRequest encodingType + * @interface IAnalyzeSentimentRequest + * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeSentimentRequest document + * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeSentimentRequest encodingType */ /** - * Constructs a new AnalyzeEntitySentimentRequest. + * Constructs a new AnalyzeSentimentRequest. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeEntitySentimentRequest. - * @implements IAnalyzeEntitySentimentRequest + * @classdesc Represents an AnalyzeSentimentRequest. + * @implements IAnalyzeSentimentRequest * @constructor - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeSentimentRequest=} [properties] Properties to set */ - function AnalyzeEntitySentimentRequest(properties) { + function AnalyzeSentimentRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5201,43 +5343,43 @@ } /** - * AnalyzeEntitySentimentRequest document. + * AnalyzeSentimentRequest document. * @member {google.cloud.language.v1.IDocument|null|undefined} document - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @instance */ - AnalyzeEntitySentimentRequest.prototype.document = null; + AnalyzeSentimentRequest.prototype.document = null; /** - * AnalyzeEntitySentimentRequest encodingType. + * AnalyzeSentimentRequest encodingType. * @member {google.cloud.language.v1.EncodingType} encodingType - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @instance */ - AnalyzeEntitySentimentRequest.prototype.encodingType = 0; + AnalyzeSentimentRequest.prototype.encodingType = 0; /** - * Creates a new AnalyzeEntitySentimentRequest instance using the specified properties. + * Creates a new AnalyzeSentimentRequest instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest instance + * @param {google.cloud.language.v1.IAnalyzeSentimentRequest=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest instance */ - AnalyzeEntitySentimentRequest.create = function create(properties) { - return new AnalyzeEntitySentimentRequest(properties); + AnalyzeSentimentRequest.create = function create(properties) { + return new AnalyzeSentimentRequest(properties); }; /** - * Encodes the specified AnalyzeEntitySentimentRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentRequest.verify|verify} messages. + * Encodes the specified AnalyzeSentimentRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest} message AnalyzeEntitySentimentRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSentimentRequest} message AnalyzeSentimentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitySentimentRequest.encode = function encode(message, writer) { + AnalyzeSentimentRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.document != null && Object.hasOwnProperty.call(message, "document")) @@ -5248,33 +5390,33 @@ }; /** - * Encodes the specified AnalyzeEntitySentimentRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentRequest.verify|verify} messages. + * Encodes the specified AnalyzeSentimentRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest} message AnalyzeEntitySentimentRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSentimentRequest} message AnalyzeSentimentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitySentimentRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeSentimentRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnalyzeEntitySentimentRequest message from the specified reader or buffer. + * Decodes an AnalyzeSentimentRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest + * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitySentimentRequest.decode = function decode(reader, length) { + AnalyzeSentimentRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSentimentRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -5295,30 +5437,30 @@ }; /** - * Decodes an AnalyzeEntitySentimentRequest message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeSentimentRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest + * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitySentimentRequest.decodeDelimited = function decodeDelimited(reader) { + AnalyzeSentimentRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnalyzeEntitySentimentRequest message. + * Verifies an AnalyzeSentimentRequest message. * @function verify - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnalyzeEntitySentimentRequest.verify = function verify(message) { + AnalyzeSentimentRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.document != null && message.hasOwnProperty("document")) { @@ -5340,20 +5482,20 @@ }; /** - * Creates an AnalyzeEntitySentimentRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeSentimentRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest + * @returns {google.cloud.language.v1.AnalyzeSentimentRequest} AnalyzeSentimentRequest */ - AnalyzeEntitySentimentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitySentimentRequest) + AnalyzeSentimentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeSentimentRequest) return object; - var message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentRequest(); + var message = new $root.google.cloud.language.v1.AnalyzeSentimentRequest(); if (object.document != null) { if (typeof object.document !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeEntitySentimentRequest.document: object expected"); + throw TypeError(".google.cloud.language.v1.AnalyzeSentimentRequest.document: object expected"); message.document = $root.google.cloud.language.v1.Document.fromObject(object.document); } switch (object.encodingType) { @@ -5378,15 +5520,15 @@ }; /** - * Creates a plain object from an AnalyzeEntitySentimentRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeSentimentRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static - * @param {google.cloud.language.v1.AnalyzeEntitySentimentRequest} message AnalyzeEntitySentimentRequest + * @param {google.cloud.language.v1.AnalyzeSentimentRequest} message AnalyzeSentimentRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyzeEntitySentimentRequest.toObject = function toObject(message, options) { + AnalyzeSentimentRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -5402,54 +5544,55 @@ }; /** - * Converts this AnalyzeEntitySentimentRequest to JSON. + * Converts this AnalyzeSentimentRequest to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @instance * @returns {Object.} JSON object */ - AnalyzeEntitySentimentRequest.prototype.toJSON = function toJSON() { + AnalyzeSentimentRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnalyzeEntitySentimentRequest + * Gets the default type url for AnalyzeSentimentRequest * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest + * @memberof google.cloud.language.v1.AnalyzeSentimentRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnalyzeEntitySentimentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeSentimentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitySentimentRequest"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSentimentRequest"; }; - return AnalyzeEntitySentimentRequest; + return AnalyzeSentimentRequest; })(); - v1.AnalyzeEntitySentimentResponse = (function() { + v1.AnalyzeSentimentResponse = (function() { /** - * Properties of an AnalyzeEntitySentimentResponse. + * Properties of an AnalyzeSentimentResponse. * @memberof google.cloud.language.v1 - * @interface IAnalyzeEntitySentimentResponse - * @property {Array.|null} [entities] AnalyzeEntitySentimentResponse entities - * @property {string|null} [language] AnalyzeEntitySentimentResponse language + * @interface IAnalyzeSentimentResponse + * @property {google.cloud.language.v1.ISentiment|null} [documentSentiment] AnalyzeSentimentResponse documentSentiment + * @property {string|null} [language] AnalyzeSentimentResponse language + * @property {Array.|null} [sentences] AnalyzeSentimentResponse sentences */ /** - * Constructs a new AnalyzeEntitySentimentResponse. + * Constructs a new AnalyzeSentimentResponse. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeEntitySentimentResponse. - * @implements IAnalyzeEntitySentimentResponse + * @classdesc Represents an AnalyzeSentimentResponse. + * @implements IAnalyzeSentimentResponse * @constructor - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeSentimentResponse=} [properties] Properties to set */ - function AnalyzeEntitySentimentResponse(properties) { - this.entities = []; + function AnalyzeSentimentResponse(properties) { + this.sentences = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5457,94 +5600,108 @@ } /** - * AnalyzeEntitySentimentResponse entities. - * @member {Array.} entities - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * AnalyzeSentimentResponse documentSentiment. + * @member {google.cloud.language.v1.ISentiment|null|undefined} documentSentiment + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @instance */ - AnalyzeEntitySentimentResponse.prototype.entities = $util.emptyArray; + AnalyzeSentimentResponse.prototype.documentSentiment = null; /** - * AnalyzeEntitySentimentResponse language. + * AnalyzeSentimentResponse language. * @member {string} language - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @instance */ - AnalyzeEntitySentimentResponse.prototype.language = ""; + AnalyzeSentimentResponse.prototype.language = ""; /** - * Creates a new AnalyzeEntitySentimentResponse instance using the specified properties. + * AnalyzeSentimentResponse sentences. + * @member {Array.} sentences + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse + * @instance + */ + AnalyzeSentimentResponse.prototype.sentences = $util.emptyArray; + + /** + * Creates a new AnalyzeSentimentResponse instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse instance + * @param {google.cloud.language.v1.IAnalyzeSentimentResponse=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse instance */ - AnalyzeEntitySentimentResponse.create = function create(properties) { - return new AnalyzeEntitySentimentResponse(properties); + AnalyzeSentimentResponse.create = function create(properties) { + return new AnalyzeSentimentResponse(properties); }; /** - * Encodes the specified AnalyzeEntitySentimentResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentResponse.verify|verify} messages. + * Encodes the specified AnalyzeSentimentResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse} message AnalyzeEntitySentimentResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSentimentResponse} message AnalyzeSentimentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitySentimentResponse.encode = function encode(message, writer) { + AnalyzeSentimentResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.entities != null && message.entities.length) - for (var i = 0; i < message.entities.length; ++i) - $root.google.cloud.language.v1.Entity.encode(message.entities[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.documentSentiment != null && Object.hasOwnProperty.call(message, "documentSentiment")) + $root.google.cloud.language.v1.Sentiment.encode(message.documentSentiment, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.language != null && Object.hasOwnProperty.call(message, "language")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.language); + if (message.sentences != null && message.sentences.length) + for (var i = 0; i < message.sentences.length; ++i) + $root.google.cloud.language.v1.Sentence.encode(message.sentences[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnalyzeEntitySentimentResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentResponse.verify|verify} messages. + * Encodes the specified AnalyzeSentimentResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSentimentResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static - * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse} message AnalyzeEntitySentimentResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSentimentResponse} message AnalyzeSentimentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitySentimentResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeSentimentResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnalyzeEntitySentimentResponse message from the specified reader or buffer. + * Decodes an AnalyzeSentimentResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse + * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitySentimentResponse.decode = function decode(reader, length) { + AnalyzeSentimentResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSentimentResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.entities && message.entities.length)) - message.entities = []; - message.entities.push($root.google.cloud.language.v1.Entity.decode(reader, reader.uint32())); + message.documentSentiment = $root.google.cloud.language.v1.Sentiment.decode(reader, reader.uint32()); break; } case 2: { message.language = reader.string(); break; } + case 3: { + if (!(message.sentences && message.sentences.length)) + message.sentences = []; + message.sentences.push($root.google.cloud.language.v1.Sentence.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -5554,149 +5711,163 @@ }; /** - * Decodes an AnalyzeEntitySentimentResponse message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeSentimentResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse + * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitySentimentResponse.decodeDelimited = function decodeDelimited(reader) { + AnalyzeSentimentResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnalyzeEntitySentimentResponse message. + * Verifies an AnalyzeSentimentResponse message. * @function verify - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnalyzeEntitySentimentResponse.verify = function verify(message) { + AnalyzeSentimentResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.entities != null && message.hasOwnProperty("entities")) { - if (!Array.isArray(message.entities)) - return "entities: array expected"; - for (var i = 0; i < message.entities.length; ++i) { - var error = $root.google.cloud.language.v1.Entity.verify(message.entities[i]); - if (error) - return "entities." + error; - } + if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) { + var error = $root.google.cloud.language.v1.Sentiment.verify(message.documentSentiment); + if (error) + return "documentSentiment." + error; } if (message.language != null && message.hasOwnProperty("language")) if (!$util.isString(message.language)) return "language: string expected"; + if (message.sentences != null && message.hasOwnProperty("sentences")) { + if (!Array.isArray(message.sentences)) + return "sentences: array expected"; + for (var i = 0; i < message.sentences.length; ++i) { + var error = $root.google.cloud.language.v1.Sentence.verify(message.sentences[i]); + if (error) + return "sentences." + error; + } + } return null; }; /** - * Creates an AnalyzeEntitySentimentResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeSentimentResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse + * @returns {google.cloud.language.v1.AnalyzeSentimentResponse} AnalyzeSentimentResponse */ - AnalyzeEntitySentimentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitySentimentResponse) + AnalyzeSentimentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeSentimentResponse) return object; - var message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentResponse(); - if (object.entities) { - if (!Array.isArray(object.entities)) - throw TypeError(".google.cloud.language.v1.AnalyzeEntitySentimentResponse.entities: array expected"); - message.entities = []; - for (var i = 0; i < object.entities.length; ++i) { - if (typeof object.entities[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeEntitySentimentResponse.entities: object expected"); - message.entities[i] = $root.google.cloud.language.v1.Entity.fromObject(object.entities[i]); - } + var message = new $root.google.cloud.language.v1.AnalyzeSentimentResponse(); + if (object.documentSentiment != null) { + if (typeof object.documentSentiment !== "object") + throw TypeError(".google.cloud.language.v1.AnalyzeSentimentResponse.documentSentiment: object expected"); + message.documentSentiment = $root.google.cloud.language.v1.Sentiment.fromObject(object.documentSentiment); } if (object.language != null) message.language = String(object.language); + if (object.sentences) { + if (!Array.isArray(object.sentences)) + throw TypeError(".google.cloud.language.v1.AnalyzeSentimentResponse.sentences: array expected"); + message.sentences = []; + for (var i = 0; i < object.sentences.length; ++i) { + if (typeof object.sentences[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnalyzeSentimentResponse.sentences: object expected"); + message.sentences[i] = $root.google.cloud.language.v1.Sentence.fromObject(object.sentences[i]); + } + } return message; }; /** - * Creates a plain object from an AnalyzeEntitySentimentResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeSentimentResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static - * @param {google.cloud.language.v1.AnalyzeEntitySentimentResponse} message AnalyzeEntitySentimentResponse + * @param {google.cloud.language.v1.AnalyzeSentimentResponse} message AnalyzeSentimentResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyzeEntitySentimentResponse.toObject = function toObject(message, options) { + AnalyzeSentimentResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.entities = []; - if (options.defaults) + object.sentences = []; + if (options.defaults) { + object.documentSentiment = null; object.language = ""; - if (message.entities && message.entities.length) { - object.entities = []; - for (var j = 0; j < message.entities.length; ++j) - object.entities[j] = $root.google.cloud.language.v1.Entity.toObject(message.entities[j], options); } + if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) + object.documentSentiment = $root.google.cloud.language.v1.Sentiment.toObject(message.documentSentiment, options); if (message.language != null && message.hasOwnProperty("language")) object.language = message.language; + if (message.sentences && message.sentences.length) { + object.sentences = []; + for (var j = 0; j < message.sentences.length; ++j) + object.sentences[j] = $root.google.cloud.language.v1.Sentence.toObject(message.sentences[j], options); + } return object; }; /** - * Converts this AnalyzeEntitySentimentResponse to JSON. + * Converts this AnalyzeSentimentResponse to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @instance * @returns {Object.} JSON object */ - AnalyzeEntitySentimentResponse.prototype.toJSON = function toJSON() { + AnalyzeSentimentResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnalyzeEntitySentimentResponse + * Gets the default type url for AnalyzeSentimentResponse * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse + * @memberof google.cloud.language.v1.AnalyzeSentimentResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnalyzeEntitySentimentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeSentimentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitySentimentResponse"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSentimentResponse"; }; - return AnalyzeEntitySentimentResponse; + return AnalyzeSentimentResponse; })(); - v1.AnalyzeEntitiesRequest = (function() { + v1.AnalyzeEntitySentimentRequest = (function() { /** - * Properties of an AnalyzeEntitiesRequest. + * Properties of an AnalyzeEntitySentimentRequest. * @memberof google.cloud.language.v1 - * @interface IAnalyzeEntitiesRequest - * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeEntitiesRequest document - * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeEntitiesRequest encodingType + * @interface IAnalyzeEntitySentimentRequest + * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeEntitySentimentRequest document + * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeEntitySentimentRequest encodingType */ /** - * Constructs a new AnalyzeEntitiesRequest. + * Constructs a new AnalyzeEntitySentimentRequest. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeEntitiesRequest. - * @implements IAnalyzeEntitiesRequest + * @classdesc Represents an AnalyzeEntitySentimentRequest. + * @implements IAnalyzeEntitySentimentRequest * @constructor - * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest=} [properties] Properties to set */ - function AnalyzeEntitiesRequest(properties) { + function AnalyzeEntitySentimentRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5704,43 +5875,43 @@ } /** - * AnalyzeEntitiesRequest document. + * AnalyzeEntitySentimentRequest document. * @member {google.cloud.language.v1.IDocument|null|undefined} document - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @instance */ - AnalyzeEntitiesRequest.prototype.document = null; + AnalyzeEntitySentimentRequest.prototype.document = null; /** - * AnalyzeEntitiesRequest encodingType. + * AnalyzeEntitySentimentRequest encodingType. * @member {google.cloud.language.v1.EncodingType} encodingType - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @instance */ - AnalyzeEntitiesRequest.prototype.encodingType = 0; + AnalyzeEntitySentimentRequest.prototype.encodingType = 0; /** - * Creates a new AnalyzeEntitiesRequest instance using the specified properties. + * Creates a new AnalyzeEntitySentimentRequest instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static - * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest instance + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest instance */ - AnalyzeEntitiesRequest.create = function create(properties) { - return new AnalyzeEntitiesRequest(properties); + AnalyzeEntitySentimentRequest.create = function create(properties) { + return new AnalyzeEntitySentimentRequest(properties); }; /** - * Encodes the specified AnalyzeEntitiesRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesRequest.verify|verify} messages. + * Encodes the specified AnalyzeEntitySentimentRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static - * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest} message AnalyzeEntitiesRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest} message AnalyzeEntitySentimentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitiesRequest.encode = function encode(message, writer) { + AnalyzeEntitySentimentRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.document != null && Object.hasOwnProperty.call(message, "document")) @@ -5751,33 +5922,33 @@ }; /** - * Encodes the specified AnalyzeEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesRequest.verify|verify} messages. + * Encodes the specified AnalyzeEntitySentimentRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static - * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest} message AnalyzeEntitiesRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentRequest} message AnalyzeEntitySentimentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeEntitySentimentRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnalyzeEntitiesRequest message from the specified reader or buffer. + * Decodes an AnalyzeEntitySentimentRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitiesRequest.decode = function decode(reader, length) { + AnalyzeEntitySentimentRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitiesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -5798,30 +5969,30 @@ }; /** - * Decodes an AnalyzeEntitiesRequest message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeEntitySentimentRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { + AnalyzeEntitySentimentRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnalyzeEntitiesRequest message. + * Verifies an AnalyzeEntitySentimentRequest message. * @function verify - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnalyzeEntitiesRequest.verify = function verify(message) { + AnalyzeEntitySentimentRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.document != null && message.hasOwnProperty("document")) { @@ -5843,20 +6014,20 @@ }; /** - * Creates an AnalyzeEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeEntitySentimentRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentRequest} AnalyzeEntitySentimentRequest */ - AnalyzeEntitiesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitiesRequest) + AnalyzeEntitySentimentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitySentimentRequest) return object; - var message = new $root.google.cloud.language.v1.AnalyzeEntitiesRequest(); + var message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentRequest(); if (object.document != null) { if (typeof object.document !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeEntitiesRequest.document: object expected"); + throw TypeError(".google.cloud.language.v1.AnalyzeEntitySentimentRequest.document: object expected"); message.document = $root.google.cloud.language.v1.Document.fromObject(object.document); } switch (object.encodingType) { @@ -5881,15 +6052,15 @@ }; /** - * Creates a plain object from an AnalyzeEntitiesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeEntitySentimentRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static - * @param {google.cloud.language.v1.AnalyzeEntitiesRequest} message AnalyzeEntitiesRequest + * @param {google.cloud.language.v1.AnalyzeEntitySentimentRequest} message AnalyzeEntitySentimentRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyzeEntitiesRequest.toObject = function toObject(message, options) { + AnalyzeEntitySentimentRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -5905,53 +6076,53 @@ }; /** - * Converts this AnalyzeEntitiesRequest to JSON. + * Converts this AnalyzeEntitySentimentRequest to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @instance * @returns {Object.} JSON object */ - AnalyzeEntitiesRequest.prototype.toJSON = function toJSON() { + AnalyzeEntitySentimentRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnalyzeEntitiesRequest + * Gets the default type url for AnalyzeEntitySentimentRequest * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnalyzeEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeEntitySentimentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitiesRequest"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitySentimentRequest"; }; - return AnalyzeEntitiesRequest; + return AnalyzeEntitySentimentRequest; })(); - v1.AnalyzeEntitiesResponse = (function() { + v1.AnalyzeEntitySentimentResponse = (function() { /** - * Properties of an AnalyzeEntitiesResponse. + * Properties of an AnalyzeEntitySentimentResponse. * @memberof google.cloud.language.v1 - * @interface IAnalyzeEntitiesResponse - * @property {Array.|null} [entities] AnalyzeEntitiesResponse entities - * @property {string|null} [language] AnalyzeEntitiesResponse language + * @interface IAnalyzeEntitySentimentResponse + * @property {Array.|null} [entities] AnalyzeEntitySentimentResponse entities + * @property {string|null} [language] AnalyzeEntitySentimentResponse language */ /** - * Constructs a new AnalyzeEntitiesResponse. + * Constructs a new AnalyzeEntitySentimentResponse. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeEntitiesResponse. - * @implements IAnalyzeEntitiesResponse + * @classdesc Represents an AnalyzeEntitySentimentResponse. + * @implements IAnalyzeEntitySentimentResponse * @constructor - * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse=} [properties] Properties to set */ - function AnalyzeEntitiesResponse(properties) { + function AnalyzeEntitySentimentResponse(properties) { this.entities = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -5960,43 +6131,43 @@ } /** - * AnalyzeEntitiesResponse entities. + * AnalyzeEntitySentimentResponse entities. * @member {Array.} entities - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @instance */ - AnalyzeEntitiesResponse.prototype.entities = $util.emptyArray; + AnalyzeEntitySentimentResponse.prototype.entities = $util.emptyArray; /** - * AnalyzeEntitiesResponse language. + * AnalyzeEntitySentimentResponse language. * @member {string} language - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @instance */ - AnalyzeEntitiesResponse.prototype.language = ""; + AnalyzeEntitySentimentResponse.prototype.language = ""; /** - * Creates a new AnalyzeEntitiesResponse instance using the specified properties. + * Creates a new AnalyzeEntitySentimentResponse instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static - * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse instance + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse instance */ - AnalyzeEntitiesResponse.create = function create(properties) { - return new AnalyzeEntitiesResponse(properties); + AnalyzeEntitySentimentResponse.create = function create(properties) { + return new AnalyzeEntitySentimentResponse(properties); }; /** - * Encodes the specified AnalyzeEntitiesResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesResponse.verify|verify} messages. + * Encodes the specified AnalyzeEntitySentimentResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static - * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse} message AnalyzeEntitiesResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse} message AnalyzeEntitySentimentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitiesResponse.encode = function encode(message, writer) { + AnalyzeEntitySentimentResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.entities != null && message.entities.length) @@ -6008,33 +6179,33 @@ }; /** - * Encodes the specified AnalyzeEntitiesResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesResponse.verify|verify} messages. + * Encodes the specified AnalyzeEntitySentimentResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitySentimentResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static - * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse} message AnalyzeEntitiesResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitySentimentResponse} message AnalyzeEntitySentimentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeEntitiesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeEntitySentimentResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnalyzeEntitiesResponse message from the specified reader or buffer. + * Decodes an AnalyzeEntitySentimentResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitiesResponse.decode = function decode(reader, length) { + AnalyzeEntitySentimentResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitiesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -6057,30 +6228,30 @@ }; /** - * Decodes an AnalyzeEntitiesResponse message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeEntitySentimentResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeEntitiesResponse.decodeDelimited = function decodeDelimited(reader) { + AnalyzeEntitySentimentResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnalyzeEntitiesResponse message. + * Verifies an AnalyzeEntitySentimentResponse message. * @function verify - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnalyzeEntitiesResponse.verify = function verify(message) { + AnalyzeEntitySentimentResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.entities != null && message.hasOwnProperty("entities")) { @@ -6099,24 +6270,24 @@ }; /** - * Creates an AnalyzeEntitiesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeEntitySentimentResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse + * @returns {google.cloud.language.v1.AnalyzeEntitySentimentResponse} AnalyzeEntitySentimentResponse */ - AnalyzeEntitiesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitiesResponse) + AnalyzeEntitySentimentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitySentimentResponse) return object; - var message = new $root.google.cloud.language.v1.AnalyzeEntitiesResponse(); + var message = new $root.google.cloud.language.v1.AnalyzeEntitySentimentResponse(); if (object.entities) { if (!Array.isArray(object.entities)) - throw TypeError(".google.cloud.language.v1.AnalyzeEntitiesResponse.entities: array expected"); + throw TypeError(".google.cloud.language.v1.AnalyzeEntitySentimentResponse.entities: array expected"); message.entities = []; for (var i = 0; i < object.entities.length; ++i) { if (typeof object.entities[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeEntitiesResponse.entities: object expected"); + throw TypeError(".google.cloud.language.v1.AnalyzeEntitySentimentResponse.entities: object expected"); message.entities[i] = $root.google.cloud.language.v1.Entity.fromObject(object.entities[i]); } } @@ -6126,15 +6297,15 @@ }; /** - * Creates a plain object from an AnalyzeEntitiesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeEntitySentimentResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static - * @param {google.cloud.language.v1.AnalyzeEntitiesResponse} message AnalyzeEntitiesResponse + * @param {google.cloud.language.v1.AnalyzeEntitySentimentResponse} message AnalyzeEntitySentimentResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyzeEntitiesResponse.toObject = function toObject(message, options) { + AnalyzeEntitySentimentResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -6153,53 +6324,53 @@ }; /** - * Converts this AnalyzeEntitiesResponse to JSON. + * Converts this AnalyzeEntitySentimentResponse to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @instance * @returns {Object.} JSON object */ - AnalyzeEntitiesResponse.prototype.toJSON = function toJSON() { + AnalyzeEntitySentimentResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnalyzeEntitiesResponse + * Gets the default type url for AnalyzeEntitySentimentResponse * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse + * @memberof google.cloud.language.v1.AnalyzeEntitySentimentResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnalyzeEntitiesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeEntitySentimentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitiesResponse"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitySentimentResponse"; }; - return AnalyzeEntitiesResponse; + return AnalyzeEntitySentimentResponse; })(); - v1.AnalyzeSyntaxRequest = (function() { + v1.AnalyzeEntitiesRequest = (function() { /** - * Properties of an AnalyzeSyntaxRequest. + * Properties of an AnalyzeEntitiesRequest. * @memberof google.cloud.language.v1 - * @interface IAnalyzeSyntaxRequest - * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeSyntaxRequest document - * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeSyntaxRequest encodingType + * @interface IAnalyzeEntitiesRequest + * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeEntitiesRequest document + * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeEntitiesRequest encodingType */ /** - * Constructs a new AnalyzeSyntaxRequest. + * Constructs a new AnalyzeEntitiesRequest. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeSyntaxRequest. - * @implements IAnalyzeSyntaxRequest + * @classdesc Represents an AnalyzeEntitiesRequest. + * @implements IAnalyzeEntitiesRequest * @constructor - * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest=} [properties] Properties to set */ - function AnalyzeSyntaxRequest(properties) { + function AnalyzeEntitiesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6207,43 +6378,43 @@ } /** - * AnalyzeSyntaxRequest document. + * AnalyzeEntitiesRequest document. * @member {google.cloud.language.v1.IDocument|null|undefined} document - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @instance */ - AnalyzeSyntaxRequest.prototype.document = null; + AnalyzeEntitiesRequest.prototype.document = null; /** - * AnalyzeSyntaxRequest encodingType. + * AnalyzeEntitiesRequest encodingType. * @member {google.cloud.language.v1.EncodingType} encodingType - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @instance */ - AnalyzeSyntaxRequest.prototype.encodingType = 0; + AnalyzeEntitiesRequest.prototype.encodingType = 0; /** - * Creates a new AnalyzeSyntaxRequest instance using the specified properties. + * Creates a new AnalyzeEntitiesRequest instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static - * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest instance + * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest instance */ - AnalyzeSyntaxRequest.create = function create(properties) { - return new AnalyzeSyntaxRequest(properties); + AnalyzeEntitiesRequest.create = function create(properties) { + return new AnalyzeEntitiesRequest(properties); }; /** - * Encodes the specified AnalyzeSyntaxRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxRequest.verify|verify} messages. + * Encodes the specified AnalyzeEntitiesRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static - * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest} message AnalyzeSyntaxRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest} message AnalyzeEntitiesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeSyntaxRequest.encode = function encode(message, writer) { + AnalyzeEntitiesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.document != null && Object.hasOwnProperty.call(message, "document")) @@ -6254,33 +6425,33 @@ }; /** - * Encodes the specified AnalyzeSyntaxRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxRequest.verify|verify} messages. + * Encodes the specified AnalyzeEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static - * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest} message AnalyzeSyntaxRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitiesRequest} message AnalyzeEntitiesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeSyntaxRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnalyzeSyntaxRequest message from the specified reader or buffer. + * Decodes an AnalyzeEntitiesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest + * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeSyntaxRequest.decode = function decode(reader, length) { + AnalyzeEntitiesRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSyntaxRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitiesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -6301,30 +6472,30 @@ }; /** - * Decodes an AnalyzeSyntaxRequest message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeEntitiesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest + * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeSyntaxRequest.decodeDelimited = function decodeDelimited(reader) { + AnalyzeEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnalyzeSyntaxRequest message. + * Verifies an AnalyzeEntitiesRequest message. * @function verify - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnalyzeSyntaxRequest.verify = function verify(message) { + AnalyzeEntitiesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.document != null && message.hasOwnProperty("document")) { @@ -6346,20 +6517,20 @@ }; /** - * Creates an AnalyzeSyntaxRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeEntitiesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest + * @returns {google.cloud.language.v1.AnalyzeEntitiesRequest} AnalyzeEntitiesRequest */ - AnalyzeSyntaxRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeSyntaxRequest) + AnalyzeEntitiesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitiesRequest) return object; - var message = new $root.google.cloud.language.v1.AnalyzeSyntaxRequest(); + var message = new $root.google.cloud.language.v1.AnalyzeEntitiesRequest(); if (object.document != null) { if (typeof object.document !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxRequest.document: object expected"); + throw TypeError(".google.cloud.language.v1.AnalyzeEntitiesRequest.document: object expected"); message.document = $root.google.cloud.language.v1.Document.fromObject(object.document); } switch (object.encodingType) { @@ -6384,15 +6555,15 @@ }; /** - * Creates a plain object from an AnalyzeSyntaxRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeEntitiesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static - * @param {google.cloud.language.v1.AnalyzeSyntaxRequest} message AnalyzeSyntaxRequest + * @param {google.cloud.language.v1.AnalyzeEntitiesRequest} message AnalyzeEntitiesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyzeSyntaxRequest.toObject = function toObject(message, options) { + AnalyzeEntitiesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -6408,56 +6579,54 @@ }; /** - * Converts this AnalyzeSyntaxRequest to JSON. + * Converts this AnalyzeEntitiesRequest to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @instance * @returns {Object.} JSON object */ - AnalyzeSyntaxRequest.prototype.toJSON = function toJSON() { + AnalyzeEntitiesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnalyzeSyntaxRequest + * Gets the default type url for AnalyzeEntitiesRequest * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @memberof google.cloud.language.v1.AnalyzeEntitiesRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnalyzeSyntaxRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSyntaxRequest"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitiesRequest"; }; - return AnalyzeSyntaxRequest; + return AnalyzeEntitiesRequest; })(); - v1.AnalyzeSyntaxResponse = (function() { + v1.AnalyzeEntitiesResponse = (function() { /** - * Properties of an AnalyzeSyntaxResponse. + * Properties of an AnalyzeEntitiesResponse. * @memberof google.cloud.language.v1 - * @interface IAnalyzeSyntaxResponse - * @property {Array.|null} [sentences] AnalyzeSyntaxResponse sentences - * @property {Array.|null} [tokens] AnalyzeSyntaxResponse tokens - * @property {string|null} [language] AnalyzeSyntaxResponse language + * @interface IAnalyzeEntitiesResponse + * @property {Array.|null} [entities] AnalyzeEntitiesResponse entities + * @property {string|null} [language] AnalyzeEntitiesResponse language */ /** - * Constructs a new AnalyzeSyntaxResponse. + * Constructs a new AnalyzeEntitiesResponse. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnalyzeSyntaxResponse. - * @implements IAnalyzeSyntaxResponse + * @classdesc Represents an AnalyzeEntitiesResponse. + * @implements IAnalyzeEntitiesResponse * @constructor - * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse=} [properties] Properties to set */ - function AnalyzeSyntaxResponse(properties) { - this.sentences = []; - this.tokens = []; + function AnalyzeEntitiesResponse(properties) { + this.entities = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6465,108 +6634,91 @@ } /** - * AnalyzeSyntaxResponse sentences. - * @member {Array.} sentences - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse - * @instance - */ - AnalyzeSyntaxResponse.prototype.sentences = $util.emptyArray; - - /** - * AnalyzeSyntaxResponse tokens. - * @member {Array.} tokens - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * AnalyzeEntitiesResponse entities. + * @member {Array.} entities + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @instance */ - AnalyzeSyntaxResponse.prototype.tokens = $util.emptyArray; + AnalyzeEntitiesResponse.prototype.entities = $util.emptyArray; /** - * AnalyzeSyntaxResponse language. + * AnalyzeEntitiesResponse language. * @member {string} language - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @instance */ - AnalyzeSyntaxResponse.prototype.language = ""; + AnalyzeEntitiesResponse.prototype.language = ""; /** - * Creates a new AnalyzeSyntaxResponse instance using the specified properties. + * Creates a new AnalyzeEntitiesResponse instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static - * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse instance + * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse instance */ - AnalyzeSyntaxResponse.create = function create(properties) { - return new AnalyzeSyntaxResponse(properties); + AnalyzeEntitiesResponse.create = function create(properties) { + return new AnalyzeEntitiesResponse(properties); }; /** - * Encodes the specified AnalyzeSyntaxResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxResponse.verify|verify} messages. + * Encodes the specified AnalyzeEntitiesResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static - * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse} message AnalyzeSyntaxResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse} message AnalyzeEntitiesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeSyntaxResponse.encode = function encode(message, writer) { + AnalyzeEntitiesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.sentences != null && message.sentences.length) - for (var i = 0; i < message.sentences.length; ++i) - $root.google.cloud.language.v1.Sentence.encode(message.sentences[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.tokens != null && message.tokens.length) - for (var i = 0; i < message.tokens.length; ++i) - $root.google.cloud.language.v1.Token.encode(message.tokens[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.language.v1.Entity.encode(message.entities[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.language != null && Object.hasOwnProperty.call(message, "language")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.language); + writer.uint32(/* id 2, wireType 2 =*/18).string(message.language); return writer; }; /** - * Encodes the specified AnalyzeSyntaxResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxResponse.verify|verify} messages. + * Encodes the specified AnalyzeEntitiesResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeEntitiesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static - * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse} message AnalyzeSyntaxResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeEntitiesResponse} message AnalyzeEntitiesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyzeSyntaxResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeEntitiesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnalyzeSyntaxResponse message from the specified reader or buffer. + * Decodes an AnalyzeEntitiesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse + * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeSyntaxResponse.decode = function decode(reader, length) { + AnalyzeEntitiesResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSyntaxResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeEntitiesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.sentences && message.sentences.length)) - message.sentences = []; - message.sentences.push($root.google.cloud.language.v1.Sentence.decode(reader, reader.uint32())); + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.language.v1.Entity.decode(reader, reader.uint32())); break; } case 2: { - if (!(message.tokens && message.tokens.length)) - message.tokens = []; - message.tokens.push($root.google.cloud.language.v1.Token.decode(reader, reader.uint32())); - break; - } - case 3: { message.language = reader.string(); break; } @@ -6579,48 +6731,39 @@ }; /** - * Decodes an AnalyzeSyntaxResponse message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeEntitiesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse + * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnalyzeSyntaxResponse.decodeDelimited = function decodeDelimited(reader) { + AnalyzeEntitiesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnalyzeSyntaxResponse message. + * Verifies an AnalyzeEntitiesResponse message. * @function verify - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnalyzeSyntaxResponse.verify = function verify(message) { + AnalyzeEntitiesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.sentences != null && message.hasOwnProperty("sentences")) { - if (!Array.isArray(message.sentences)) - return "sentences: array expected"; - for (var i = 0; i < message.sentences.length; ++i) { - var error = $root.google.cloud.language.v1.Sentence.verify(message.sentences[i]); - if (error) - return "sentences." + error; - } - } - if (message.tokens != null && message.hasOwnProperty("tokens")) { - if (!Array.isArray(message.tokens)) - return "tokens: array expected"; - for (var i = 0; i < message.tokens.length; ++i) { - var error = $root.google.cloud.language.v1.Token.verify(message.tokens[i]); + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.language.v1.Entity.verify(message.entities[i]); if (error) - return "tokens." + error; + return "entities." + error; } } if (message.language != null && message.hasOwnProperty("language")) @@ -6630,35 +6773,25 @@ }; /** - * Creates an AnalyzeSyntaxResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeEntitiesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse + * @returns {google.cloud.language.v1.AnalyzeEntitiesResponse} AnalyzeEntitiesResponse */ - AnalyzeSyntaxResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnalyzeSyntaxResponse) + AnalyzeEntitiesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeEntitiesResponse) return object; - var message = new $root.google.cloud.language.v1.AnalyzeSyntaxResponse(); - if (object.sentences) { - if (!Array.isArray(object.sentences)) - throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.sentences: array expected"); - message.sentences = []; - for (var i = 0; i < object.sentences.length; ++i) { - if (typeof object.sentences[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.sentences: object expected"); - message.sentences[i] = $root.google.cloud.language.v1.Sentence.fromObject(object.sentences[i]); - } - } - if (object.tokens) { - if (!Array.isArray(object.tokens)) - throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.tokens: array expected"); - message.tokens = []; - for (var i = 0; i < object.tokens.length; ++i) { - if (typeof object.tokens[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.tokens: object expected"); - message.tokens[i] = $root.google.cloud.language.v1.Token.fromObject(object.tokens[i]); + var message = new $root.google.cloud.language.v1.AnalyzeEntitiesResponse(); + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.language.v1.AnalyzeEntitiesResponse.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnalyzeEntitiesResponse.entities: object expected"); + message.entities[i] = $root.google.cloud.language.v1.Entity.fromObject(object.entities[i]); } } if (object.language != null) @@ -6667,33 +6800,26 @@ }; /** - * Creates a plain object from an AnalyzeSyntaxResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeEntitiesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static - * @param {google.cloud.language.v1.AnalyzeSyntaxResponse} message AnalyzeSyntaxResponse + * @param {google.cloud.language.v1.AnalyzeEntitiesResponse} message AnalyzeEntitiesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyzeSyntaxResponse.toObject = function toObject(message, options) { + AnalyzeEntitiesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.sentences = []; - object.tokens = []; - } + if (options.arrays || options.defaults) + object.entities = []; if (options.defaults) object.language = ""; - if (message.sentences && message.sentences.length) { - object.sentences = []; - for (var j = 0; j < message.sentences.length; ++j) - object.sentences[j] = $root.google.cloud.language.v1.Sentence.toObject(message.sentences[j], options); - } - if (message.tokens && message.tokens.length) { - object.tokens = []; - for (var j = 0; j < message.tokens.length; ++j) - object.tokens[j] = $root.google.cloud.language.v1.Token.toObject(message.tokens[j], options); + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.language.v1.Entity.toObject(message.entities[j], options); } if (message.language != null && message.hasOwnProperty("language")) object.language = message.language; @@ -6701,52 +6827,53 @@ }; /** - * Converts this AnalyzeSyntaxResponse to JSON. + * Converts this AnalyzeEntitiesResponse to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @instance * @returns {Object.} JSON object */ - AnalyzeSyntaxResponse.prototype.toJSON = function toJSON() { + AnalyzeEntitiesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnalyzeSyntaxResponse + * Gets the default type url for AnalyzeEntitiesResponse * @function getTypeUrl - * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @memberof google.cloud.language.v1.AnalyzeEntitiesResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnalyzeSyntaxResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeEntitiesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSyntaxResponse"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeEntitiesResponse"; }; - return AnalyzeSyntaxResponse; + return AnalyzeEntitiesResponse; })(); - v1.ClassifyTextRequest = (function() { + v1.AnalyzeSyntaxRequest = (function() { /** - * Properties of a ClassifyTextRequest. + * Properties of an AnalyzeSyntaxRequest. * @memberof google.cloud.language.v1 - * @interface IClassifyTextRequest - * @property {google.cloud.language.v1.IDocument|null} [document] ClassifyTextRequest document + * @interface IAnalyzeSyntaxRequest + * @property {google.cloud.language.v1.IDocument|null} [document] AnalyzeSyntaxRequest document + * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnalyzeSyntaxRequest encodingType */ /** - * Constructs a new ClassifyTextRequest. + * Constructs a new AnalyzeSyntaxRequest. * @memberof google.cloud.language.v1 - * @classdesc Represents a ClassifyTextRequest. - * @implements IClassifyTextRequest + * @classdesc Represents an AnalyzeSyntaxRequest. + * @implements IAnalyzeSyntaxRequest * @constructor - * @param {google.cloud.language.v1.IClassifyTextRequest=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest=} [properties] Properties to set */ - function ClassifyTextRequest(properties) { + function AnalyzeSyntaxRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6754,70 +6881,80 @@ } /** - * ClassifyTextRequest document. + * AnalyzeSyntaxRequest document. * @member {google.cloud.language.v1.IDocument|null|undefined} document - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @instance */ - ClassifyTextRequest.prototype.document = null; + AnalyzeSyntaxRequest.prototype.document = null; /** - * Creates a new ClassifyTextRequest instance using the specified properties. + * AnalyzeSyntaxRequest encodingType. + * @member {google.cloud.language.v1.EncodingType} encodingType + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest + * @instance + */ + AnalyzeSyntaxRequest.prototype.encodingType = 0; + + /** + * Creates a new AnalyzeSyntaxRequest instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static - * @param {google.cloud.language.v1.IClassifyTextRequest=} [properties] Properties to set - * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest instance + * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest instance */ - ClassifyTextRequest.create = function create(properties) { - return new ClassifyTextRequest(properties); + AnalyzeSyntaxRequest.create = function create(properties) { + return new AnalyzeSyntaxRequest(properties); }; /** - * Encodes the specified ClassifyTextRequest message. Does not implicitly {@link google.cloud.language.v1.ClassifyTextRequest.verify|verify} messages. + * Encodes the specified AnalyzeSyntaxRequest message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static - * @param {google.cloud.language.v1.IClassifyTextRequest} message ClassifyTextRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest} message AnalyzeSyntaxRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ClassifyTextRequest.encode = function encode(message, writer) { + AnalyzeSyntaxRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.document != null && Object.hasOwnProperty.call(message, "document")) $root.google.cloud.language.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.encodingType != null && Object.hasOwnProperty.call(message, "encodingType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.encodingType); return writer; }; /** - * Encodes the specified ClassifyTextRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassifyTextRequest.verify|verify} messages. + * Encodes the specified AnalyzeSyntaxRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static - * @param {google.cloud.language.v1.IClassifyTextRequest} message ClassifyTextRequest message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSyntaxRequest} message AnalyzeSyntaxRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ClassifyTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeSyntaxRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ClassifyTextRequest message from the specified reader or buffer. + * Decodes an AnalyzeSyntaxRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest + * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ClassifyTextRequest.decode = function decode(reader, length) { + AnalyzeSyntaxRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.ClassifyTextRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSyntaxRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -6825,6 +6962,10 @@ message.document = $root.google.cloud.language.v1.Document.decode(reader, reader.uint32()); break; } + case 2: { + message.encodingType = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -6834,30 +6975,30 @@ }; /** - * Decodes a ClassifyTextRequest message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeSyntaxRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest + * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ClassifyTextRequest.decodeDelimited = function decodeDelimited(reader) { + AnalyzeSyntaxRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ClassifyTextRequest message. + * Verifies an AnalyzeSyntaxRequest message. * @function verify - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ClassifyTextRequest.verify = function verify(message) { + AnalyzeSyntaxRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.document != null && message.hasOwnProperty("document")) { @@ -6865,97 +7006,132 @@ if (error) return "document." + error; } + if (message.encodingType != null && message.hasOwnProperty("encodingType")) + switch (message.encodingType) { + default: + return "encodingType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } return null; }; /** - * Creates a ClassifyTextRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeSyntaxRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest + * @returns {google.cloud.language.v1.AnalyzeSyntaxRequest} AnalyzeSyntaxRequest */ - ClassifyTextRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.ClassifyTextRequest) + AnalyzeSyntaxRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeSyntaxRequest) return object; - var message = new $root.google.cloud.language.v1.ClassifyTextRequest(); + var message = new $root.google.cloud.language.v1.AnalyzeSyntaxRequest(); if (object.document != null) { if (typeof object.document !== "object") - throw TypeError(".google.cloud.language.v1.ClassifyTextRequest.document: object expected"); + throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxRequest.document: object expected"); message.document = $root.google.cloud.language.v1.Document.fromObject(object.document); } + switch (object.encodingType) { + case "NONE": + case 0: + message.encodingType = 0; + break; + case "UTF8": + case 1: + message.encodingType = 1; + break; + case "UTF16": + case 2: + message.encodingType = 2; + break; + case "UTF32": + case 3: + message.encodingType = 3; + break; + } return message; }; /** - * Creates a plain object from a ClassifyTextRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeSyntaxRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static - * @param {google.cloud.language.v1.ClassifyTextRequest} message ClassifyTextRequest + * @param {google.cloud.language.v1.AnalyzeSyntaxRequest} message AnalyzeSyntaxRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ClassifyTextRequest.toObject = function toObject(message, options) { + AnalyzeSyntaxRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.document = null; + object.encodingType = options.enums === String ? "NONE" : 0; + } if (message.document != null && message.hasOwnProperty("document")) object.document = $root.google.cloud.language.v1.Document.toObject(message.document, options); + if (message.encodingType != null && message.hasOwnProperty("encodingType")) + object.encodingType = options.enums === String ? $root.google.cloud.language.v1.EncodingType[message.encodingType] : message.encodingType; return object; }; /** - * Converts this ClassifyTextRequest to JSON. + * Converts this AnalyzeSyntaxRequest to JSON. * @function toJSON - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @instance * @returns {Object.} JSON object */ - ClassifyTextRequest.prototype.toJSON = function toJSON() { + AnalyzeSyntaxRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ClassifyTextRequest + * Gets the default type url for AnalyzeSyntaxRequest * @function getTypeUrl - * @memberof google.cloud.language.v1.ClassifyTextRequest + * @memberof google.cloud.language.v1.AnalyzeSyntaxRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ClassifyTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeSyntaxRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.ClassifyTextRequest"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSyntaxRequest"; }; - return ClassifyTextRequest; + return AnalyzeSyntaxRequest; })(); - v1.ClassifyTextResponse = (function() { + v1.AnalyzeSyntaxResponse = (function() { /** - * Properties of a ClassifyTextResponse. + * Properties of an AnalyzeSyntaxResponse. * @memberof google.cloud.language.v1 - * @interface IClassifyTextResponse - * @property {Array.|null} [categories] ClassifyTextResponse categories + * @interface IAnalyzeSyntaxResponse + * @property {Array.|null} [sentences] AnalyzeSyntaxResponse sentences + * @property {Array.|null} [tokens] AnalyzeSyntaxResponse tokens + * @property {string|null} [language] AnalyzeSyntaxResponse language */ /** - * Constructs a new ClassifyTextResponse. + * Constructs a new AnalyzeSyntaxResponse. * @memberof google.cloud.language.v1 - * @classdesc Represents a ClassifyTextResponse. - * @implements IClassifyTextResponse + * @classdesc Represents an AnalyzeSyntaxResponse. + * @implements IAnalyzeSyntaxResponse * @constructor - * @param {google.cloud.language.v1.IClassifyTextResponse=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse=} [properties] Properties to set */ - function ClassifyTextResponse(properties) { - this.categories = []; + function AnalyzeSyntaxResponse(properties) { + this.sentences = []; + this.tokens = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6963,78 +7139,109 @@ } /** - * ClassifyTextResponse categories. - * @member {Array.} categories - * @memberof google.cloud.language.v1.ClassifyTextResponse + * AnalyzeSyntaxResponse sentences. + * @member {Array.} sentences + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @instance */ - ClassifyTextResponse.prototype.categories = $util.emptyArray; + AnalyzeSyntaxResponse.prototype.sentences = $util.emptyArray; /** - * Creates a new ClassifyTextResponse instance using the specified properties. - * @function create - * @memberof google.cloud.language.v1.ClassifyTextResponse - * @static - * @param {google.cloud.language.v1.IClassifyTextResponse=} [properties] Properties to set - * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse instance - */ - ClassifyTextResponse.create = function create(properties) { - return new ClassifyTextResponse(properties); + * AnalyzeSyntaxResponse tokens. + * @member {Array.} tokens + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @instance + */ + AnalyzeSyntaxResponse.prototype.tokens = $util.emptyArray; + + /** + * AnalyzeSyntaxResponse language. + * @member {string} language + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @instance + */ + AnalyzeSyntaxResponse.prototype.language = ""; + + /** + * Creates a new AnalyzeSyntaxResponse instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse + * @static + * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse instance + */ + AnalyzeSyntaxResponse.create = function create(properties) { + return new AnalyzeSyntaxResponse(properties); }; /** - * Encodes the specified ClassifyTextResponse message. Does not implicitly {@link google.cloud.language.v1.ClassifyTextResponse.verify|verify} messages. + * Encodes the specified AnalyzeSyntaxResponse message. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static - * @param {google.cloud.language.v1.IClassifyTextResponse} message ClassifyTextResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse} message AnalyzeSyntaxResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ClassifyTextResponse.encode = function encode(message, writer) { + AnalyzeSyntaxResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - $root.google.cloud.language.v1.ClassificationCategory.encode(message.categories[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.sentences != null && message.sentences.length) + for (var i = 0; i < message.sentences.length; ++i) + $root.google.cloud.language.v1.Sentence.encode(message.sentences[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.tokens != null && message.tokens.length) + for (var i = 0; i < message.tokens.length; ++i) + $root.google.cloud.language.v1.Token.encode(message.tokens[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.language != null && Object.hasOwnProperty.call(message, "language")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.language); return writer; }; /** - * Encodes the specified ClassifyTextResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassifyTextResponse.verify|verify} messages. + * Encodes the specified AnalyzeSyntaxResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnalyzeSyntaxResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static - * @param {google.cloud.language.v1.IClassifyTextResponse} message ClassifyTextResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnalyzeSyntaxResponse} message AnalyzeSyntaxResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ClassifyTextResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnalyzeSyntaxResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ClassifyTextResponse message from the specified reader or buffer. + * Decodes an AnalyzeSyntaxResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse + * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ClassifyTextResponse.decode = function decode(reader, length) { + AnalyzeSyntaxResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.ClassifyTextResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnalyzeSyntaxResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push($root.google.cloud.language.v1.ClassificationCategory.decode(reader, reader.uint32())); + if (!(message.sentences && message.sentences.length)) + message.sentences = []; + message.sentences.push($root.google.cloud.language.v1.Sentence.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.language.v1.Token.decode(reader, reader.uint32())); + break; + } + case 3: { + message.language = reader.string(); break; } default: @@ -7046,141 +7253,175 @@ }; /** - * Decodes a ClassifyTextResponse message from the specified reader or buffer, length delimited. + * Decodes an AnalyzeSyntaxResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse + * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ClassifyTextResponse.decodeDelimited = function decodeDelimited(reader) { + AnalyzeSyntaxResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ClassifyTextResponse message. + * Verifies an AnalyzeSyntaxResponse message. * @function verify - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ClassifyTextResponse.verify = function verify(message) { + AnalyzeSyntaxResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.categories != null && message.hasOwnProperty("categories")) { - if (!Array.isArray(message.categories)) - return "categories: array expected"; - for (var i = 0; i < message.categories.length; ++i) { - var error = $root.google.cloud.language.v1.ClassificationCategory.verify(message.categories[i]); + if (message.sentences != null && message.hasOwnProperty("sentences")) { + if (!Array.isArray(message.sentences)) + return "sentences: array expected"; + for (var i = 0; i < message.sentences.length; ++i) { + var error = $root.google.cloud.language.v1.Sentence.verify(message.sentences[i]); if (error) - return "categories." + error; + return "sentences." + error; + } + } + if (message.tokens != null && message.hasOwnProperty("tokens")) { + if (!Array.isArray(message.tokens)) + return "tokens: array expected"; + for (var i = 0; i < message.tokens.length; ++i) { + var error = $root.google.cloud.language.v1.Token.verify(message.tokens[i]); + if (error) + return "tokens." + error; } } + if (message.language != null && message.hasOwnProperty("language")) + if (!$util.isString(message.language)) + return "language: string expected"; return null; }; /** - * Creates a ClassifyTextResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnalyzeSyntaxResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse + * @returns {google.cloud.language.v1.AnalyzeSyntaxResponse} AnalyzeSyntaxResponse */ - ClassifyTextResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.ClassifyTextResponse) + AnalyzeSyntaxResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnalyzeSyntaxResponse) return object; - var message = new $root.google.cloud.language.v1.ClassifyTextResponse(); - if (object.categories) { - if (!Array.isArray(object.categories)) - throw TypeError(".google.cloud.language.v1.ClassifyTextResponse.categories: array expected"); - message.categories = []; - for (var i = 0; i < object.categories.length; ++i) { - if (typeof object.categories[i] !== "object") - throw TypeError(".google.cloud.language.v1.ClassifyTextResponse.categories: object expected"); - message.categories[i] = $root.google.cloud.language.v1.ClassificationCategory.fromObject(object.categories[i]); + var message = new $root.google.cloud.language.v1.AnalyzeSyntaxResponse(); + if (object.sentences) { + if (!Array.isArray(object.sentences)) + throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.sentences: array expected"); + message.sentences = []; + for (var i = 0; i < object.sentences.length; ++i) { + if (typeof object.sentences[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.sentences: object expected"); + message.sentences[i] = $root.google.cloud.language.v1.Sentence.fromObject(object.sentences[i]); + } + } + if (object.tokens) { + if (!Array.isArray(object.tokens)) + throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.tokens: array expected"); + message.tokens = []; + for (var i = 0; i < object.tokens.length; ++i) { + if (typeof object.tokens[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnalyzeSyntaxResponse.tokens: object expected"); + message.tokens[i] = $root.google.cloud.language.v1.Token.fromObject(object.tokens[i]); } } + if (object.language != null) + message.language = String(object.language); return message; }; /** - * Creates a plain object from a ClassifyTextResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnalyzeSyntaxResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static - * @param {google.cloud.language.v1.ClassifyTextResponse} message ClassifyTextResponse + * @param {google.cloud.language.v1.AnalyzeSyntaxResponse} message AnalyzeSyntaxResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ClassifyTextResponse.toObject = function toObject(message, options) { + AnalyzeSyntaxResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.categories = []; - if (message.categories && message.categories.length) { - object.categories = []; - for (var j = 0; j < message.categories.length; ++j) - object.categories[j] = $root.google.cloud.language.v1.ClassificationCategory.toObject(message.categories[j], options); + if (options.arrays || options.defaults) { + object.sentences = []; + object.tokens = []; + } + if (options.defaults) + object.language = ""; + if (message.sentences && message.sentences.length) { + object.sentences = []; + for (var j = 0; j < message.sentences.length; ++j) + object.sentences[j] = $root.google.cloud.language.v1.Sentence.toObject(message.sentences[j], options); + } + if (message.tokens && message.tokens.length) { + object.tokens = []; + for (var j = 0; j < message.tokens.length; ++j) + object.tokens[j] = $root.google.cloud.language.v1.Token.toObject(message.tokens[j], options); } + if (message.language != null && message.hasOwnProperty("language")) + object.language = message.language; return object; }; /** - * Converts this ClassifyTextResponse to JSON. + * Converts this AnalyzeSyntaxResponse to JSON. * @function toJSON - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @instance * @returns {Object.} JSON object */ - ClassifyTextResponse.prototype.toJSON = function toJSON() { + AnalyzeSyntaxResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ClassifyTextResponse + * Gets the default type url for AnalyzeSyntaxResponse * @function getTypeUrl - * @memberof google.cloud.language.v1.ClassifyTextResponse + * @memberof google.cloud.language.v1.AnalyzeSyntaxResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ClassifyTextResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnalyzeSyntaxResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.ClassifyTextResponse"; + return typeUrlPrefix + "/google.cloud.language.v1.AnalyzeSyntaxResponse"; }; - return ClassifyTextResponse; + return AnalyzeSyntaxResponse; })(); - v1.AnnotateTextRequest = (function() { + v1.ClassifyTextRequest = (function() { /** - * Properties of an AnnotateTextRequest. + * Properties of a ClassifyTextRequest. * @memberof google.cloud.language.v1 - * @interface IAnnotateTextRequest - * @property {google.cloud.language.v1.IDocument|null} [document] AnnotateTextRequest document - * @property {google.cloud.language.v1.AnnotateTextRequest.IFeatures|null} [features] AnnotateTextRequest features - * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnnotateTextRequest encodingType + * @interface IClassifyTextRequest + * @property {google.cloud.language.v1.IDocument|null} [document] ClassifyTextRequest document + * @property {google.cloud.language.v1.IClassificationModelOptions|null} [classificationModelOptions] ClassifyTextRequest classificationModelOptions */ /** - * Constructs a new AnnotateTextRequest. + * Constructs a new ClassifyTextRequest. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnnotateTextRequest. - * @implements IAnnotateTextRequest + * @classdesc Represents a ClassifyTextRequest. + * @implements IClassifyTextRequest * @constructor - * @param {google.cloud.language.v1.IAnnotateTextRequest=} [properties] Properties to set + * @param {google.cloud.language.v1.IClassifyTextRequest=} [properties] Properties to set */ - function AnnotateTextRequest(properties) { + function ClassifyTextRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7188,90 +7429,80 @@ } /** - * AnnotateTextRequest document. + * ClassifyTextRequest document. * @member {google.cloud.language.v1.IDocument|null|undefined} document - * @memberof google.cloud.language.v1.AnnotateTextRequest - * @instance - */ - AnnotateTextRequest.prototype.document = null; - - /** - * AnnotateTextRequest features. - * @member {google.cloud.language.v1.AnnotateTextRequest.IFeatures|null|undefined} features - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @instance */ - AnnotateTextRequest.prototype.features = null; + ClassifyTextRequest.prototype.document = null; /** - * AnnotateTextRequest encodingType. - * @member {google.cloud.language.v1.EncodingType} encodingType - * @memberof google.cloud.language.v1.AnnotateTextRequest + * ClassifyTextRequest classificationModelOptions. + * @member {google.cloud.language.v1.IClassificationModelOptions|null|undefined} classificationModelOptions + * @memberof google.cloud.language.v1.ClassifyTextRequest * @instance */ - AnnotateTextRequest.prototype.encodingType = 0; + ClassifyTextRequest.prototype.classificationModelOptions = null; /** - * Creates a new AnnotateTextRequest instance using the specified properties. + * Creates a new ClassifyTextRequest instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static - * @param {google.cloud.language.v1.IAnnotateTextRequest=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest instance + * @param {google.cloud.language.v1.IClassifyTextRequest=} [properties] Properties to set + * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest instance */ - AnnotateTextRequest.create = function create(properties) { - return new AnnotateTextRequest(properties); + ClassifyTextRequest.create = function create(properties) { + return new ClassifyTextRequest(properties); }; /** - * Encodes the specified AnnotateTextRequest message. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.verify|verify} messages. + * Encodes the specified ClassifyTextRequest message. Does not implicitly {@link google.cloud.language.v1.ClassifyTextRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static - * @param {google.cloud.language.v1.IAnnotateTextRequest} message AnnotateTextRequest message or plain object to encode + * @param {google.cloud.language.v1.IClassifyTextRequest} message ClassifyTextRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateTextRequest.encode = function encode(message, writer) { + ClassifyTextRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.document != null && Object.hasOwnProperty.call(message, "document")) $root.google.cloud.language.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.cloud.language.v1.AnnotateTextRequest.Features.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.encodingType != null && Object.hasOwnProperty.call(message, "encodingType")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.encodingType); + if (message.classificationModelOptions != null && Object.hasOwnProperty.call(message, "classificationModelOptions")) + $root.google.cloud.language.v1.ClassificationModelOptions.encode(message.classificationModelOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateTextRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.verify|verify} messages. + * Encodes the specified ClassifyTextRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassifyTextRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static - * @param {google.cloud.language.v1.IAnnotateTextRequest} message AnnotateTextRequest message or plain object to encode + * @param {google.cloud.language.v1.IClassifyTextRequest} message ClassifyTextRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + ClassifyTextRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateTextRequest message from the specified reader or buffer. + * Decodes a ClassifyTextRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest + * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateTextRequest.decode = function decode(reader, length) { + ClassifyTextRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnnotateTextRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.ClassifyTextRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -7279,12 +7510,8 @@ message.document = $root.google.cloud.language.v1.Document.decode(reader, reader.uint32()); break; } - case 2: { - message.features = $root.google.cloud.language.v1.AnnotateTextRequest.Features.decode(reader, reader.uint32()); - break; - } case 3: { - message.encodingType = reader.int32(); + message.classificationModelOptions = $root.google.cloud.language.v1.ClassificationModelOptions.decode(reader, reader.uint32()); break; } default: @@ -7296,30 +7523,30 @@ }; /** - * Decodes an AnnotateTextRequest message from the specified reader or buffer, length delimited. + * Decodes a ClassifyTextRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest + * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateTextRequest.decodeDelimited = function decodeDelimited(reader) { + ClassifyTextRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateTextRequest message. + * Verifies a ClassifyTextRequest message. * @function verify - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateTextRequest.verify = function verify(message) { + ClassifyTextRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.document != null && message.hasOwnProperty("document")) { @@ -7327,446 +7554,336 @@ if (error) return "document." + error; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.cloud.language.v1.AnnotateTextRequest.Features.verify(message.features); + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) { + var error = $root.google.cloud.language.v1.ClassificationModelOptions.verify(message.classificationModelOptions); if (error) - return "features." + error; + return "classificationModelOptions." + error; } - if (message.encodingType != null && message.hasOwnProperty("encodingType")) - switch (message.encodingType) { - default: - return "encodingType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } return null; }; /** - * Creates an AnnotateTextRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ClassifyTextRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest + * @returns {google.cloud.language.v1.ClassifyTextRequest} ClassifyTextRequest */ - AnnotateTextRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnnotateTextRequest) + ClassifyTextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.ClassifyTextRequest) return object; - var message = new $root.google.cloud.language.v1.AnnotateTextRequest(); + var message = new $root.google.cloud.language.v1.ClassifyTextRequest(); if (object.document != null) { if (typeof object.document !== "object") - throw TypeError(".google.cloud.language.v1.AnnotateTextRequest.document: object expected"); + throw TypeError(".google.cloud.language.v1.ClassifyTextRequest.document: object expected"); message.document = $root.google.cloud.language.v1.Document.fromObject(object.document); } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.cloud.language.v1.AnnotateTextRequest.features: object expected"); - message.features = $root.google.cloud.language.v1.AnnotateTextRequest.Features.fromObject(object.features); - } - switch (object.encodingType) { - case "NONE": - case 0: - message.encodingType = 0; - break; - case "UTF8": - case 1: - message.encodingType = 1; - break; - case "UTF16": - case 2: - message.encodingType = 2; - break; - case "UTF32": - case 3: - message.encodingType = 3; - break; + if (object.classificationModelOptions != null) { + if (typeof object.classificationModelOptions !== "object") + throw TypeError(".google.cloud.language.v1.ClassifyTextRequest.classificationModelOptions: object expected"); + message.classificationModelOptions = $root.google.cloud.language.v1.ClassificationModelOptions.fromObject(object.classificationModelOptions); } return message; }; /** - * Creates a plain object from an AnnotateTextRequest message. Also converts values to other types if specified. + * Creates a plain object from a ClassifyTextRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static - * @param {google.cloud.language.v1.AnnotateTextRequest} message AnnotateTextRequest + * @param {google.cloud.language.v1.ClassifyTextRequest} message ClassifyTextRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateTextRequest.toObject = function toObject(message, options) { + ClassifyTextRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.document = null; - object.features = null; - object.encodingType = options.enums === String ? "NONE" : 0; + object.classificationModelOptions = null; } if (message.document != null && message.hasOwnProperty("document")) object.document = $root.google.cloud.language.v1.Document.toObject(message.document, options); - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.cloud.language.v1.AnnotateTextRequest.Features.toObject(message.features, options); - if (message.encodingType != null && message.hasOwnProperty("encodingType")) - object.encodingType = options.enums === String ? $root.google.cloud.language.v1.EncodingType[message.encodingType] : message.encodingType; + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) + object.classificationModelOptions = $root.google.cloud.language.v1.ClassificationModelOptions.toObject(message.classificationModelOptions, options); return object; }; /** - * Converts this AnnotateTextRequest to JSON. + * Converts this ClassifyTextRequest to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @instance * @returns {Object.} JSON object */ - AnnotateTextRequest.prototype.toJSON = function toJSON() { + ClassifyTextRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnnotateTextRequest + * Gets the default type url for ClassifyTextRequest * @function getTypeUrl - * @memberof google.cloud.language.v1.AnnotateTextRequest + * @memberof google.cloud.language.v1.ClassifyTextRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnnotateTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ClassifyTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnnotateTextRequest"; + return typeUrlPrefix + "/google.cloud.language.v1.ClassifyTextRequest"; }; - AnnotateTextRequest.Features = (function() { - - /** - * Properties of a Features. - * @memberof google.cloud.language.v1.AnnotateTextRequest - * @interface IFeatures - * @property {boolean|null} [extractSyntax] Features extractSyntax - * @property {boolean|null} [extractEntities] Features extractEntities - * @property {boolean|null} [extractDocumentSentiment] Features extractDocumentSentiment - * @property {boolean|null} [extractEntitySentiment] Features extractEntitySentiment - * @property {boolean|null} [classifyText] Features classifyText - */ + return ClassifyTextRequest; + })(); - /** - * Constructs a new Features. - * @memberof google.cloud.language.v1.AnnotateTextRequest - * @classdesc Represents a Features. - * @implements IFeatures - * @constructor - * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures=} [properties] Properties to set - */ - function Features(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v1.ClassifyTextResponse = (function() { - /** - * Features extractSyntax. - * @member {boolean} extractSyntax - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @instance - */ - Features.prototype.extractSyntax = false; + /** + * Properties of a ClassifyTextResponse. + * @memberof google.cloud.language.v1 + * @interface IClassifyTextResponse + * @property {Array.|null} [categories] ClassifyTextResponse categories + */ - /** - * Features extractEntities. - * @member {boolean} extractEntities - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @instance - */ - Features.prototype.extractEntities = false; + /** + * Constructs a new ClassifyTextResponse. + * @memberof google.cloud.language.v1 + * @classdesc Represents a ClassifyTextResponse. + * @implements IClassifyTextResponse + * @constructor + * @param {google.cloud.language.v1.IClassifyTextResponse=} [properties] Properties to set + */ + function ClassifyTextResponse(properties) { + this.categories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Features extractDocumentSentiment. - * @member {boolean} extractDocumentSentiment - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @instance - */ - Features.prototype.extractDocumentSentiment = false; + /** + * ClassifyTextResponse categories. + * @member {Array.} categories + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @instance + */ + ClassifyTextResponse.prototype.categories = $util.emptyArray; - /** - * Features extractEntitySentiment. - * @member {boolean} extractEntitySentiment - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @instance - */ - Features.prototype.extractEntitySentiment = false; + /** + * Creates a new ClassifyTextResponse instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {google.cloud.language.v1.IClassifyTextResponse=} [properties] Properties to set + * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse instance + */ + ClassifyTextResponse.create = function create(properties) { + return new ClassifyTextResponse(properties); + }; - /** - * Features classifyText. - * @member {boolean} classifyText - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @instance - */ - Features.prototype.classifyText = false; + /** + * Encodes the specified ClassifyTextResponse message. Does not implicitly {@link google.cloud.language.v1.ClassifyTextResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {google.cloud.language.v1.IClassifyTextResponse} message ClassifyTextResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClassifyTextResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + $root.google.cloud.language.v1.ClassificationCategory.encode(message.categories[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; - /** - * Creates a new Features instance using the specified properties. - * @function create - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features instance - */ - Features.create = function create(properties) { - return new Features(properties); - }; - - /** - * Encodes the specified Features message. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.Features.verify|verify} messages. - * @function encode - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures} message Features message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Features.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.extractSyntax != null && Object.hasOwnProperty.call(message, "extractSyntax")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.extractSyntax); - if (message.extractEntities != null && Object.hasOwnProperty.call(message, "extractEntities")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.extractEntities); - if (message.extractDocumentSentiment != null && Object.hasOwnProperty.call(message, "extractDocumentSentiment")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.extractDocumentSentiment); - if (message.extractEntitySentiment != null && Object.hasOwnProperty.call(message, "extractEntitySentiment")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.extractEntitySentiment); - if (message.classifyText != null && Object.hasOwnProperty.call(message, "classifyText")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.classifyText); - return writer; - }; - - /** - * Encodes the specified Features message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.Features.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures} message Features message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Features.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ClassifyTextResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.ClassifyTextResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {google.cloud.language.v1.IClassifyTextResponse} message ClassifyTextResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClassifyTextResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a Features message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Features.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnnotateTextRequest.Features(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.extractSyntax = reader.bool(); - break; - } - case 2: { - message.extractEntities = reader.bool(); - break; - } - case 3: { - message.extractDocumentSentiment = reader.bool(); - break; - } - case 4: { - message.extractEntitySentiment = reader.bool(); - break; - } - case 6: { - message.classifyText = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); + /** + * Decodes a ClassifyTextResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClassifyTextResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.ClassifyTextResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push($root.google.cloud.language.v1.ClassificationCategory.decode(reader, reader.uint32())); break; } + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; - /** - * Decodes a Features message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Features.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ClassifyTextResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClassifyTextResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a Features message. - * @function verify - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Features.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.extractSyntax != null && message.hasOwnProperty("extractSyntax")) - if (typeof message.extractSyntax !== "boolean") - return "extractSyntax: boolean expected"; - if (message.extractEntities != null && message.hasOwnProperty("extractEntities")) - if (typeof message.extractEntities !== "boolean") - return "extractEntities: boolean expected"; - if (message.extractDocumentSentiment != null && message.hasOwnProperty("extractDocumentSentiment")) - if (typeof message.extractDocumentSentiment !== "boolean") - return "extractDocumentSentiment: boolean expected"; - if (message.extractEntitySentiment != null && message.hasOwnProperty("extractEntitySentiment")) - if (typeof message.extractEntitySentiment !== "boolean") - return "extractEntitySentiment: boolean expected"; - if (message.classifyText != null && message.hasOwnProperty("classifyText")) - if (typeof message.classifyText !== "boolean") - return "classifyText: boolean expected"; - return null; - }; + /** + * Verifies a ClassifyTextResponse message. + * @function verify + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClassifyTextResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) { + var error = $root.google.cloud.language.v1.ClassificationCategory.verify(message.categories[i]); + if (error) + return "categories." + error; + } + } + return null; + }; - /** - * Creates a Features message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features - */ - Features.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnnotateTextRequest.Features) - return object; - var message = new $root.google.cloud.language.v1.AnnotateTextRequest.Features(); - if (object.extractSyntax != null) - message.extractSyntax = Boolean(object.extractSyntax); - if (object.extractEntities != null) - message.extractEntities = Boolean(object.extractEntities); - if (object.extractDocumentSentiment != null) - message.extractDocumentSentiment = Boolean(object.extractDocumentSentiment); - if (object.extractEntitySentiment != null) - message.extractEntitySentiment = Boolean(object.extractEntitySentiment); - if (object.classifyText != null) - message.classifyText = Boolean(object.classifyText); - return message; - }; + /** + * Creates a ClassifyTextResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1.ClassifyTextResponse} ClassifyTextResponse + */ + ClassifyTextResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.ClassifyTextResponse) + return object; + var message = new $root.google.cloud.language.v1.ClassifyTextResponse(); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.language.v1.ClassifyTextResponse.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) { + if (typeof object.categories[i] !== "object") + throw TypeError(".google.cloud.language.v1.ClassifyTextResponse.categories: object expected"); + message.categories[i] = $root.google.cloud.language.v1.ClassificationCategory.fromObject(object.categories[i]); + } + } + return message; + }; - /** - * Creates a plain object from a Features message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {google.cloud.language.v1.AnnotateTextRequest.Features} message Features - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Features.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.extractSyntax = false; - object.extractEntities = false; - object.extractDocumentSentiment = false; - object.extractEntitySentiment = false; - object.classifyText = false; - } - if (message.extractSyntax != null && message.hasOwnProperty("extractSyntax")) - object.extractSyntax = message.extractSyntax; - if (message.extractEntities != null && message.hasOwnProperty("extractEntities")) - object.extractEntities = message.extractEntities; - if (message.extractDocumentSentiment != null && message.hasOwnProperty("extractDocumentSentiment")) - object.extractDocumentSentiment = message.extractDocumentSentiment; - if (message.extractEntitySentiment != null && message.hasOwnProperty("extractEntitySentiment")) - object.extractEntitySentiment = message.extractEntitySentiment; - if (message.classifyText != null && message.hasOwnProperty("classifyText")) - object.classifyText = message.classifyText; - return object; - }; - - /** - * Converts this Features to JSON. - * @function toJSON - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @instance - * @returns {Object.} JSON object - */ - Features.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a ClassifyTextResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {google.cloud.language.v1.ClassifyTextResponse} message ClassifyTextResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClassifyTextResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.categories = []; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = $root.google.cloud.language.v1.ClassificationCategory.toObject(message.categories[j], options); + } + return object; + }; - /** - * Gets the default type url for Features - * @function getTypeUrl - * @memberof google.cloud.language.v1.AnnotateTextRequest.Features - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Features.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.language.v1.AnnotateTextRequest.Features"; - }; + /** + * Converts this ClassifyTextResponse to JSON. + * @function toJSON + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @instance + * @returns {Object.} JSON object + */ + ClassifyTextResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Features; - })(); + /** + * Gets the default type url for ClassifyTextResponse + * @function getTypeUrl + * @memberof google.cloud.language.v1.ClassifyTextResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClassifyTextResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1.ClassifyTextResponse"; + }; - return AnnotateTextRequest; + return ClassifyTextResponse; })(); - v1.AnnotateTextResponse = (function() { + v1.AnnotateTextRequest = (function() { /** - * Properties of an AnnotateTextResponse. + * Properties of an AnnotateTextRequest. * @memberof google.cloud.language.v1 - * @interface IAnnotateTextResponse - * @property {Array.|null} [sentences] AnnotateTextResponse sentences - * @property {Array.|null} [tokens] AnnotateTextResponse tokens - * @property {Array.|null} [entities] AnnotateTextResponse entities - * @property {google.cloud.language.v1.ISentiment|null} [documentSentiment] AnnotateTextResponse documentSentiment - * @property {string|null} [language] AnnotateTextResponse language - * @property {Array.|null} [categories] AnnotateTextResponse categories + * @interface IAnnotateTextRequest + * @property {google.cloud.language.v1.IDocument|null} [document] AnnotateTextRequest document + * @property {google.cloud.language.v1.AnnotateTextRequest.IFeatures|null} [features] AnnotateTextRequest features + * @property {google.cloud.language.v1.EncodingType|null} [encodingType] AnnotateTextRequest encodingType */ /** - * Constructs a new AnnotateTextResponse. + * Constructs a new AnnotateTextRequest. * @memberof google.cloud.language.v1 - * @classdesc Represents an AnnotateTextResponse. - * @implements IAnnotateTextResponse + * @classdesc Represents an AnnotateTextRequest. + * @implements IAnnotateTextRequest * @constructor - * @param {google.cloud.language.v1.IAnnotateTextResponse=} [properties] Properties to set + * @param {google.cloud.language.v1.IAnnotateTextRequest=} [properties] Properties to set */ - function AnnotateTextResponse(properties) { - this.sentences = []; - this.tokens = []; - this.entities = []; - this.categories = []; + function AnnotateTextRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7774,157 +7891,103 @@ } /** - * AnnotateTextResponse sentences. - * @member {Array.} sentences - * @memberof google.cloud.language.v1.AnnotateTextResponse - * @instance - */ - AnnotateTextResponse.prototype.sentences = $util.emptyArray; - - /** - * AnnotateTextResponse tokens. - * @member {Array.} tokens - * @memberof google.cloud.language.v1.AnnotateTextResponse - * @instance - */ - AnnotateTextResponse.prototype.tokens = $util.emptyArray; - - /** - * AnnotateTextResponse entities. - * @member {Array.} entities - * @memberof google.cloud.language.v1.AnnotateTextResponse - * @instance - */ - AnnotateTextResponse.prototype.entities = $util.emptyArray; - - /** - * AnnotateTextResponse documentSentiment. - * @member {google.cloud.language.v1.ISentiment|null|undefined} documentSentiment - * @memberof google.cloud.language.v1.AnnotateTextResponse + * AnnotateTextRequest document. + * @member {google.cloud.language.v1.IDocument|null|undefined} document + * @memberof google.cloud.language.v1.AnnotateTextRequest * @instance */ - AnnotateTextResponse.prototype.documentSentiment = null; + AnnotateTextRequest.prototype.document = null; /** - * AnnotateTextResponse language. - * @member {string} language - * @memberof google.cloud.language.v1.AnnotateTextResponse + * AnnotateTextRequest features. + * @member {google.cloud.language.v1.AnnotateTextRequest.IFeatures|null|undefined} features + * @memberof google.cloud.language.v1.AnnotateTextRequest * @instance */ - AnnotateTextResponse.prototype.language = ""; + AnnotateTextRequest.prototype.features = null; /** - * AnnotateTextResponse categories. - * @member {Array.} categories - * @memberof google.cloud.language.v1.AnnotateTextResponse + * AnnotateTextRequest encodingType. + * @member {google.cloud.language.v1.EncodingType} encodingType + * @memberof google.cloud.language.v1.AnnotateTextRequest * @instance */ - AnnotateTextResponse.prototype.categories = $util.emptyArray; + AnnotateTextRequest.prototype.encodingType = 0; /** - * Creates a new AnnotateTextResponse instance using the specified properties. + * Creates a new AnnotateTextRequest instance using the specified properties. * @function create - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static - * @param {google.cloud.language.v1.IAnnotateTextResponse=} [properties] Properties to set - * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse instance + * @param {google.cloud.language.v1.IAnnotateTextRequest=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest instance */ - AnnotateTextResponse.create = function create(properties) { - return new AnnotateTextResponse(properties); + AnnotateTextRequest.create = function create(properties) { + return new AnnotateTextRequest(properties); }; /** - * Encodes the specified AnnotateTextResponse message. Does not implicitly {@link google.cloud.language.v1.AnnotateTextResponse.verify|verify} messages. + * Encodes the specified AnnotateTextRequest message. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static - * @param {google.cloud.language.v1.IAnnotateTextResponse} message AnnotateTextResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnnotateTextRequest} message AnnotateTextRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateTextResponse.encode = function encode(message, writer) { + AnnotateTextRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.sentences != null && message.sentences.length) - for (var i = 0; i < message.sentences.length; ++i) - $root.google.cloud.language.v1.Sentence.encode(message.sentences[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.tokens != null && message.tokens.length) - for (var i = 0; i < message.tokens.length; ++i) - $root.google.cloud.language.v1.Token.encode(message.tokens[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.entities != null && message.entities.length) - for (var i = 0; i < message.entities.length; ++i) - $root.google.cloud.language.v1.Entity.encode(message.entities[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.documentSentiment != null && Object.hasOwnProperty.call(message, "documentSentiment")) - $root.google.cloud.language.v1.Sentiment.encode(message.documentSentiment, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.language != null && Object.hasOwnProperty.call(message, "language")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.language); - if (message.categories != null && message.categories.length) - for (var i = 0; i < message.categories.length; ++i) - $root.google.cloud.language.v1.ClassificationCategory.encode(message.categories[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.language.v1.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.cloud.language.v1.AnnotateTextRequest.Features.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.encodingType != null && Object.hasOwnProperty.call(message, "encodingType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.encodingType); return writer; }; /** - * Encodes the specified AnnotateTextResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnnotateTextResponse.verify|verify} messages. + * Encodes the specified AnnotateTextRequest message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static - * @param {google.cloud.language.v1.IAnnotateTextResponse} message AnnotateTextResponse message or plain object to encode + * @param {google.cloud.language.v1.IAnnotateTextRequest} message AnnotateTextRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateTextResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateTextResponse message from the specified reader or buffer. + * Decodes an AnnotateTextRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse + * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateTextResponse.decode = function decode(reader, length) { + AnnotateTextRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnnotateTextResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnnotateTextRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.sentences && message.sentences.length)) - message.sentences = []; - message.sentences.push($root.google.cloud.language.v1.Sentence.decode(reader, reader.uint32())); + message.document = $root.google.cloud.language.v1.Document.decode(reader, reader.uint32()); break; } case 2: { - if (!(message.tokens && message.tokens.length)) - message.tokens = []; - message.tokens.push($root.google.cloud.language.v1.Token.decode(reader, reader.uint32())); + message.features = $root.google.cloud.language.v1.AnnotateTextRequest.Features.decode(reader, reader.uint32()); break; } case 3: { - if (!(message.entities && message.entities.length)) - message.entities = []; - message.entities.push($root.google.cloud.language.v1.Entity.decode(reader, reader.uint32())); - break; - } - case 4: { - message.documentSentiment = $root.google.cloud.language.v1.Sentiment.decode(reader, reader.uint32()); - break; - } - case 5: { - message.language = reader.string(); - break; - } - case 6: { - if (!(message.categories && message.categories.length)) - message.categories = []; - message.categories.push($root.google.cloud.language.v1.ClassificationCategory.decode(reader, reader.uint32())); + message.encodingType = reader.int32(); break; } default: @@ -7936,620 +7999,665 @@ }; /** - * Decodes an AnnotateTextResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateTextRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse + * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateTextResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateTextRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateTextResponse message. + * Verifies an AnnotateTextRequest message. * @function verify - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateTextResponse.verify = function verify(message) { + AnnotateTextRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.sentences != null && message.hasOwnProperty("sentences")) { - if (!Array.isArray(message.sentences)) - return "sentences: array expected"; - for (var i = 0; i < message.sentences.length; ++i) { - var error = $root.google.cloud.language.v1.Sentence.verify(message.sentences[i]); - if (error) - return "sentences." + error; - } - } - if (message.tokens != null && message.hasOwnProperty("tokens")) { - if (!Array.isArray(message.tokens)) - return "tokens: array expected"; - for (var i = 0; i < message.tokens.length; ++i) { - var error = $root.google.cloud.language.v1.Token.verify(message.tokens[i]); - if (error) - return "tokens." + error; - } - } - if (message.entities != null && message.hasOwnProperty("entities")) { - if (!Array.isArray(message.entities)) - return "entities: array expected"; - for (var i = 0; i < message.entities.length; ++i) { - var error = $root.google.cloud.language.v1.Entity.verify(message.entities[i]); - if (error) - return "entities." + error; - } + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.language.v1.Document.verify(message.document); + if (error) + return "document." + error; } - if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) { - var error = $root.google.cloud.language.v1.Sentiment.verify(message.documentSentiment); + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.cloud.language.v1.AnnotateTextRequest.Features.verify(message.features); if (error) - return "documentSentiment." + error; + return "features." + error; } - if (message.language != null && message.hasOwnProperty("language")) - if (!$util.isString(message.language)) - return "language: string expected"; - if (message.categories != null && message.hasOwnProperty("categories")) { - if (!Array.isArray(message.categories)) - return "categories: array expected"; - for (var i = 0; i < message.categories.length; ++i) { - var error = $root.google.cloud.language.v1.ClassificationCategory.verify(message.categories[i]); - if (error) - return "categories." + error; + if (message.encodingType != null && message.hasOwnProperty("encodingType")) + switch (message.encodingType) { + default: + return "encodingType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; } - } return null; }; /** - * Creates an AnnotateTextResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateTextRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse + * @returns {google.cloud.language.v1.AnnotateTextRequest} AnnotateTextRequest */ - AnnotateTextResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1.AnnotateTextResponse) + AnnotateTextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnnotateTextRequest) return object; - var message = new $root.google.cloud.language.v1.AnnotateTextResponse(); - if (object.sentences) { - if (!Array.isArray(object.sentences)) - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.sentences: array expected"); - message.sentences = []; - for (var i = 0; i < object.sentences.length; ++i) { - if (typeof object.sentences[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.sentences: object expected"); - message.sentences[i] = $root.google.cloud.language.v1.Sentence.fromObject(object.sentences[i]); - } - } - if (object.tokens) { - if (!Array.isArray(object.tokens)) - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.tokens: array expected"); - message.tokens = []; - for (var i = 0; i < object.tokens.length; ++i) { - if (typeof object.tokens[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.tokens: object expected"); - message.tokens[i] = $root.google.cloud.language.v1.Token.fromObject(object.tokens[i]); - } - } - if (object.entities) { - if (!Array.isArray(object.entities)) - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.entities: array expected"); - message.entities = []; - for (var i = 0; i < object.entities.length; ++i) { - if (typeof object.entities[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.entities: object expected"); - message.entities[i] = $root.google.cloud.language.v1.Entity.fromObject(object.entities[i]); - } + var message = new $root.google.cloud.language.v1.AnnotateTextRequest(); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextRequest.document: object expected"); + message.document = $root.google.cloud.language.v1.Document.fromObject(object.document); } - if (object.documentSentiment != null) { - if (typeof object.documentSentiment !== "object") - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.documentSentiment: object expected"); - message.documentSentiment = $root.google.cloud.language.v1.Sentiment.fromObject(object.documentSentiment); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextRequest.features: object expected"); + message.features = $root.google.cloud.language.v1.AnnotateTextRequest.Features.fromObject(object.features); } - if (object.language != null) - message.language = String(object.language); - if (object.categories) { - if (!Array.isArray(object.categories)) - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.categories: array expected"); - message.categories = []; - for (var i = 0; i < object.categories.length; ++i) { - if (typeof object.categories[i] !== "object") - throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.categories: object expected"); - message.categories[i] = $root.google.cloud.language.v1.ClassificationCategory.fromObject(object.categories[i]); - } + switch (object.encodingType) { + case "NONE": + case 0: + message.encodingType = 0; + break; + case "UTF8": + case 1: + message.encodingType = 1; + break; + case "UTF16": + case 2: + message.encodingType = 2; + break; + case "UTF32": + case 3: + message.encodingType = 3; + break; } return message; }; /** - * Creates a plain object from an AnnotateTextResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateTextRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static - * @param {google.cloud.language.v1.AnnotateTextResponse} message AnnotateTextResponse + * @param {google.cloud.language.v1.AnnotateTextRequest} message AnnotateTextRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateTextResponse.toObject = function toObject(message, options) { + AnnotateTextRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.sentences = []; - object.tokens = []; - object.entities = []; - object.categories = []; - } if (options.defaults) { - object.documentSentiment = null; - object.language = ""; - } - if (message.sentences && message.sentences.length) { - object.sentences = []; - for (var j = 0; j < message.sentences.length; ++j) - object.sentences[j] = $root.google.cloud.language.v1.Sentence.toObject(message.sentences[j], options); - } - if (message.tokens && message.tokens.length) { - object.tokens = []; - for (var j = 0; j < message.tokens.length; ++j) - object.tokens[j] = $root.google.cloud.language.v1.Token.toObject(message.tokens[j], options); - } - if (message.entities && message.entities.length) { - object.entities = []; - for (var j = 0; j < message.entities.length; ++j) - object.entities[j] = $root.google.cloud.language.v1.Entity.toObject(message.entities[j], options); - } - if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) - object.documentSentiment = $root.google.cloud.language.v1.Sentiment.toObject(message.documentSentiment, options); - if (message.language != null && message.hasOwnProperty("language")) - object.language = message.language; - if (message.categories && message.categories.length) { - object.categories = []; - for (var j = 0; j < message.categories.length; ++j) - object.categories[j] = $root.google.cloud.language.v1.ClassificationCategory.toObject(message.categories[j], options); + object.document = null; + object.features = null; + object.encodingType = options.enums === String ? "NONE" : 0; } + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.language.v1.Document.toObject(message.document, options); + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.cloud.language.v1.AnnotateTextRequest.Features.toObject(message.features, options); + if (message.encodingType != null && message.hasOwnProperty("encodingType")) + object.encodingType = options.enums === String ? $root.google.cloud.language.v1.EncodingType[message.encodingType] : message.encodingType; return object; }; /** - * Converts this AnnotateTextResponse to JSON. + * Converts this AnnotateTextRequest to JSON. * @function toJSON - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @instance * @returns {Object.} JSON object */ - AnnotateTextResponse.prototype.toJSON = function toJSON() { + AnnotateTextRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for AnnotateTextResponse + * Gets the default type url for AnnotateTextRequest * @function getTypeUrl - * @memberof google.cloud.language.v1.AnnotateTextResponse + * @memberof google.cloud.language.v1.AnnotateTextRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - AnnotateTextResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnnotateTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1.AnnotateTextResponse"; + return typeUrlPrefix + "/google.cloud.language.v1.AnnotateTextRequest"; }; - return AnnotateTextResponse; - })(); + AnnotateTextRequest.Features = (function() { - return v1; - })(); + /** + * Properties of a Features. + * @memberof google.cloud.language.v1.AnnotateTextRequest + * @interface IFeatures + * @property {boolean|null} [extractSyntax] Features extractSyntax + * @property {boolean|null} [extractEntities] Features extractEntities + * @property {boolean|null} [extractDocumentSentiment] Features extractDocumentSentiment + * @property {boolean|null} [extractEntitySentiment] Features extractEntitySentiment + * @property {boolean|null} [classifyText] Features classifyText + * @property {google.cloud.language.v1.IClassificationModelOptions|null} [classificationModelOptions] Features classificationModelOptions + */ - language.v1beta2 = (function() { + /** + * Constructs a new Features. + * @memberof google.cloud.language.v1.AnnotateTextRequest + * @classdesc Represents a Features. + * @implements IFeatures + * @constructor + * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures=} [properties] Properties to set + */ + function Features(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Namespace v1beta2. - * @memberof google.cloud.language - * @namespace - */ - var v1beta2 = {}; - - v1beta2.LanguageService = (function() { + /** + * Features extractSyntax. + * @member {boolean} extractSyntax + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @instance + */ + Features.prototype.extractSyntax = false; - /** - * Constructs a new LanguageService service. - * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a LanguageService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function LanguageService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } + /** + * Features extractEntities. + * @member {boolean} extractEntities + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @instance + */ + Features.prototype.extractEntities = false; - (LanguageService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = LanguageService; + /** + * Features extractDocumentSentiment. + * @member {boolean} extractDocumentSentiment + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @instance + */ + Features.prototype.extractDocumentSentiment = false; - /** - * Creates new LanguageService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.language.v1beta2.LanguageService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {LanguageService} RPC service. Useful where requests and/or responses are streamed. - */ - LanguageService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + /** + * Features extractEntitySentiment. + * @member {boolean} extractEntitySentiment + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @instance + */ + Features.prototype.extractEntitySentiment = false; - /** - * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeSentiment}. - * @memberof google.cloud.language.v1beta2.LanguageService - * @typedef AnalyzeSentimentCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.language.v1beta2.AnalyzeSentimentResponse} [response] AnalyzeSentimentResponse - */ + /** + * Features classifyText. + * @member {boolean} classifyText + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @instance + */ + Features.prototype.classifyText = false; - /** - * Calls AnalyzeSentiment. - * @function analyzeSentiment - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeSentimentRequest} request AnalyzeSentimentRequest message or plain object - * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeSentimentCallback} callback Node-style callback called with the error, if any, and AnalyzeSentimentResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(LanguageService.prototype.analyzeSentiment = function analyzeSentiment(request, callback) { - return this.rpcCall(analyzeSentiment, $root.google.cloud.language.v1beta2.AnalyzeSentimentRequest, $root.google.cloud.language.v1beta2.AnalyzeSentimentResponse, request, callback); - }, "name", { value: "AnalyzeSentiment" }); + /** + * Features classificationModelOptions. + * @member {google.cloud.language.v1.IClassificationModelOptions|null|undefined} classificationModelOptions + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @instance + */ + Features.prototype.classificationModelOptions = null; - /** - * Calls AnalyzeSentiment. - * @function analyzeSentiment - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeSentimentRequest} request AnalyzeSentimentRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Creates a new Features instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features instance + */ + Features.create = function create(properties) { + return new Features(properties); + }; - /** - * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeEntities}. - * @memberof google.cloud.language.v1beta2.LanguageService - * @typedef AnalyzeEntitiesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.language.v1beta2.AnalyzeEntitiesResponse} [response] AnalyzeEntitiesResponse - */ + /** + * Encodes the specified Features message. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.Features.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures} message Features message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Features.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.extractSyntax != null && Object.hasOwnProperty.call(message, "extractSyntax")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.extractSyntax); + if (message.extractEntities != null && Object.hasOwnProperty.call(message, "extractEntities")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.extractEntities); + if (message.extractDocumentSentiment != null && Object.hasOwnProperty.call(message, "extractDocumentSentiment")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.extractDocumentSentiment); + if (message.extractEntitySentiment != null && Object.hasOwnProperty.call(message, "extractEntitySentiment")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.extractEntitySentiment); + if (message.classifyText != null && Object.hasOwnProperty.call(message, "classifyText")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.classifyText); + if (message.classificationModelOptions != null && Object.hasOwnProperty.call(message, "classificationModelOptions")) + $root.google.cloud.language.v1.ClassificationModelOptions.encode(message.classificationModelOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; - /** - * Calls AnalyzeEntities. - * @function analyzeEntities - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeEntitiesRequest} request AnalyzeEntitiesRequest message or plain object - * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeEntitiesCallback} callback Node-style callback called with the error, if any, and AnalyzeEntitiesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(LanguageService.prototype.analyzeEntities = function analyzeEntities(request, callback) { - return this.rpcCall(analyzeEntities, $root.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, $root.google.cloud.language.v1beta2.AnalyzeEntitiesResponse, request, callback); - }, "name", { value: "AnalyzeEntities" }); + /** + * Encodes the specified Features message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnnotateTextRequest.Features.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {google.cloud.language.v1.AnnotateTextRequest.IFeatures} message Features message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Features.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Calls AnalyzeEntities. - * @function analyzeEntities - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeEntitiesRequest} request AnalyzeEntitiesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ + /** + * Decodes a Features message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Features.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnnotateTextRequest.Features(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.extractSyntax = reader.bool(); + break; + } + case 2: { + message.extractEntities = reader.bool(); + break; + } + case 3: { + message.extractDocumentSentiment = reader.bool(); + break; + } + case 4: { + message.extractEntitySentiment = reader.bool(); + break; + } + case 6: { + message.classifyText = reader.bool(); + break; + } + case 10: { + message.classificationModelOptions = $root.google.cloud.language.v1.ClassificationModelOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeEntitySentiment}. - * @memberof google.cloud.language.v1beta2.LanguageService - * @typedef AnalyzeEntitySentimentCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse} [response] AnalyzeEntitySentimentResponse - */ + /** + * Decodes a Features message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Features.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Calls AnalyzeEntitySentiment. - * @function analyzeEntitySentiment - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest} request AnalyzeEntitySentimentRequest message or plain object - * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeEntitySentimentCallback} callback Node-style callback called with the error, if any, and AnalyzeEntitySentimentResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(LanguageService.prototype.analyzeEntitySentiment = function analyzeEntitySentiment(request, callback) { - return this.rpcCall(analyzeEntitySentiment, $root.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, $root.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse, request, callback); - }, "name", { value: "AnalyzeEntitySentiment" }); + /** + * Verifies a Features message. + * @function verify + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Features.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.extractSyntax != null && message.hasOwnProperty("extractSyntax")) + if (typeof message.extractSyntax !== "boolean") + return "extractSyntax: boolean expected"; + if (message.extractEntities != null && message.hasOwnProperty("extractEntities")) + if (typeof message.extractEntities !== "boolean") + return "extractEntities: boolean expected"; + if (message.extractDocumentSentiment != null && message.hasOwnProperty("extractDocumentSentiment")) + if (typeof message.extractDocumentSentiment !== "boolean") + return "extractDocumentSentiment: boolean expected"; + if (message.extractEntitySentiment != null && message.hasOwnProperty("extractEntitySentiment")) + if (typeof message.extractEntitySentiment !== "boolean") + return "extractEntitySentiment: boolean expected"; + if (message.classifyText != null && message.hasOwnProperty("classifyText")) + if (typeof message.classifyText !== "boolean") + return "classifyText: boolean expected"; + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) { + var error = $root.google.cloud.language.v1.ClassificationModelOptions.verify(message.classificationModelOptions); + if (error) + return "classificationModelOptions." + error; + } + return null; + }; + + /** + * Creates a Features message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1.AnnotateTextRequest.Features} Features + */ + Features.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnnotateTextRequest.Features) + return object; + var message = new $root.google.cloud.language.v1.AnnotateTextRequest.Features(); + if (object.extractSyntax != null) + message.extractSyntax = Boolean(object.extractSyntax); + if (object.extractEntities != null) + message.extractEntities = Boolean(object.extractEntities); + if (object.extractDocumentSentiment != null) + message.extractDocumentSentiment = Boolean(object.extractDocumentSentiment); + if (object.extractEntitySentiment != null) + message.extractEntitySentiment = Boolean(object.extractEntitySentiment); + if (object.classifyText != null) + message.classifyText = Boolean(object.classifyText); + if (object.classificationModelOptions != null) { + if (typeof object.classificationModelOptions !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextRequest.Features.classificationModelOptions: object expected"); + message.classificationModelOptions = $root.google.cloud.language.v1.ClassificationModelOptions.fromObject(object.classificationModelOptions); + } + return message; + }; + + /** + * Creates a plain object from a Features message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {google.cloud.language.v1.AnnotateTextRequest.Features} message Features + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Features.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.extractSyntax = false; + object.extractEntities = false; + object.extractDocumentSentiment = false; + object.extractEntitySentiment = false; + object.classifyText = false; + object.classificationModelOptions = null; + } + if (message.extractSyntax != null && message.hasOwnProperty("extractSyntax")) + object.extractSyntax = message.extractSyntax; + if (message.extractEntities != null && message.hasOwnProperty("extractEntities")) + object.extractEntities = message.extractEntities; + if (message.extractDocumentSentiment != null && message.hasOwnProperty("extractDocumentSentiment")) + object.extractDocumentSentiment = message.extractDocumentSentiment; + if (message.extractEntitySentiment != null && message.hasOwnProperty("extractEntitySentiment")) + object.extractEntitySentiment = message.extractEntitySentiment; + if (message.classifyText != null && message.hasOwnProperty("classifyText")) + object.classifyText = message.classifyText; + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) + object.classificationModelOptions = $root.google.cloud.language.v1.ClassificationModelOptions.toObject(message.classificationModelOptions, options); + return object; + }; + + /** + * Converts this Features to JSON. + * @function toJSON + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @instance + * @returns {Object.} JSON object + */ + Features.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Features + * @function getTypeUrl + * @memberof google.cloud.language.v1.AnnotateTextRequest.Features + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Features.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1.AnnotateTextRequest.Features"; + }; + + return Features; + })(); + + return AnnotateTextRequest; + })(); + + v1.AnnotateTextResponse = (function() { /** - * Calls AnalyzeEntitySentiment. - * @function analyzeEntitySentiment - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest} request AnalyzeEntitySentimentRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Properties of an AnnotateTextResponse. + * @memberof google.cloud.language.v1 + * @interface IAnnotateTextResponse + * @property {Array.|null} [sentences] AnnotateTextResponse sentences + * @property {Array.|null} [tokens] AnnotateTextResponse tokens + * @property {Array.|null} [entities] AnnotateTextResponse entities + * @property {google.cloud.language.v1.ISentiment|null} [documentSentiment] AnnotateTextResponse documentSentiment + * @property {string|null} [language] AnnotateTextResponse language + * @property {Array.|null} [categories] AnnotateTextResponse categories */ /** - * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeSyntax}. - * @memberof google.cloud.language.v1beta2.LanguageService - * @typedef AnalyzeSyntaxCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.language.v1beta2.AnalyzeSyntaxResponse} [response] AnalyzeSyntaxResponse + * Constructs a new AnnotateTextResponse. + * @memberof google.cloud.language.v1 + * @classdesc Represents an AnnotateTextResponse. + * @implements IAnnotateTextResponse + * @constructor + * @param {google.cloud.language.v1.IAnnotateTextResponse=} [properties] Properties to set */ + function AnnotateTextResponse(properties) { + this.sentences = []; + this.tokens = []; + this.entities = []; + this.categories = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Calls AnalyzeSyntax. - * @function analyzeSyntax - * @memberof google.cloud.language.v1beta2.LanguageService + * AnnotateTextResponse sentences. + * @member {Array.} sentences + * @memberof google.cloud.language.v1.AnnotateTextResponse * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeSyntaxRequest} request AnalyzeSyntaxRequest message or plain object - * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeSyntaxCallback} callback Node-style callback called with the error, if any, and AnalyzeSyntaxResponse - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(LanguageService.prototype.analyzeSyntax = function analyzeSyntax(request, callback) { - return this.rpcCall(analyzeSyntax, $root.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, $root.google.cloud.language.v1beta2.AnalyzeSyntaxResponse, request, callback); - }, "name", { value: "AnalyzeSyntax" }); + AnnotateTextResponse.prototype.sentences = $util.emptyArray; /** - * Calls AnalyzeSyntax. - * @function analyzeSyntax - * @memberof google.cloud.language.v1beta2.LanguageService + * AnnotateTextResponse tokens. + * @member {Array.} tokens + * @memberof google.cloud.language.v1.AnnotateTextResponse * @instance - * @param {google.cloud.language.v1beta2.IAnalyzeSyntaxRequest} request AnalyzeSyntaxRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + AnnotateTextResponse.prototype.tokens = $util.emptyArray; /** - * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|classifyText}. - * @memberof google.cloud.language.v1beta2.LanguageService - * @typedef ClassifyTextCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.language.v1beta2.ClassifyTextResponse} [response] ClassifyTextResponse + * AnnotateTextResponse entities. + * @member {Array.} entities + * @memberof google.cloud.language.v1.AnnotateTextResponse + * @instance */ + AnnotateTextResponse.prototype.entities = $util.emptyArray; /** - * Calls ClassifyText. - * @function classifyText - * @memberof google.cloud.language.v1beta2.LanguageService + * AnnotateTextResponse documentSentiment. + * @member {google.cloud.language.v1.ISentiment|null|undefined} documentSentiment + * @memberof google.cloud.language.v1.AnnotateTextResponse * @instance - * @param {google.cloud.language.v1beta2.IClassifyTextRequest} request ClassifyTextRequest message or plain object - * @param {google.cloud.language.v1beta2.LanguageService.ClassifyTextCallback} callback Node-style callback called with the error, if any, and ClassifyTextResponse - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(LanguageService.prototype.classifyText = function classifyText(request, callback) { - return this.rpcCall(classifyText, $root.google.cloud.language.v1beta2.ClassifyTextRequest, $root.google.cloud.language.v1beta2.ClassifyTextResponse, request, callback); - }, "name", { value: "ClassifyText" }); + AnnotateTextResponse.prototype.documentSentiment = null; /** - * Calls ClassifyText. - * @function classifyText - * @memberof google.cloud.language.v1beta2.LanguageService + * AnnotateTextResponse language. + * @member {string} language + * @memberof google.cloud.language.v1.AnnotateTextResponse * @instance - * @param {google.cloud.language.v1beta2.IClassifyTextRequest} request ClassifyTextRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + AnnotateTextResponse.prototype.language = ""; /** - * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|annotateText}. - * @memberof google.cloud.language.v1beta2.LanguageService - * @typedef AnnotateTextCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.language.v1beta2.AnnotateTextResponse} [response] AnnotateTextResponse + * AnnotateTextResponse categories. + * @member {Array.} categories + * @memberof google.cloud.language.v1.AnnotateTextResponse + * @instance */ + AnnotateTextResponse.prototype.categories = $util.emptyArray; /** - * Calls AnnotateText. - * @function annotateText - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnnotateTextRequest} request AnnotateTextRequest message or plain object - * @param {google.cloud.language.v1beta2.LanguageService.AnnotateTextCallback} callback Node-style callback called with the error, if any, and AnnotateTextResponse - * @returns {undefined} - * @variation 1 + * Creates a new AnnotateTextResponse instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1.AnnotateTextResponse + * @static + * @param {google.cloud.language.v1.IAnnotateTextResponse=} [properties] Properties to set + * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse instance */ - Object.defineProperty(LanguageService.prototype.annotateText = function annotateText(request, callback) { - return this.rpcCall(annotateText, $root.google.cloud.language.v1beta2.AnnotateTextRequest, $root.google.cloud.language.v1beta2.AnnotateTextResponse, request, callback); - }, "name", { value: "AnnotateText" }); + AnnotateTextResponse.create = function create(properties) { + return new AnnotateTextResponse(properties); + }; /** - * Calls AnnotateText. - * @function annotateText - * @memberof google.cloud.language.v1beta2.LanguageService - * @instance - * @param {google.cloud.language.v1beta2.IAnnotateTextRequest} request AnnotateTextRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return LanguageService; - })(); - - v1beta2.Document = (function() { - - /** - * Properties of a Document. - * @memberof google.cloud.language.v1beta2 - * @interface IDocument - * @property {google.cloud.language.v1beta2.Document.Type|null} [type] Document type - * @property {string|null} [content] Document content - * @property {string|null} [gcsContentUri] Document gcsContentUri - * @property {string|null} [language] Document language - */ - - /** - * Constructs a new Document. - * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a Document. - * @implements IDocument - * @constructor - * @param {google.cloud.language.v1beta2.IDocument=} [properties] Properties to set - */ - function Document(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Document type. - * @member {google.cloud.language.v1beta2.Document.Type} type - * @memberof google.cloud.language.v1beta2.Document - * @instance - */ - Document.prototype.type = 0; - - /** - * Document content. - * @member {string|null|undefined} content - * @memberof google.cloud.language.v1beta2.Document - * @instance - */ - Document.prototype.content = null; - - /** - * Document gcsContentUri. - * @member {string|null|undefined} gcsContentUri - * @memberof google.cloud.language.v1beta2.Document - * @instance - */ - Document.prototype.gcsContentUri = null; - - /** - * Document language. - * @member {string} language - * @memberof google.cloud.language.v1beta2.Document - * @instance - */ - Document.prototype.language = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Document source. - * @member {"content"|"gcsContentUri"|undefined} source - * @memberof google.cloud.language.v1beta2.Document - * @instance - */ - Object.defineProperty(Document.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["content", "gcsContentUri"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Document instance using the specified properties. - * @function create - * @memberof google.cloud.language.v1beta2.Document - * @static - * @param {google.cloud.language.v1beta2.IDocument=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.Document} Document instance - */ - Document.create = function create(properties) { - return new Document(properties); - }; - - /** - * Encodes the specified Document message. Does not implicitly {@link google.cloud.language.v1beta2.Document.verify|verify} messages. + * Encodes the specified AnnotateTextResponse message. Does not implicitly {@link google.cloud.language.v1.AnnotateTextResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static - * @param {google.cloud.language.v1beta2.IDocument} message Document message or plain object to encode + * @param {google.cloud.language.v1.IAnnotateTextResponse} message AnnotateTextResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Document.encode = function encode(message, writer) { + AnnotateTextResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.content); - if (message.gcsContentUri != null && Object.hasOwnProperty.call(message, "gcsContentUri")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsContentUri); + if (message.sentences != null && message.sentences.length) + for (var i = 0; i < message.sentences.length; ++i) + $root.google.cloud.language.v1.Sentence.encode(message.sentences[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.tokens != null && message.tokens.length) + for (var i = 0; i < message.tokens.length; ++i) + $root.google.cloud.language.v1.Token.encode(message.tokens[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.language.v1.Entity.encode(message.entities[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.documentSentiment != null && Object.hasOwnProperty.call(message, "documentSentiment")) + $root.google.cloud.language.v1.Sentiment.encode(message.documentSentiment, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.language != null && Object.hasOwnProperty.call(message, "language")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.language); + writer.uint32(/* id 5, wireType 2 =*/42).string(message.language); + if (message.categories != null && message.categories.length) + for (var i = 0; i < message.categories.length; ++i) + $root.google.cloud.language.v1.ClassificationCategory.encode(message.categories[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Document.verify|verify} messages. + * Encodes the specified AnnotateTextResponse message, length delimited. Does not implicitly {@link google.cloud.language.v1.AnnotateTextResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static - * @param {google.cloud.language.v1beta2.IDocument} message Document message or plain object to encode + * @param {google.cloud.language.v1.IAnnotateTextResponse} message AnnotateTextResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Document.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateTextResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Document message from the specified reader or buffer. + * Decodes an AnnotateTextResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.Document} Document + * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Document.decode = function decode(reader, length) { + AnnotateTextResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Document(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1.AnnotateTextResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.type = reader.int32(); + if (!(message.sentences && message.sentences.length)) + message.sentences = []; + message.sentences.push($root.google.cloud.language.v1.Sentence.decode(reader, reader.uint32())); break; } case 2: { - message.content = reader.string(); + if (!(message.tokens && message.tokens.length)) + message.tokens = []; + message.tokens.push($root.google.cloud.language.v1.Token.decode(reader, reader.uint32())); break; } case 3: { - message.gcsContentUri = reader.string(); + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.language.v1.Entity.decode(reader, reader.uint32())); break; } case 4: { + message.documentSentiment = $root.google.cloud.language.v1.Sentiment.decode(reader, reader.uint32()); + break; + } + case 5: { message.language = reader.string(); break; } + case 6: { + if (!(message.categories && message.categories.length)) + message.categories = []; + message.categories.push($root.google.cloud.language.v1.ClassificationCategory.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -8559,605 +8667,648 @@ }; /** - * Decodes a Document message from the specified reader or buffer, length delimited. + * Decodes an AnnotateTextResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.Document} Document + * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Document.decodeDelimited = function decodeDelimited(reader) { + AnnotateTextResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Document message. + * Verifies an AnnotateTextResponse message. * @function verify - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Document.verify = function verify(message) { + AnnotateTextResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - break; + if (message.sentences != null && message.hasOwnProperty("sentences")) { + if (!Array.isArray(message.sentences)) + return "sentences: array expected"; + for (var i = 0; i < message.sentences.length; ++i) { + var error = $root.google.cloud.language.v1.Sentence.verify(message.sentences[i]); + if (error) + return "sentences." + error; } - if (message.content != null && message.hasOwnProperty("content")) { - properties.source = 1; - if (!$util.isString(message.content)) - return "content: string expected"; } - if (message.gcsContentUri != null && message.hasOwnProperty("gcsContentUri")) { - if (properties.source === 1) - return "source: multiple values"; - properties.source = 1; - if (!$util.isString(message.gcsContentUri)) - return "gcsContentUri: string expected"; + if (message.tokens != null && message.hasOwnProperty("tokens")) { + if (!Array.isArray(message.tokens)) + return "tokens: array expected"; + for (var i = 0; i < message.tokens.length; ++i) { + var error = $root.google.cloud.language.v1.Token.verify(message.tokens[i]); + if (error) + return "tokens." + error; + } + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.language.v1.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) { + var error = $root.google.cloud.language.v1.Sentiment.verify(message.documentSentiment); + if (error) + return "documentSentiment." + error; } if (message.language != null && message.hasOwnProperty("language")) if (!$util.isString(message.language)) return "language: string expected"; + if (message.categories != null && message.hasOwnProperty("categories")) { + if (!Array.isArray(message.categories)) + return "categories: array expected"; + for (var i = 0; i < message.categories.length; ++i) { + var error = $root.google.cloud.language.v1.ClassificationCategory.verify(message.categories[i]); + if (error) + return "categories." + error; + } + } return null; }; /** - * Creates a Document message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateTextResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.Document} Document + * @returns {google.cloud.language.v1.AnnotateTextResponse} AnnotateTextResponse */ - Document.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.Document) + AnnotateTextResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1.AnnotateTextResponse) return object; - var message = new $root.google.cloud.language.v1beta2.Document(); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PLAIN_TEXT": - case 1: - message.type = 1; - break; - case "HTML": - case 2: - message.type = 2; - break; + var message = new $root.google.cloud.language.v1.AnnotateTextResponse(); + if (object.sentences) { + if (!Array.isArray(object.sentences)) + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.sentences: array expected"); + message.sentences = []; + for (var i = 0; i < object.sentences.length; ++i) { + if (typeof object.sentences[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.sentences: object expected"); + message.sentences[i] = $root.google.cloud.language.v1.Sentence.fromObject(object.sentences[i]); + } + } + if (object.tokens) { + if (!Array.isArray(object.tokens)) + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.tokens: array expected"); + message.tokens = []; + for (var i = 0; i < object.tokens.length; ++i) { + if (typeof object.tokens[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.tokens: object expected"); + message.tokens[i] = $root.google.cloud.language.v1.Token.fromObject(object.tokens[i]); + } + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.entities: object expected"); + message.entities[i] = $root.google.cloud.language.v1.Entity.fromObject(object.entities[i]); + } + } + if (object.documentSentiment != null) { + if (typeof object.documentSentiment !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.documentSentiment: object expected"); + message.documentSentiment = $root.google.cloud.language.v1.Sentiment.fromObject(object.documentSentiment); } - if (object.content != null) - message.content = String(object.content); - if (object.gcsContentUri != null) - message.gcsContentUri = String(object.gcsContentUri); if (object.language != null) message.language = String(object.language); + if (object.categories) { + if (!Array.isArray(object.categories)) + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.categories: array expected"); + message.categories = []; + for (var i = 0; i < object.categories.length; ++i) { + if (typeof object.categories[i] !== "object") + throw TypeError(".google.cloud.language.v1.AnnotateTextResponse.categories: object expected"); + message.categories[i] = $root.google.cloud.language.v1.ClassificationCategory.fromObject(object.categories[i]); + } + } return message; }; /** - * Creates a plain object from a Document message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateTextResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static - * @param {google.cloud.language.v1beta2.Document} message Document + * @param {google.cloud.language.v1.AnnotateTextResponse} message AnnotateTextResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Document.toObject = function toObject(message, options) { + AnnotateTextResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.sentences = []; + object.tokens = []; + object.entities = []; + object.categories = []; + } if (options.defaults) { - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.documentSentiment = null; object.language = ""; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.language.v1beta2.Document.Type[message.type] : message.type; - if (message.content != null && message.hasOwnProperty("content")) { - object.content = message.content; - if (options.oneofs) - object.source = "content"; + if (message.sentences && message.sentences.length) { + object.sentences = []; + for (var j = 0; j < message.sentences.length; ++j) + object.sentences[j] = $root.google.cloud.language.v1.Sentence.toObject(message.sentences[j], options); } - if (message.gcsContentUri != null && message.hasOwnProperty("gcsContentUri")) { - object.gcsContentUri = message.gcsContentUri; - if (options.oneofs) - object.source = "gcsContentUri"; + if (message.tokens && message.tokens.length) { + object.tokens = []; + for (var j = 0; j < message.tokens.length; ++j) + object.tokens[j] = $root.google.cloud.language.v1.Token.toObject(message.tokens[j], options); } + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.language.v1.Entity.toObject(message.entities[j], options); + } + if (message.documentSentiment != null && message.hasOwnProperty("documentSentiment")) + object.documentSentiment = $root.google.cloud.language.v1.Sentiment.toObject(message.documentSentiment, options); if (message.language != null && message.hasOwnProperty("language")) object.language = message.language; + if (message.categories && message.categories.length) { + object.categories = []; + for (var j = 0; j < message.categories.length; ++j) + object.categories[j] = $root.google.cloud.language.v1.ClassificationCategory.toObject(message.categories[j], options); + } return object; }; /** - * Converts this Document to JSON. + * Converts this AnnotateTextResponse to JSON. * @function toJSON - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @instance * @returns {Object.} JSON object */ - Document.prototype.toJSON = function toJSON() { + AnnotateTextResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Document + * Gets the default type url for AnnotateTextResponse * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.Document + * @memberof google.cloud.language.v1.AnnotateTextResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + AnnotateTextResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1beta2.Document"; + return typeUrlPrefix + "/google.cloud.language.v1.AnnotateTextResponse"; }; - /** - * Type enum. - * @name google.cloud.language.v1beta2.Document.Type - * @enum {number} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} PLAIN_TEXT=1 PLAIN_TEXT value - * @property {number} HTML=2 HTML value - */ - Document.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PLAIN_TEXT"] = 1; - values[valuesById[2] = "HTML"] = 2; - return values; - })(); - - return Document; + return AnnotateTextResponse; })(); - v1beta2.Sentence = (function() { + return v1; + })(); - /** - * Properties of a Sentence. - * @memberof google.cloud.language.v1beta2 - * @interface ISentence - * @property {google.cloud.language.v1beta2.ITextSpan|null} [text] Sentence text - * @property {google.cloud.language.v1beta2.ISentiment|null} [sentiment] Sentence sentiment - */ + language.v1beta2 = (function() { + + /** + * Namespace v1beta2. + * @memberof google.cloud.language + * @namespace + */ + var v1beta2 = {}; + + v1beta2.LanguageService = (function() { /** - * Constructs a new Sentence. + * Constructs a new LanguageService service. * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a Sentence. - * @implements ISentence + * @classdesc Represents a LanguageService + * @extends $protobuf.rpc.Service * @constructor - * @param {google.cloud.language.v1beta2.ISentence=} [properties] Properties to set + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function Sentence(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + function LanguageService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - /** - * Sentence text. - * @member {google.cloud.language.v1beta2.ITextSpan|null|undefined} text - * @memberof google.cloud.language.v1beta2.Sentence - * @instance - */ - Sentence.prototype.text = null; - - /** - * Sentence sentiment. - * @member {google.cloud.language.v1beta2.ISentiment|null|undefined} sentiment - * @memberof google.cloud.language.v1beta2.Sentence - * @instance - */ - Sentence.prototype.sentiment = null; + (LanguageService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = LanguageService; /** - * Creates a new Sentence instance using the specified properties. + * Creates new LanguageService service using the specified rpc implementation. * @function create - * @memberof google.cloud.language.v1beta2.Sentence + * @memberof google.cloud.language.v1beta2.LanguageService * @static - * @param {google.cloud.language.v1beta2.ISentence=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.Sentence} Sentence instance + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {LanguageService} RPC service. Useful where requests and/or responses are streamed. */ - Sentence.create = function create(properties) { - return new Sentence(properties); + LanguageService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Encodes the specified Sentence message. Does not implicitly {@link google.cloud.language.v1beta2.Sentence.verify|verify} messages. - * @function encode - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {google.cloud.language.v1beta2.ISentence} message Sentence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeSentiment}. + * @memberof google.cloud.language.v1beta2.LanguageService + * @typedef AnalyzeSentimentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.language.v1beta2.AnalyzeSentimentResponse} [response] AnalyzeSentimentResponse */ - Sentence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.text != null && Object.hasOwnProperty.call(message, "text")) - $root.google.cloud.language.v1beta2.TextSpan.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.sentiment != null && Object.hasOwnProperty.call(message, "sentiment")) - $root.google.cloud.language.v1beta2.Sentiment.encode(message.sentiment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; /** - * Encodes the specified Sentence message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Sentence.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {google.cloud.language.v1beta2.ISentence} message Sentence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls AnalyzeSentiment. + * @function analyzeSentiment + * @memberof google.cloud.language.v1beta2.LanguageService + * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeSentimentRequest} request AnalyzeSentimentRequest message or plain object + * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeSentimentCallback} callback Node-style callback called with the error, if any, and AnalyzeSentimentResponse + * @returns {undefined} + * @variation 1 */ - Sentence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Object.defineProperty(LanguageService.prototype.analyzeSentiment = function analyzeSentiment(request, callback) { + return this.rpcCall(analyzeSentiment, $root.google.cloud.language.v1beta2.AnalyzeSentimentRequest, $root.google.cloud.language.v1beta2.AnalyzeSentimentResponse, request, callback); + }, "name", { value: "AnalyzeSentiment" }); /** - * Decodes a Sentence message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.Sentence} Sentence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Sentence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Sentence(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.text = $root.google.cloud.language.v1beta2.TextSpan.decode(reader, reader.uint32()); - break; - } - case 2: { - message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Sentence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.Sentence} Sentence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls AnalyzeSentiment. + * @function analyzeSentiment + * @memberof google.cloud.language.v1beta2.LanguageService + * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeSentimentRequest} request AnalyzeSentimentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - Sentence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; /** - * Verifies a Sentence message. - * @function verify - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeEntities}. + * @memberof google.cloud.language.v1beta2.LanguageService + * @typedef AnalyzeEntitiesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.language.v1beta2.AnalyzeEntitiesResponse} [response] AnalyzeEntitiesResponse */ - Sentence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.text != null && message.hasOwnProperty("text")) { - var error = $root.google.cloud.language.v1beta2.TextSpan.verify(message.text); - if (error) - return "text." + error; - } - if (message.sentiment != null && message.hasOwnProperty("sentiment")) { - var error = $root.google.cloud.language.v1beta2.Sentiment.verify(message.sentiment); - if (error) - return "sentiment." + error; - } - return null; - }; /** - * Creates a Sentence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.Sentence} Sentence + * Calls AnalyzeEntities. + * @function analyzeEntities + * @memberof google.cloud.language.v1beta2.LanguageService + * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeEntitiesRequest} request AnalyzeEntitiesRequest message or plain object + * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeEntitiesCallback} callback Node-style callback called with the error, if any, and AnalyzeEntitiesResponse + * @returns {undefined} + * @variation 1 */ - Sentence.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.Sentence) - return object; - var message = new $root.google.cloud.language.v1beta2.Sentence(); - if (object.text != null) { - if (typeof object.text !== "object") - throw TypeError(".google.cloud.language.v1beta2.Sentence.text: object expected"); - message.text = $root.google.cloud.language.v1beta2.TextSpan.fromObject(object.text); - } - if (object.sentiment != null) { - if (typeof object.sentiment !== "object") - throw TypeError(".google.cloud.language.v1beta2.Sentence.sentiment: object expected"); - message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.fromObject(object.sentiment); - } - return message; - }; + Object.defineProperty(LanguageService.prototype.analyzeEntities = function analyzeEntities(request, callback) { + return this.rpcCall(analyzeEntities, $root.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, $root.google.cloud.language.v1beta2.AnalyzeEntitiesResponse, request, callback); + }, "name", { value: "AnalyzeEntities" }); /** - * Creates a plain object from a Sentence message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {google.cloud.language.v1beta2.Sentence} message Sentence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Calls AnalyzeEntities. + * @function analyzeEntities + * @memberof google.cloud.language.v1beta2.LanguageService + * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeEntitiesRequest} request AnalyzeEntitiesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - Sentence.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.text = null; - object.sentiment = null; - } - if (message.text != null && message.hasOwnProperty("text")) - object.text = $root.google.cloud.language.v1beta2.TextSpan.toObject(message.text, options); - if (message.sentiment != null && message.hasOwnProperty("sentiment")) - object.sentiment = $root.google.cloud.language.v1beta2.Sentiment.toObject(message.sentiment, options); - return object; - }; /** - * Converts this Sentence to JSON. - * @function toJSON - * @memberof google.cloud.language.v1beta2.Sentence - * @instance - * @returns {Object.} JSON object + * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeEntitySentiment}. + * @memberof google.cloud.language.v1beta2.LanguageService + * @typedef AnalyzeEntitySentimentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse} [response] AnalyzeEntitySentimentResponse */ - Sentence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; /** - * Gets the default type url for Sentence - * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.Sentence - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * Calls AnalyzeEntitySentiment. + * @function analyzeEntitySentiment + * @memberof google.cloud.language.v1beta2.LanguageService + * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest} request AnalyzeEntitySentimentRequest message or plain object + * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeEntitySentimentCallback} callback Node-style callback called with the error, if any, and AnalyzeEntitySentimentResponse + * @returns {undefined} + * @variation 1 */ - Sentence.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.language.v1beta2.Sentence"; - }; - - return Sentence; - })(); - - v1beta2.Entity = (function() { + Object.defineProperty(LanguageService.prototype.analyzeEntitySentiment = function analyzeEntitySentiment(request, callback) { + return this.rpcCall(analyzeEntitySentiment, $root.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, $root.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse, request, callback); + }, "name", { value: "AnalyzeEntitySentiment" }); /** - * Properties of an Entity. - * @memberof google.cloud.language.v1beta2 - * @interface IEntity - * @property {string|null} [name] Entity name - * @property {google.cloud.language.v1beta2.Entity.Type|null} [type] Entity type - * @property {Object.|null} [metadata] Entity metadata - * @property {number|null} [salience] Entity salience - * @property {Array.|null} [mentions] Entity mentions - * @property {google.cloud.language.v1beta2.ISentiment|null} [sentiment] Entity sentiment + * Calls AnalyzeEntitySentiment. + * @function analyzeEntitySentiment + * @memberof google.cloud.language.v1beta2.LanguageService + * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeEntitySentimentRequest} request AnalyzeEntitySentimentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ /** - * Constructs a new Entity. - * @memberof google.cloud.language.v1beta2 - * @classdesc Represents an Entity. - * @implements IEntity - * @constructor - * @param {google.cloud.language.v1beta2.IEntity=} [properties] Properties to set + * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|analyzeSyntax}. + * @memberof google.cloud.language.v1beta2.LanguageService + * @typedef AnalyzeSyntaxCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.language.v1beta2.AnalyzeSyntaxResponse} [response] AnalyzeSyntaxResponse */ - function Entity(properties) { - this.metadata = {}; - this.mentions = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * Entity name. - * @member {string} name - * @memberof google.cloud.language.v1beta2.Entity + * Calls AnalyzeSyntax. + * @function analyzeSyntax + * @memberof google.cloud.language.v1beta2.LanguageService * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeSyntaxRequest} request AnalyzeSyntaxRequest message or plain object + * @param {google.cloud.language.v1beta2.LanguageService.AnalyzeSyntaxCallback} callback Node-style callback called with the error, if any, and AnalyzeSyntaxResponse + * @returns {undefined} + * @variation 1 */ - Entity.prototype.name = ""; + Object.defineProperty(LanguageService.prototype.analyzeSyntax = function analyzeSyntax(request, callback) { + return this.rpcCall(analyzeSyntax, $root.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, $root.google.cloud.language.v1beta2.AnalyzeSyntaxResponse, request, callback); + }, "name", { value: "AnalyzeSyntax" }); /** - * Entity type. - * @member {google.cloud.language.v1beta2.Entity.Type} type - * @memberof google.cloud.language.v1beta2.Entity + * Calls AnalyzeSyntax. + * @function analyzeSyntax + * @memberof google.cloud.language.v1beta2.LanguageService * @instance + * @param {google.cloud.language.v1beta2.IAnalyzeSyntaxRequest} request AnalyzeSyntaxRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - Entity.prototype.type = 0; /** - * Entity metadata. - * @member {Object.} metadata - * @memberof google.cloud.language.v1beta2.Entity - * @instance + * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|classifyText}. + * @memberof google.cloud.language.v1beta2.LanguageService + * @typedef ClassifyTextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.language.v1beta2.ClassifyTextResponse} [response] ClassifyTextResponse */ - Entity.prototype.metadata = $util.emptyObject; /** - * Entity salience. - * @member {number} salience - * @memberof google.cloud.language.v1beta2.Entity + * Calls ClassifyText. + * @function classifyText + * @memberof google.cloud.language.v1beta2.LanguageService * @instance + * @param {google.cloud.language.v1beta2.IClassifyTextRequest} request ClassifyTextRequest message or plain object + * @param {google.cloud.language.v1beta2.LanguageService.ClassifyTextCallback} callback Node-style callback called with the error, if any, and ClassifyTextResponse + * @returns {undefined} + * @variation 1 */ - Entity.prototype.salience = 0; + Object.defineProperty(LanguageService.prototype.classifyText = function classifyText(request, callback) { + return this.rpcCall(classifyText, $root.google.cloud.language.v1beta2.ClassifyTextRequest, $root.google.cloud.language.v1beta2.ClassifyTextResponse, request, callback); + }, "name", { value: "ClassifyText" }); /** - * Entity mentions. - * @member {Array.} mentions - * @memberof google.cloud.language.v1beta2.Entity + * Calls ClassifyText. + * @function classifyText + * @memberof google.cloud.language.v1beta2.LanguageService * @instance + * @param {google.cloud.language.v1beta2.IClassifyTextRequest} request ClassifyTextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - Entity.prototype.mentions = $util.emptyArray; /** - * Entity sentiment. - * @member {google.cloud.language.v1beta2.ISentiment|null|undefined} sentiment - * @memberof google.cloud.language.v1beta2.Entity + * Callback as used by {@link google.cloud.language.v1beta2.LanguageService|annotateText}. + * @memberof google.cloud.language.v1beta2.LanguageService + * @typedef AnnotateTextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.language.v1beta2.AnnotateTextResponse} [response] AnnotateTextResponse + */ + + /** + * Calls AnnotateText. + * @function annotateText + * @memberof google.cloud.language.v1beta2.LanguageService * @instance + * @param {google.cloud.language.v1beta2.IAnnotateTextRequest} request AnnotateTextRequest message or plain object + * @param {google.cloud.language.v1beta2.LanguageService.AnnotateTextCallback} callback Node-style callback called with the error, if any, and AnnotateTextResponse + * @returns {undefined} + * @variation 1 */ - Entity.prototype.sentiment = null; + Object.defineProperty(LanguageService.prototype.annotateText = function annotateText(request, callback) { + return this.rpcCall(annotateText, $root.google.cloud.language.v1beta2.AnnotateTextRequest, $root.google.cloud.language.v1beta2.AnnotateTextResponse, request, callback); + }, "name", { value: "AnnotateText" }); /** - * Creates a new Entity instance using the specified properties. + * Calls AnnotateText. + * @function annotateText + * @memberof google.cloud.language.v1beta2.LanguageService + * @instance + * @param {google.cloud.language.v1beta2.IAnnotateTextRequest} request AnnotateTextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return LanguageService; + })(); + + v1beta2.Document = (function() { + + /** + * Properties of a Document. + * @memberof google.cloud.language.v1beta2 + * @interface IDocument + * @property {google.cloud.language.v1beta2.Document.Type|null} [type] Document type + * @property {string|null} [content] Document content + * @property {string|null} [gcsContentUri] Document gcsContentUri + * @property {string|null} [language] Document language + * @property {string|null} [referenceWebUri] Document referenceWebUri + * @property {google.cloud.language.v1beta2.Document.BoilerplateHandling|null} [boilerplateHandling] Document boilerplateHandling + */ + + /** + * Constructs a new Document. + * @memberof google.cloud.language.v1beta2 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.cloud.language.v1beta2.IDocument=} [properties] Properties to set + */ + function Document(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Document type. + * @member {google.cloud.language.v1beta2.Document.Type} type + * @memberof google.cloud.language.v1beta2.Document + * @instance + */ + Document.prototype.type = 0; + + /** + * Document content. + * @member {string|null|undefined} content + * @memberof google.cloud.language.v1beta2.Document + * @instance + */ + Document.prototype.content = null; + + /** + * Document gcsContentUri. + * @member {string|null|undefined} gcsContentUri + * @memberof google.cloud.language.v1beta2.Document + * @instance + */ + Document.prototype.gcsContentUri = null; + + /** + * Document language. + * @member {string} language + * @memberof google.cloud.language.v1beta2.Document + * @instance + */ + Document.prototype.language = ""; + + /** + * Document referenceWebUri. + * @member {string} referenceWebUri + * @memberof google.cloud.language.v1beta2.Document + * @instance + */ + Document.prototype.referenceWebUri = ""; + + /** + * Document boilerplateHandling. + * @member {google.cloud.language.v1beta2.Document.BoilerplateHandling} boilerplateHandling + * @memberof google.cloud.language.v1beta2.Document + * @instance + */ + Document.prototype.boilerplateHandling = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Document source. + * @member {"content"|"gcsContentUri"|undefined} source + * @memberof google.cloud.language.v1beta2.Document + * @instance + */ + Object.defineProperty(Document.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["content", "gcsContentUri"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Document instance using the specified properties. * @function create - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static - * @param {google.cloud.language.v1beta2.IEntity=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.Entity} Entity instance + * @param {google.cloud.language.v1beta2.IDocument=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.Document} Document instance */ - Entity.create = function create(properties) { - return new Entity(properties); + Document.create = function create(properties) { + return new Document(properties); }; /** - * Encodes the specified Entity message. Does not implicitly {@link google.cloud.language.v1beta2.Entity.verify|verify} messages. + * Encodes the specified Document message. Does not implicitly {@link google.cloud.language.v1beta2.Document.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static - * @param {google.cloud.language.v1beta2.IEntity} message Entity message or plain object to encode + * @param {google.cloud.language.v1beta2.IDocument} message Document message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Entity.encode = function encode(message, writer) { + Document.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); - if (message.salience != null && Object.hasOwnProperty.call(message, "salience")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.salience); - if (message.mentions != null && message.mentions.length) - for (var i = 0; i < message.mentions.length; ++i) - $root.google.cloud.language.v1beta2.EntityMention.encode(message.mentions[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.sentiment != null && Object.hasOwnProperty.call(message, "sentiment")) - $root.google.cloud.language.v1beta2.Sentiment.encode(message.sentiment, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.content); + if (message.gcsContentUri != null && Object.hasOwnProperty.call(message, "gcsContentUri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.gcsContentUri); + if (message.language != null && Object.hasOwnProperty.call(message, "language")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.language); + if (message.referenceWebUri != null && Object.hasOwnProperty.call(message, "referenceWebUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.referenceWebUri); + if (message.boilerplateHandling != null && Object.hasOwnProperty.call(message, "boilerplateHandling")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.boilerplateHandling); return writer; }; /** - * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Entity.verify|verify} messages. + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Document.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static - * @param {google.cloud.language.v1beta2.IEntity} message Entity message or plain object to encode + * @param {google.cloud.language.v1beta2.IDocument} message Document message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Entity.encodeDelimited = function encodeDelimited(message, writer) { + Document.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Entity message from the specified reader or buffer. + * Decodes a Document message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.Entity} Entity + * @returns {google.cloud.language.v1beta2.Document} Document * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Entity.decode = function decode(reader, length) { + Document.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Entity(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Document(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.type = reader.int32(); break; } case 2: { - message.type = reader.int32(); + message.content = reader.string(); break; } case 3: { - if (message.metadata === $util.emptyObject) - message.metadata = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.metadata[key] = value; + message.gcsContentUri = reader.string(); break; } case 4: { - message.salience = reader.float(); + message.language = reader.string(); break; } case 5: { - if (!(message.mentions && message.mentions.length)) - message.mentions = []; - message.mentions.push($root.google.cloud.language.v1beta2.EntityMention.decode(reader, reader.uint32())); + message.referenceWebUri = reader.string(); break; } case 6: { - message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.decode(reader, reader.uint32()); + message.boilerplateHandling = reader.int32(); break; } default: @@ -9169,35 +9320,33 @@ }; /** - * Decodes an Entity message from the specified reader or buffer, length delimited. + * Decodes a Document message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.Entity} Entity + * @returns {google.cloud.language.v1beta2.Document} Document * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Entity.decodeDelimited = function decodeDelimited(reader) { + Document.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Entity message. + * Verifies a Document message. * @function verify - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Entity.verify = function verify(message) { + Document.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + var properties = {}; if (message.type != null && message.hasOwnProperty("type")) switch (message.type) { default: @@ -9205,272 +9354,209 @@ case 0: case 1: case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 9: - case 10: - case 11: - case 12: - case 13: break; } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - if (!$util.isObject(message.metadata)) - return "metadata: object expected"; - var key = Object.keys(message.metadata); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.metadata[key[i]])) - return "metadata: string{k:string} expected"; + if (message.content != null && message.hasOwnProperty("content")) { + properties.source = 1; + if (!$util.isString(message.content)) + return "content: string expected"; } - if (message.salience != null && message.hasOwnProperty("salience")) - if (typeof message.salience !== "number") - return "salience: number expected"; - if (message.mentions != null && message.hasOwnProperty("mentions")) { - if (!Array.isArray(message.mentions)) - return "mentions: array expected"; - for (var i = 0; i < message.mentions.length; ++i) { - var error = $root.google.cloud.language.v1beta2.EntityMention.verify(message.mentions[i]); - if (error) - return "mentions." + error; - } - } - if (message.sentiment != null && message.hasOwnProperty("sentiment")) { - var error = $root.google.cloud.language.v1beta2.Sentiment.verify(message.sentiment); - if (error) - return "sentiment." + error; + if (message.gcsContentUri != null && message.hasOwnProperty("gcsContentUri")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!$util.isString(message.gcsContentUri)) + return "gcsContentUri: string expected"; } + if (message.language != null && message.hasOwnProperty("language")) + if (!$util.isString(message.language)) + return "language: string expected"; + if (message.referenceWebUri != null && message.hasOwnProperty("referenceWebUri")) + if (!$util.isString(message.referenceWebUri)) + return "referenceWebUri: string expected"; + if (message.boilerplateHandling != null && message.hasOwnProperty("boilerplateHandling")) + switch (message.boilerplateHandling) { + default: + return "boilerplateHandling: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * Creates a Document message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.Entity} Entity + * @returns {google.cloud.language.v1beta2.Document} Document */ - Entity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.Entity) + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.Document) return object; - var message = new $root.google.cloud.language.v1beta2.Entity(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.language.v1beta2.Document(); switch (object.type) { - case "UNKNOWN": + case "TYPE_UNSPECIFIED": case 0: message.type = 0; break; - case "PERSON": + case "PLAIN_TEXT": case 1: message.type = 1; break; - case "LOCATION": + case "HTML": case 2: message.type = 2; break; - case "ORGANIZATION": - case 3: - message.type = 3; - break; - case "EVENT": - case 4: - message.type = 4; - break; - case "WORK_OF_ART": - case 5: - message.type = 5; - break; - case "CONSUMER_GOOD": - case 6: - message.type = 6; - break; - case "OTHER": - case 7: - message.type = 7; - break; - case "PHONE_NUMBER": - case 9: - message.type = 9; - break; - case "ADDRESS": - case 10: - message.type = 10; - break; - case "DATE": - case 11: - message.type = 11; + } + if (object.content != null) + message.content = String(object.content); + if (object.gcsContentUri != null) + message.gcsContentUri = String(object.gcsContentUri); + if (object.language != null) + message.language = String(object.language); + if (object.referenceWebUri != null) + message.referenceWebUri = String(object.referenceWebUri); + switch (object.boilerplateHandling) { + case "BOILERPLATE_HANDLING_UNSPECIFIED": + case 0: + message.boilerplateHandling = 0; break; - case "NUMBER": - case 12: - message.type = 12; + case "SKIP_BOILERPLATE": + case 1: + message.boilerplateHandling = 1; break; - case "PRICE": - case 13: - message.type = 13; + case "KEEP_BOILERPLATE": + case 2: + message.boilerplateHandling = 2; break; } - if (object.metadata) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.language.v1beta2.Entity.metadata: object expected"); - message.metadata = {}; - for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) - message.metadata[keys[i]] = String(object.metadata[keys[i]]); - } - if (object.salience != null) - message.salience = Number(object.salience); - if (object.mentions) { - if (!Array.isArray(object.mentions)) - throw TypeError(".google.cloud.language.v1beta2.Entity.mentions: array expected"); - message.mentions = []; - for (var i = 0; i < object.mentions.length; ++i) { - if (typeof object.mentions[i] !== "object") - throw TypeError(".google.cloud.language.v1beta2.Entity.mentions: object expected"); - message.mentions[i] = $root.google.cloud.language.v1beta2.EntityMention.fromObject(object.mentions[i]); - } - } - if (object.sentiment != null) { - if (typeof object.sentiment !== "object") - throw TypeError(".google.cloud.language.v1beta2.Entity.sentiment: object expected"); - message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.fromObject(object.sentiment); - } return message; }; /** - * Creates a plain object from an Entity message. Also converts values to other types if specified. + * Creates a plain object from a Document message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static - * @param {google.cloud.language.v1beta2.Entity} message Entity + * @param {google.cloud.language.v1beta2.Document} message Document * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Entity.toObject = function toObject(message, options) { + Document.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.mentions = []; - if (options.objects || options.defaults) - object.metadata = {}; if (options.defaults) { - object.name = ""; - object.type = options.enums === String ? "UNKNOWN" : 0; - object.salience = 0; - object.sentiment = null; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.language = ""; + object.referenceWebUri = ""; + object.boilerplateHandling = options.enums === String ? "BOILERPLATE_HANDLING_UNSPECIFIED" : 0; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.language.v1beta2.Entity.Type[message.type] : message.type; - var keys2; - if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { - object.metadata = {}; - for (var j = 0; j < keys2.length; ++j) - object.metadata[keys2[j]] = message.metadata[keys2[j]]; + object.type = options.enums === String ? $root.google.cloud.language.v1beta2.Document.Type[message.type] : message.type; + if (message.content != null && message.hasOwnProperty("content")) { + object.content = message.content; + if (options.oneofs) + object.source = "content"; } - if (message.salience != null && message.hasOwnProperty("salience")) - object.salience = options.json && !isFinite(message.salience) ? String(message.salience) : message.salience; - if (message.mentions && message.mentions.length) { - object.mentions = []; - for (var j = 0; j < message.mentions.length; ++j) - object.mentions[j] = $root.google.cloud.language.v1beta2.EntityMention.toObject(message.mentions[j], options); + if (message.gcsContentUri != null && message.hasOwnProperty("gcsContentUri")) { + object.gcsContentUri = message.gcsContentUri; + if (options.oneofs) + object.source = "gcsContentUri"; } - if (message.sentiment != null && message.hasOwnProperty("sentiment")) - object.sentiment = $root.google.cloud.language.v1beta2.Sentiment.toObject(message.sentiment, options); + if (message.language != null && message.hasOwnProperty("language")) + object.language = message.language; + if (message.referenceWebUri != null && message.hasOwnProperty("referenceWebUri")) + object.referenceWebUri = message.referenceWebUri; + if (message.boilerplateHandling != null && message.hasOwnProperty("boilerplateHandling")) + object.boilerplateHandling = options.enums === String ? $root.google.cloud.language.v1beta2.Document.BoilerplateHandling[message.boilerplateHandling] : message.boilerplateHandling; return object; }; /** - * Converts this Entity to JSON. + * Converts this Document to JSON. * @function toJSON - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @instance * @returns {Object.} JSON object */ - Entity.prototype.toJSON = function toJSON() { + Document.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Entity + * Gets the default type url for Document * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.Entity + * @memberof google.cloud.language.v1beta2.Document * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1beta2.Entity"; + return typeUrlPrefix + "/google.cloud.language.v1beta2.Document"; }; /** * Type enum. - * @name google.cloud.language.v1beta2.Entity.Type + * @name google.cloud.language.v1beta2.Document.Type * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} PERSON=1 PERSON value - * @property {number} LOCATION=2 LOCATION value - * @property {number} ORGANIZATION=3 ORGANIZATION value - * @property {number} EVENT=4 EVENT value - * @property {number} WORK_OF_ART=5 WORK_OF_ART value - * @property {number} CONSUMER_GOOD=6 CONSUMER_GOOD value - * @property {number} OTHER=7 OTHER value - * @property {number} PHONE_NUMBER=9 PHONE_NUMBER value - * @property {number} ADDRESS=10 ADDRESS value - * @property {number} DATE=11 DATE value - * @property {number} NUMBER=12 NUMBER value - * @property {number} PRICE=13 PRICE value + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} PLAIN_TEXT=1 PLAIN_TEXT value + * @property {number} HTML=2 HTML value */ - Entity.Type = (function() { + Document.Type = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "PERSON"] = 1; - values[valuesById[2] = "LOCATION"] = 2; - values[valuesById[3] = "ORGANIZATION"] = 3; - values[valuesById[4] = "EVENT"] = 4; - values[valuesById[5] = "WORK_OF_ART"] = 5; - values[valuesById[6] = "CONSUMER_GOOD"] = 6; - values[valuesById[7] = "OTHER"] = 7; - values[valuesById[9] = "PHONE_NUMBER"] = 9; - values[valuesById[10] = "ADDRESS"] = 10; - values[valuesById[11] = "DATE"] = 11; - values[valuesById[12] = "NUMBER"] = 12; - values[valuesById[13] = "PRICE"] = 13; + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PLAIN_TEXT"] = 1; + values[valuesById[2] = "HTML"] = 2; return values; })(); - return Entity; + /** + * BoilerplateHandling enum. + * @name google.cloud.language.v1beta2.Document.BoilerplateHandling + * @enum {number} + * @property {number} BOILERPLATE_HANDLING_UNSPECIFIED=0 BOILERPLATE_HANDLING_UNSPECIFIED value + * @property {number} SKIP_BOILERPLATE=1 SKIP_BOILERPLATE value + * @property {number} KEEP_BOILERPLATE=2 KEEP_BOILERPLATE value + */ + Document.BoilerplateHandling = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BOILERPLATE_HANDLING_UNSPECIFIED"] = 0; + values[valuesById[1] = "SKIP_BOILERPLATE"] = 1; + values[valuesById[2] = "KEEP_BOILERPLATE"] = 2; + return values; + })(); + + return Document; })(); - v1beta2.Token = (function() { + v1beta2.Sentence = (function() { /** - * Properties of a Token. + * Properties of a Sentence. * @memberof google.cloud.language.v1beta2 - * @interface IToken - * @property {google.cloud.language.v1beta2.ITextSpan|null} [text] Token text - * @property {google.cloud.language.v1beta2.IPartOfSpeech|null} [partOfSpeech] Token partOfSpeech - * @property {google.cloud.language.v1beta2.IDependencyEdge|null} [dependencyEdge] Token dependencyEdge - * @property {string|null} [lemma] Token lemma + * @interface ISentence + * @property {google.cloud.language.v1beta2.ITextSpan|null} [text] Sentence text + * @property {google.cloud.language.v1beta2.ISentiment|null} [sentiment] Sentence sentiment */ /** - * Constructs a new Token. + * Constructs a new Sentence. * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a Token. - * @implements IToken + * @classdesc Represents a Sentence. + * @implements ISentence * @constructor - * @param {google.cloud.language.v1beta2.IToken=} [properties] Properties to set + * @param {google.cloud.language.v1beta2.ISentence=} [properties] Properties to set */ - function Token(properties) { + function Sentence(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9478,100 +9564,80 @@ } /** - * Token text. + * Sentence text. * @member {google.cloud.language.v1beta2.ITextSpan|null|undefined} text - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @instance */ - Token.prototype.text = null; + Sentence.prototype.text = null; /** - * Token partOfSpeech. - * @member {google.cloud.language.v1beta2.IPartOfSpeech|null|undefined} partOfSpeech - * @memberof google.cloud.language.v1beta2.Token - * @instance - */ - Token.prototype.partOfSpeech = null; - - /** - * Token dependencyEdge. - * @member {google.cloud.language.v1beta2.IDependencyEdge|null|undefined} dependencyEdge - * @memberof google.cloud.language.v1beta2.Token - * @instance - */ - Token.prototype.dependencyEdge = null; - - /** - * Token lemma. - * @member {string} lemma - * @memberof google.cloud.language.v1beta2.Token + * Sentence sentiment. + * @member {google.cloud.language.v1beta2.ISentiment|null|undefined} sentiment + * @memberof google.cloud.language.v1beta2.Sentence * @instance */ - Token.prototype.lemma = ""; + Sentence.prototype.sentiment = null; /** - * Creates a new Token instance using the specified properties. + * Creates a new Sentence instance using the specified properties. * @function create - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static - * @param {google.cloud.language.v1beta2.IToken=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.Token} Token instance + * @param {google.cloud.language.v1beta2.ISentence=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.Sentence} Sentence instance */ - Token.create = function create(properties) { - return new Token(properties); + Sentence.create = function create(properties) { + return new Sentence(properties); }; /** - * Encodes the specified Token message. Does not implicitly {@link google.cloud.language.v1beta2.Token.verify|verify} messages. + * Encodes the specified Sentence message. Does not implicitly {@link google.cloud.language.v1beta2.Sentence.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static - * @param {google.cloud.language.v1beta2.IToken} message Token message or plain object to encode + * @param {google.cloud.language.v1beta2.ISentence} message Sentence message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Token.encode = function encode(message, writer) { + Sentence.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.text != null && Object.hasOwnProperty.call(message, "text")) $root.google.cloud.language.v1beta2.TextSpan.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.partOfSpeech != null && Object.hasOwnProperty.call(message, "partOfSpeech")) - $root.google.cloud.language.v1beta2.PartOfSpeech.encode(message.partOfSpeech, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dependencyEdge != null && Object.hasOwnProperty.call(message, "dependencyEdge")) - $root.google.cloud.language.v1beta2.DependencyEdge.encode(message.dependencyEdge, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.lemma != null && Object.hasOwnProperty.call(message, "lemma")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.lemma); + if (message.sentiment != null && Object.hasOwnProperty.call(message, "sentiment")) + $root.google.cloud.language.v1beta2.Sentiment.encode(message.sentiment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Token.verify|verify} messages. + * Encodes the specified Sentence message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Sentence.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static - * @param {google.cloud.language.v1beta2.IToken} message Token message or plain object to encode + * @param {google.cloud.language.v1beta2.ISentence} message Sentence message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Token.encodeDelimited = function encodeDelimited(message, writer) { + Sentence.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Token message from the specified reader or buffer. + * Decodes a Sentence message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.Token} Token + * @returns {google.cloud.language.v1beta2.Sentence} Sentence * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Token.decode = function decode(reader, length) { + Sentence.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Token(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Sentence(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -9580,15 +9646,7 @@ break; } case 2: { - message.partOfSpeech = $root.google.cloud.language.v1beta2.PartOfSpeech.decode(reader, reader.uint32()); - break; - } - case 3: { - message.dependencyEdge = $root.google.cloud.language.v1beta2.DependencyEdge.decode(reader, reader.uint32()); - break; - } - case 4: { - message.lemma = reader.string(); + message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.decode(reader, reader.uint32()); break; } default: @@ -9600,30 +9658,30 @@ }; /** - * Decodes a Token message from the specified reader or buffer, length delimited. + * Decodes a Sentence message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.Token} Token + * @returns {google.cloud.language.v1beta2.Sentence} Sentence * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Token.decodeDelimited = function decodeDelimited(reader) { + Sentence.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Token message. + * Verifies a Sentence message. * @function verify - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Token.verify = function verify(message) { + Sentence.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.text != null && message.hasOwnProperty("text")) { @@ -9631,111 +9689,90 @@ if (error) return "text." + error; } - if (message.partOfSpeech != null && message.hasOwnProperty("partOfSpeech")) { - var error = $root.google.cloud.language.v1beta2.PartOfSpeech.verify(message.partOfSpeech); - if (error) - return "partOfSpeech." + error; - } - if (message.dependencyEdge != null && message.hasOwnProperty("dependencyEdge")) { - var error = $root.google.cloud.language.v1beta2.DependencyEdge.verify(message.dependencyEdge); + if (message.sentiment != null && message.hasOwnProperty("sentiment")) { + var error = $root.google.cloud.language.v1beta2.Sentiment.verify(message.sentiment); if (error) - return "dependencyEdge." + error; + return "sentiment." + error; } - if (message.lemma != null && message.hasOwnProperty("lemma")) - if (!$util.isString(message.lemma)) - return "lemma: string expected"; return null; }; /** - * Creates a Token message from a plain object. Also converts values to their respective internal types. + * Creates a Sentence message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.Token} Token + * @returns {google.cloud.language.v1beta2.Sentence} Sentence */ - Token.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.Token) + Sentence.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.Sentence) return object; - var message = new $root.google.cloud.language.v1beta2.Token(); + var message = new $root.google.cloud.language.v1beta2.Sentence(); if (object.text != null) { if (typeof object.text !== "object") - throw TypeError(".google.cloud.language.v1beta2.Token.text: object expected"); + throw TypeError(".google.cloud.language.v1beta2.Sentence.text: object expected"); message.text = $root.google.cloud.language.v1beta2.TextSpan.fromObject(object.text); } - if (object.partOfSpeech != null) { - if (typeof object.partOfSpeech !== "object") - throw TypeError(".google.cloud.language.v1beta2.Token.partOfSpeech: object expected"); - message.partOfSpeech = $root.google.cloud.language.v1beta2.PartOfSpeech.fromObject(object.partOfSpeech); - } - if (object.dependencyEdge != null) { - if (typeof object.dependencyEdge !== "object") - throw TypeError(".google.cloud.language.v1beta2.Token.dependencyEdge: object expected"); - message.dependencyEdge = $root.google.cloud.language.v1beta2.DependencyEdge.fromObject(object.dependencyEdge); + if (object.sentiment != null) { + if (typeof object.sentiment !== "object") + throw TypeError(".google.cloud.language.v1beta2.Sentence.sentiment: object expected"); + message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.fromObject(object.sentiment); } - if (object.lemma != null) - message.lemma = String(object.lemma); return message; }; /** - * Creates a plain object from a Token message. Also converts values to other types if specified. + * Creates a plain object from a Sentence message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static - * @param {google.cloud.language.v1beta2.Token} message Token + * @param {google.cloud.language.v1beta2.Sentence} message Sentence * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Token.toObject = function toObject(message, options) { + Sentence.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.text = null; - object.partOfSpeech = null; - object.dependencyEdge = null; - object.lemma = ""; + object.sentiment = null; } if (message.text != null && message.hasOwnProperty("text")) object.text = $root.google.cloud.language.v1beta2.TextSpan.toObject(message.text, options); - if (message.partOfSpeech != null && message.hasOwnProperty("partOfSpeech")) - object.partOfSpeech = $root.google.cloud.language.v1beta2.PartOfSpeech.toObject(message.partOfSpeech, options); - if (message.dependencyEdge != null && message.hasOwnProperty("dependencyEdge")) - object.dependencyEdge = $root.google.cloud.language.v1beta2.DependencyEdge.toObject(message.dependencyEdge, options); - if (message.lemma != null && message.hasOwnProperty("lemma")) - object.lemma = message.lemma; + if (message.sentiment != null && message.hasOwnProperty("sentiment")) + object.sentiment = $root.google.cloud.language.v1beta2.Sentiment.toObject(message.sentiment, options); return object; }; /** - * Converts this Token to JSON. + * Converts this Sentence to JSON. * @function toJSON - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @instance * @returns {Object.} JSON object */ - Token.prototype.toJSON = function toJSON() { + Sentence.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Token + * Gets the default type url for Sentence * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.Token + * @memberof google.cloud.language.v1beta2.Sentence * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Token.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Sentence.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1beta2.Token"; + return typeUrlPrefix + "/google.cloud.language.v1beta2.Sentence"; }; - return Token; + return Sentence; })(); /** @@ -9756,25 +9793,31 @@ return values; })(); - v1beta2.Sentiment = (function() { + v1beta2.Entity = (function() { /** - * Properties of a Sentiment. + * Properties of an Entity. * @memberof google.cloud.language.v1beta2 - * @interface ISentiment - * @property {number|null} [magnitude] Sentiment magnitude - * @property {number|null} [score] Sentiment score + * @interface IEntity + * @property {string|null} [name] Entity name + * @property {google.cloud.language.v1beta2.Entity.Type|null} [type] Entity type + * @property {Object.|null} [metadata] Entity metadata + * @property {number|null} [salience] Entity salience + * @property {Array.|null} [mentions] Entity mentions + * @property {google.cloud.language.v1beta2.ISentiment|null} [sentiment] Entity sentiment */ /** - * Constructs a new Sentiment. + * Constructs a new Entity. * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a Sentiment. - * @implements ISentiment + * @classdesc Represents an Entity. + * @implements IEntity * @constructor - * @param {google.cloud.language.v1beta2.ISentiment=} [properties] Properties to set + * @param {google.cloud.language.v1beta2.IEntity=} [properties] Properties to set */ - function Sentiment(properties) { + function Entity(properties) { + this.metadata = {}; + this.mentions = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9782,89 +9825,168 @@ } /** - * Sentiment magnitude. - * @member {number} magnitude - * @memberof google.cloud.language.v1beta2.Sentiment + * Entity name. + * @member {string} name + * @memberof google.cloud.language.v1beta2.Entity * @instance */ - Sentiment.prototype.magnitude = 0; + Entity.prototype.name = ""; /** - * Sentiment score. - * @member {number} score - * @memberof google.cloud.language.v1beta2.Sentiment + * Entity type. + * @member {google.cloud.language.v1beta2.Entity.Type} type + * @memberof google.cloud.language.v1beta2.Entity * @instance */ - Sentiment.prototype.score = 0; + Entity.prototype.type = 0; /** - * Creates a new Sentiment instance using the specified properties. - * @function create - * @memberof google.cloud.language.v1beta2.Sentiment - * @static - * @param {google.cloud.language.v1beta2.ISentiment=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment instance + * Entity metadata. + * @member {Object.} metadata + * @memberof google.cloud.language.v1beta2.Entity + * @instance */ - Sentiment.create = function create(properties) { - return new Sentiment(properties); - }; + Entity.prototype.metadata = $util.emptyObject; /** - * Encodes the specified Sentiment message. Does not implicitly {@link google.cloud.language.v1beta2.Sentiment.verify|verify} messages. - * @function encode - * @memberof google.cloud.language.v1beta2.Sentiment - * @static - * @param {google.cloud.language.v1beta2.ISentiment} message Sentiment message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Entity salience. + * @member {number} salience + * @memberof google.cloud.language.v1beta2.Entity + * @instance */ - Sentiment.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.magnitude != null && Object.hasOwnProperty.call(message, "magnitude")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.magnitude); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.score); - return writer; - }; + Entity.prototype.salience = 0; /** - * Encodes the specified Sentiment message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Sentiment.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.Sentiment - * @static - * @param {google.cloud.language.v1beta2.ISentiment} message Sentiment message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Sentiment.encodeDelimited = function encodeDelimited(message, writer) { + * Entity mentions. + * @member {Array.} mentions + * @memberof google.cloud.language.v1beta2.Entity + * @instance + */ + Entity.prototype.mentions = $util.emptyArray; + + /** + * Entity sentiment. + * @member {google.cloud.language.v1beta2.ISentiment|null|undefined} sentiment + * @memberof google.cloud.language.v1beta2.Entity + * @instance + */ + Entity.prototype.sentiment = null; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.Entity + * @static + * @param {google.cloud.language.v1beta2.IEntity=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.language.v1beta2.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.Entity + * @static + * @param {google.cloud.language.v1beta2.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.salience != null && Object.hasOwnProperty.call(message, "salience")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.salience); + if (message.mentions != null && message.mentions.length) + for (var i = 0; i < message.mentions.length; ++i) + $root.google.cloud.language.v1beta2.EntityMention.encode(message.mentions[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.sentiment != null && Object.hasOwnProperty.call(message, "sentiment")) + $root.google.cloud.language.v1beta2.Sentiment.encode(message.sentiment, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1beta2.Entity + * @static + * @param {google.cloud.language.v1beta2.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Sentiment message from the specified reader or buffer. + * Decodes an Entity message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.Sentiment + * @memberof google.cloud.language.v1beta2.Entity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment + * @returns {google.cloud.language.v1beta2.Entity} Entity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Sentiment.decode = function decode(reader, length) { + Entity.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Sentiment(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Entity(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } case 2: { - message.magnitude = reader.float(); + message.type = reader.int32(); break; } case 3: { - message.score = reader.float(); + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 4: { + message.salience = reader.float(); + break; + } + case 5: { + if (!(message.mentions && message.mentions.length)) + message.mentions = []; + message.mentions.push($root.google.cloud.language.v1beta2.EntityMention.decode(reader, reader.uint32())); + break; + } + case 6: { + message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.decode(reader, reader.uint32()); break; } default: @@ -9876,142 +9998,308 @@ }; /** - * Decodes a Sentiment message from the specified reader or buffer, length delimited. + * Decodes an Entity message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.Sentiment + * @memberof google.cloud.language.v1beta2.Entity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment + * @returns {google.cloud.language.v1beta2.Entity} Entity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Sentiment.decodeDelimited = function decodeDelimited(reader) { + Entity.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Sentiment message. + * Verifies an Entity message. * @function verify - * @memberof google.cloud.language.v1beta2.Sentiment + * @memberof google.cloud.language.v1beta2.Entity * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Sentiment.verify = function verify(message) { + Entity.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.magnitude != null && message.hasOwnProperty("magnitude")) - if (typeof message.magnitude !== "number") - return "magnitude: number expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 9: + case 10: + case 11: + case 12: + case 13: + break; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.salience != null && message.hasOwnProperty("salience")) + if (typeof message.salience !== "number") + return "salience: number expected"; + if (message.mentions != null && message.hasOwnProperty("mentions")) { + if (!Array.isArray(message.mentions)) + return "mentions: array expected"; + for (var i = 0; i < message.mentions.length; ++i) { + var error = $root.google.cloud.language.v1beta2.EntityMention.verify(message.mentions[i]); + if (error) + return "mentions." + error; + } + } + if (message.sentiment != null && message.hasOwnProperty("sentiment")) { + var error = $root.google.cloud.language.v1beta2.Sentiment.verify(message.sentiment); + if (error) + return "sentiment." + error; + } return null; }; /** - * Creates a Sentiment message from a plain object. Also converts values to their respective internal types. + * Creates an Entity message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.Sentiment + * @memberof google.cloud.language.v1beta2.Entity * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment + * @returns {google.cloud.language.v1beta2.Entity} Entity */ - Sentiment.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.Sentiment) + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.Entity) return object; - var message = new $root.google.cloud.language.v1beta2.Sentiment(); - if (object.magnitude != null) - message.magnitude = Number(object.magnitude); - if (object.score != null) - message.score = Number(object.score); - return message; - }; - - /** - * Creates a plain object from a Sentiment message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.language.v1beta2.Sentiment - * @static - * @param {google.cloud.language.v1beta2.Sentiment} message Sentiment - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Sentiment.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.magnitude = 0; - object.score = 0; - } - if (message.magnitude != null && message.hasOwnProperty("magnitude")) - object.magnitude = options.json && !isFinite(message.magnitude) ? String(message.magnitude) : message.magnitude; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - return object; - }; - - /** - * Converts this Sentiment to JSON. - * @function toJSON - * @memberof google.cloud.language.v1beta2.Sentiment - * @instance - * @returns {Object.} JSON object - */ - Sentiment.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Sentiment - * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.Sentiment - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Sentiment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.language.v1beta2.Sentiment"; - }; - - return Sentiment; - })(); - - v1beta2.PartOfSpeech = (function() { + var message = new $root.google.cloud.language.v1beta2.Entity(); + if (object.name != null) + message.name = String(object.name); + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "PERSON": + case 1: + message.type = 1; + break; + case "LOCATION": + case 2: + message.type = 2; + break; + case "ORGANIZATION": + case 3: + message.type = 3; + break; + case "EVENT": + case 4: + message.type = 4; + break; + case "WORK_OF_ART": + case 5: + message.type = 5; + break; + case "CONSUMER_GOOD": + case 6: + message.type = 6; + break; + case "OTHER": + case 7: + message.type = 7; + break; + case "PHONE_NUMBER": + case 9: + message.type = 9; + break; + case "ADDRESS": + case 10: + message.type = 10; + break; + case "DATE": + case 11: + message.type = 11; + break; + case "NUMBER": + case 12: + message.type = 12; + break; + case "PRICE": + case 13: + message.type = 13; + break; + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.language.v1beta2.Entity.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.salience != null) + message.salience = Number(object.salience); + if (object.mentions) { + if (!Array.isArray(object.mentions)) + throw TypeError(".google.cloud.language.v1beta2.Entity.mentions: array expected"); + message.mentions = []; + for (var i = 0; i < object.mentions.length; ++i) { + if (typeof object.mentions[i] !== "object") + throw TypeError(".google.cloud.language.v1beta2.Entity.mentions: object expected"); + message.mentions[i] = $root.google.cloud.language.v1beta2.EntityMention.fromObject(object.mentions[i]); + } + } + if (object.sentiment != null) { + if (typeof object.sentiment !== "object") + throw TypeError(".google.cloud.language.v1beta2.Entity.sentiment: object expected"); + message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.fromObject(object.sentiment); + } + return message; + }; /** - * Properties of a PartOfSpeech. + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1beta2.Entity + * @static + * @param {google.cloud.language.v1beta2.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.mentions = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.name = ""; + object.type = options.enums === String ? "UNKNOWN" : 0; + object.salience = 0; + object.sentiment = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.language.v1beta2.Entity.Type[message.type] : message.type; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.salience != null && message.hasOwnProperty("salience")) + object.salience = options.json && !isFinite(message.salience) ? String(message.salience) : message.salience; + if (message.mentions && message.mentions.length) { + object.mentions = []; + for (var j = 0; j < message.mentions.length; ++j) + object.mentions[j] = $root.google.cloud.language.v1beta2.EntityMention.toObject(message.mentions[j], options); + } + if (message.sentiment != null && message.hasOwnProperty("sentiment")) + object.sentiment = $root.google.cloud.language.v1beta2.Sentiment.toObject(message.sentiment, options); + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.language.v1beta2.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Entity + * @function getTypeUrl + * @memberof google.cloud.language.v1beta2.Entity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1beta2.Entity"; + }; + + /** + * Type enum. + * @name google.cloud.language.v1beta2.Entity.Type + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} PERSON=1 PERSON value + * @property {number} LOCATION=2 LOCATION value + * @property {number} ORGANIZATION=3 ORGANIZATION value + * @property {number} EVENT=4 EVENT value + * @property {number} WORK_OF_ART=5 WORK_OF_ART value + * @property {number} CONSUMER_GOOD=6 CONSUMER_GOOD value + * @property {number} OTHER=7 OTHER value + * @property {number} PHONE_NUMBER=9 PHONE_NUMBER value + * @property {number} ADDRESS=10 ADDRESS value + * @property {number} DATE=11 DATE value + * @property {number} NUMBER=12 NUMBER value + * @property {number} PRICE=13 PRICE value + */ + Entity.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "PERSON"] = 1; + values[valuesById[2] = "LOCATION"] = 2; + values[valuesById[3] = "ORGANIZATION"] = 3; + values[valuesById[4] = "EVENT"] = 4; + values[valuesById[5] = "WORK_OF_ART"] = 5; + values[valuesById[6] = "CONSUMER_GOOD"] = 6; + values[valuesById[7] = "OTHER"] = 7; + values[valuesById[9] = "PHONE_NUMBER"] = 9; + values[valuesById[10] = "ADDRESS"] = 10; + values[valuesById[11] = "DATE"] = 11; + values[valuesById[12] = "NUMBER"] = 12; + values[valuesById[13] = "PRICE"] = 13; + return values; + })(); + + return Entity; + })(); + + v1beta2.Token = (function() { + + /** + * Properties of a Token. * @memberof google.cloud.language.v1beta2 - * @interface IPartOfSpeech - * @property {google.cloud.language.v1beta2.PartOfSpeech.Tag|null} [tag] PartOfSpeech tag - * @property {google.cloud.language.v1beta2.PartOfSpeech.Aspect|null} [aspect] PartOfSpeech aspect - * @property {google.cloud.language.v1beta2.PartOfSpeech.Case|null} ["case"] PartOfSpeech case - * @property {google.cloud.language.v1beta2.PartOfSpeech.Form|null} [form] PartOfSpeech form - * @property {google.cloud.language.v1beta2.PartOfSpeech.Gender|null} [gender] PartOfSpeech gender - * @property {google.cloud.language.v1beta2.PartOfSpeech.Mood|null} [mood] PartOfSpeech mood - * @property {google.cloud.language.v1beta2.PartOfSpeech.Number|null} [number] PartOfSpeech number - * @property {google.cloud.language.v1beta2.PartOfSpeech.Person|null} [person] PartOfSpeech person - * @property {google.cloud.language.v1beta2.PartOfSpeech.Proper|null} [proper] PartOfSpeech proper - * @property {google.cloud.language.v1beta2.PartOfSpeech.Reciprocity|null} [reciprocity] PartOfSpeech reciprocity - * @property {google.cloud.language.v1beta2.PartOfSpeech.Tense|null} [tense] PartOfSpeech tense - * @property {google.cloud.language.v1beta2.PartOfSpeech.Voice|null} [voice] PartOfSpeech voice + * @interface IToken + * @property {google.cloud.language.v1beta2.ITextSpan|null} [text] Token text + * @property {google.cloud.language.v1beta2.IPartOfSpeech|null} [partOfSpeech] Token partOfSpeech + * @property {google.cloud.language.v1beta2.IDependencyEdge|null} [dependencyEdge] Token dependencyEdge + * @property {string|null} [lemma] Token lemma */ /** - * Constructs a new PartOfSpeech. + * Constructs a new Token. * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a PartOfSpeech. - * @implements IPartOfSpeech + * @classdesc Represents a Token. + * @implements IToken * @constructor - * @param {google.cloud.language.v1beta2.IPartOfSpeech=} [properties] Properties to set + * @param {google.cloud.language.v1beta2.IToken=} [properties] Properties to set */ - function PartOfSpeech(properties) { + function Token(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10019,229 +10307,117 @@ } /** - * PartOfSpeech tag. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Tag} tag - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * Token text. + * @member {google.cloud.language.v1beta2.ITextSpan|null|undefined} text + * @memberof google.cloud.language.v1beta2.Token * @instance */ - PartOfSpeech.prototype.tag = 0; + Token.prototype.text = null; /** - * PartOfSpeech aspect. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Aspect} aspect - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * Token partOfSpeech. + * @member {google.cloud.language.v1beta2.IPartOfSpeech|null|undefined} partOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @instance */ - PartOfSpeech.prototype.aspect = 0; + Token.prototype.partOfSpeech = null; /** - * PartOfSpeech case. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Case} case - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * Token dependencyEdge. + * @member {google.cloud.language.v1beta2.IDependencyEdge|null|undefined} dependencyEdge + * @memberof google.cloud.language.v1beta2.Token * @instance */ - PartOfSpeech.prototype["case"] = 0; + Token.prototype.dependencyEdge = null; /** - * PartOfSpeech form. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Form} form - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * Token lemma. + * @member {string} lemma + * @memberof google.cloud.language.v1beta2.Token * @instance */ - PartOfSpeech.prototype.form = 0; - - /** - * PartOfSpeech gender. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Gender} gender - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.gender = 0; - - /** - * PartOfSpeech mood. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Mood} mood - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.mood = 0; - - /** - * PartOfSpeech number. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Number} number - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.number = 0; - - /** - * PartOfSpeech person. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Person} person - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.person = 0; - - /** - * PartOfSpeech proper. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Proper} proper - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.proper = 0; - - /** - * PartOfSpeech reciprocity. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Reciprocity} reciprocity - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.reciprocity = 0; - - /** - * PartOfSpeech tense. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Tense} tense - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.tense = 0; - - /** - * PartOfSpeech voice. - * @member {google.cloud.language.v1beta2.PartOfSpeech.Voice} voice - * @memberof google.cloud.language.v1beta2.PartOfSpeech - * @instance - */ - PartOfSpeech.prototype.voice = 0; + Token.prototype.lemma = ""; /** - * Creates a new PartOfSpeech instance using the specified properties. + * Creates a new Token instance using the specified properties. * @function create - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static - * @param {google.cloud.language.v1beta2.IPartOfSpeech=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech instance + * @param {google.cloud.language.v1beta2.IToken=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.Token} Token instance */ - PartOfSpeech.create = function create(properties) { - return new PartOfSpeech(properties); + Token.create = function create(properties) { + return new Token(properties); }; /** - * Encodes the specified PartOfSpeech message. Does not implicitly {@link google.cloud.language.v1beta2.PartOfSpeech.verify|verify} messages. + * Encodes the specified Token message. Does not implicitly {@link google.cloud.language.v1beta2.Token.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static - * @param {google.cloud.language.v1beta2.IPartOfSpeech} message PartOfSpeech message or plain object to encode + * @param {google.cloud.language.v1beta2.IToken} message Token message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PartOfSpeech.encode = function encode(message, writer) { + Token.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.tag != null && Object.hasOwnProperty.call(message, "tag")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.tag); - if (message.aspect != null && Object.hasOwnProperty.call(message, "aspect")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.aspect); - if (message["case"] != null && Object.hasOwnProperty.call(message, "case")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message["case"]); - if (message.form != null && Object.hasOwnProperty.call(message, "form")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.form); - if (message.gender != null && Object.hasOwnProperty.call(message, "gender")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.gender); - if (message.mood != null && Object.hasOwnProperty.call(message, "mood")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.mood); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.number); - if (message.person != null && Object.hasOwnProperty.call(message, "person")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.person); - if (message.proper != null && Object.hasOwnProperty.call(message, "proper")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.proper); - if (message.reciprocity != null && Object.hasOwnProperty.call(message, "reciprocity")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.reciprocity); - if (message.tense != null && Object.hasOwnProperty.call(message, "tense")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.tense); - if (message.voice != null && Object.hasOwnProperty.call(message, "voice")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.voice); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.language.v1beta2.TextSpan.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.partOfSpeech != null && Object.hasOwnProperty.call(message, "partOfSpeech")) + $root.google.cloud.language.v1beta2.PartOfSpeech.encode(message.partOfSpeech, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dependencyEdge != null && Object.hasOwnProperty.call(message, "dependencyEdge")) + $root.google.cloud.language.v1beta2.DependencyEdge.encode(message.dependencyEdge, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.lemma != null && Object.hasOwnProperty.call(message, "lemma")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.lemma); return writer; }; /** - * Encodes the specified PartOfSpeech message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.PartOfSpeech.verify|verify} messages. + * Encodes the specified Token message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Token.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static - * @param {google.cloud.language.v1beta2.IPartOfSpeech} message PartOfSpeech message or plain object to encode + * @param {google.cloud.language.v1beta2.IToken} message Token message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PartOfSpeech.encodeDelimited = function encodeDelimited(message, writer) { + Token.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PartOfSpeech message from the specified reader or buffer. + * Decodes a Token message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech + * @returns {google.cloud.language.v1beta2.Token} Token * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PartOfSpeech.decode = function decode(reader, length) { + Token.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.PartOfSpeech(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Token(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.tag = reader.int32(); + message.text = $root.google.cloud.language.v1beta2.TextSpan.decode(reader, reader.uint32()); break; } case 2: { - message.aspect = reader.int32(); + message.partOfSpeech = $root.google.cloud.language.v1beta2.PartOfSpeech.decode(reader, reader.uint32()); break; } case 3: { - message["case"] = reader.int32(); + message.dependencyEdge = $root.google.cloud.language.v1beta2.DependencyEdge.decode(reader, reader.uint32()); break; } case 4: { - message.form = reader.int32(); - break; - } - case 5: { - message.gender = reader.int32(); - break; - } - case 6: { - message.mood = reader.int32(); - break; - } - case 7: { - message.number = reader.int32(); - break; - } - case 8: { - message.person = reader.int32(); - break; - } - case 9: { - message.proper = reader.int32(); - break; - } - case 10: { - message.reciprocity = reader.int32(); - break; - } - case 11: { - message.tense = reader.int32(); - break; - } - case 12: { - message.voice = reader.int32(); + message.lemma = reader.string(); break; } default: @@ -10253,1032 +10429,253 @@ }; /** - * Decodes a PartOfSpeech message from the specified reader or buffer, length delimited. + * Decodes a Token message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech + * @returns {google.cloud.language.v1beta2.Token} Token * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PartOfSpeech.decodeDelimited = function decodeDelimited(reader) { + Token.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PartOfSpeech message. + * Verifies a Token message. * @function verify - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PartOfSpeech.verify = function verify(message) { + Token.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.tag != null && message.hasOwnProperty("tag")) - switch (message.tag) { - default: - return "tag: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - break; - } - if (message.aspect != null && message.hasOwnProperty("aspect")) - switch (message.aspect) { - default: - return "aspect: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message["case"] != null && message.hasOwnProperty("case")) - switch (message["case"]) { - default: - return "case: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - break; - } - if (message.form != null && message.hasOwnProperty("form")) - switch (message.form) { - default: - return "form: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - break; - } - if (message.gender != null && message.hasOwnProperty("gender")) - switch (message.gender) { - default: - return "gender: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.mood != null && message.hasOwnProperty("mood")) - switch (message.mood) { - default: - return "mood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - break; - } - if (message.number != null && message.hasOwnProperty("number")) - switch (message.number) { - default: - return "number: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.person != null && message.hasOwnProperty("person")) - switch (message.person) { - default: - return "person: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.proper != null && message.hasOwnProperty("proper")) - switch (message.proper) { - default: - return "proper: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.reciprocity != null && message.hasOwnProperty("reciprocity")) - switch (message.reciprocity) { - default: - return "reciprocity: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.tense != null && message.hasOwnProperty("tense")) - switch (message.tense) { - default: - return "tense: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - break; - } - if (message.voice != null && message.hasOwnProperty("voice")) - switch (message.voice) { - default: - return "voice: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } + if (message.text != null && message.hasOwnProperty("text")) { + var error = $root.google.cloud.language.v1beta2.TextSpan.verify(message.text); + if (error) + return "text." + error; + } + if (message.partOfSpeech != null && message.hasOwnProperty("partOfSpeech")) { + var error = $root.google.cloud.language.v1beta2.PartOfSpeech.verify(message.partOfSpeech); + if (error) + return "partOfSpeech." + error; + } + if (message.dependencyEdge != null && message.hasOwnProperty("dependencyEdge")) { + var error = $root.google.cloud.language.v1beta2.DependencyEdge.verify(message.dependencyEdge); + if (error) + return "dependencyEdge." + error; + } + if (message.lemma != null && message.hasOwnProperty("lemma")) + if (!$util.isString(message.lemma)) + return "lemma: string expected"; return null; }; /** - * Creates a PartOfSpeech message from a plain object. Also converts values to their respective internal types. + * Creates a Token message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech + * @returns {google.cloud.language.v1beta2.Token} Token */ - PartOfSpeech.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.PartOfSpeech) + Token.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.Token) return object; - var message = new $root.google.cloud.language.v1beta2.PartOfSpeech(); - switch (object.tag) { - case "UNKNOWN": - case 0: - message.tag = 0; - break; - case "ADJ": - case 1: - message.tag = 1; - break; - case "ADP": - case 2: - message.tag = 2; - break; - case "ADV": - case 3: - message.tag = 3; - break; - case "CONJ": - case 4: - message.tag = 4; - break; - case "DET": - case 5: - message.tag = 5; - break; - case "NOUN": - case 6: - message.tag = 6; - break; - case "NUM": - case 7: - message.tag = 7; - break; - case "PRON": - case 8: - message.tag = 8; - break; - case "PRT": - case 9: - message.tag = 9; - break; - case "PUNCT": - case 10: - message.tag = 10; - break; - case "VERB": - case 11: - message.tag = 11; - break; - case "X": - case 12: - message.tag = 12; - break; - case "AFFIX": - case 13: - message.tag = 13; - break; + var message = new $root.google.cloud.language.v1beta2.Token(); + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.language.v1beta2.Token.text: object expected"); + message.text = $root.google.cloud.language.v1beta2.TextSpan.fromObject(object.text); } - switch (object.aspect) { - case "ASPECT_UNKNOWN": - case 0: - message.aspect = 0; - break; - case "PERFECTIVE": - case 1: - message.aspect = 1; - break; - case "IMPERFECTIVE": - case 2: - message.aspect = 2; - break; - case "PROGRESSIVE": - case 3: - message.aspect = 3; - break; + if (object.partOfSpeech != null) { + if (typeof object.partOfSpeech !== "object") + throw TypeError(".google.cloud.language.v1beta2.Token.partOfSpeech: object expected"); + message.partOfSpeech = $root.google.cloud.language.v1beta2.PartOfSpeech.fromObject(object.partOfSpeech); } - switch (object["case"]) { - case "CASE_UNKNOWN": - case 0: - message["case"] = 0; - break; - case "ACCUSATIVE": - case 1: - message["case"] = 1; - break; - case "ADVERBIAL": - case 2: - message["case"] = 2; - break; - case "COMPLEMENTIVE": - case 3: - message["case"] = 3; - break; - case "DATIVE": - case 4: - message["case"] = 4; - break; - case "GENITIVE": - case 5: - message["case"] = 5; - break; - case "INSTRUMENTAL": - case 6: - message["case"] = 6; - break; - case "LOCATIVE": - case 7: - message["case"] = 7; - break; - case "NOMINATIVE": - case 8: - message["case"] = 8; - break; - case "OBLIQUE": - case 9: - message["case"] = 9; - break; - case "PARTITIVE": - case 10: - message["case"] = 10; - break; - case "PREPOSITIONAL": - case 11: - message["case"] = 11; - break; - case "REFLEXIVE_CASE": - case 12: - message["case"] = 12; - break; - case "RELATIVE_CASE": - case 13: - message["case"] = 13; - break; - case "VOCATIVE": - case 14: - message["case"] = 14; - break; - } - switch (object.form) { - case "FORM_UNKNOWN": - case 0: - message.form = 0; - break; - case "ADNOMIAL": - case 1: - message.form = 1; - break; - case "AUXILIARY": - case 2: - message.form = 2; - break; - case "COMPLEMENTIZER": - case 3: - message.form = 3; - break; - case "FINAL_ENDING": - case 4: - message.form = 4; - break; - case "GERUND": - case 5: - message.form = 5; - break; - case "REALIS": - case 6: - message.form = 6; - break; - case "IRREALIS": - case 7: - message.form = 7; - break; - case "SHORT": - case 8: - message.form = 8; - break; - case "LONG": - case 9: - message.form = 9; - break; - case "ORDER": - case 10: - message.form = 10; - break; - case "SPECIFIC": - case 11: - message.form = 11; - break; - } - switch (object.gender) { - case "GENDER_UNKNOWN": - case 0: - message.gender = 0; - break; - case "FEMININE": - case 1: - message.gender = 1; - break; - case "MASCULINE": - case 2: - message.gender = 2; - break; - case "NEUTER": - case 3: - message.gender = 3; - break; - } - switch (object.mood) { - case "MOOD_UNKNOWN": - case 0: - message.mood = 0; - break; - case "CONDITIONAL_MOOD": - case 1: - message.mood = 1; - break; - case "IMPERATIVE": - case 2: - message.mood = 2; - break; - case "INDICATIVE": - case 3: - message.mood = 3; - break; - case "INTERROGATIVE": - case 4: - message.mood = 4; - break; - case "JUSSIVE": - case 5: - message.mood = 5; - break; - case "SUBJUNCTIVE": - case 6: - message.mood = 6; - break; - } - switch (object.number) { - case "NUMBER_UNKNOWN": - case 0: - message.number = 0; - break; - case "SINGULAR": - case 1: - message.number = 1; - break; - case "PLURAL": - case 2: - message.number = 2; - break; - case "DUAL": - case 3: - message.number = 3; - break; - } - switch (object.person) { - case "PERSON_UNKNOWN": - case 0: - message.person = 0; - break; - case "FIRST": - case 1: - message.person = 1; - break; - case "SECOND": - case 2: - message.person = 2; - break; - case "THIRD": - case 3: - message.person = 3; - break; - case "REFLEXIVE_PERSON": - case 4: - message.person = 4; - break; - } - switch (object.proper) { - case "PROPER_UNKNOWN": - case 0: - message.proper = 0; - break; - case "PROPER": - case 1: - message.proper = 1; - break; - case "NOT_PROPER": - case 2: - message.proper = 2; - break; - } - switch (object.reciprocity) { - case "RECIPROCITY_UNKNOWN": - case 0: - message.reciprocity = 0; - break; - case "RECIPROCAL": - case 1: - message.reciprocity = 1; - break; - case "NON_RECIPROCAL": - case 2: - message.reciprocity = 2; - break; - } - switch (object.tense) { - case "TENSE_UNKNOWN": - case 0: - message.tense = 0; - break; - case "CONDITIONAL_TENSE": - case 1: - message.tense = 1; - break; - case "FUTURE": - case 2: - message.tense = 2; - break; - case "PAST": - case 3: - message.tense = 3; - break; - case "PRESENT": - case 4: - message.tense = 4; - break; - case "IMPERFECT": - case 5: - message.tense = 5; - break; - case "PLUPERFECT": - case 6: - message.tense = 6; - break; - } - switch (object.voice) { - case "VOICE_UNKNOWN": - case 0: - message.voice = 0; - break; - case "ACTIVE": - case 1: - message.voice = 1; - break; - case "CAUSATIVE": - case 2: - message.voice = 2; - break; - case "PASSIVE": - case 3: - message.voice = 3; - break; + if (object.dependencyEdge != null) { + if (typeof object.dependencyEdge !== "object") + throw TypeError(".google.cloud.language.v1beta2.Token.dependencyEdge: object expected"); + message.dependencyEdge = $root.google.cloud.language.v1beta2.DependencyEdge.fromObject(object.dependencyEdge); } + if (object.lemma != null) + message.lemma = String(object.lemma); return message; }; /** - * Creates a plain object from a PartOfSpeech message. Also converts values to other types if specified. + * Creates a plain object from a Token message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static - * @param {google.cloud.language.v1beta2.PartOfSpeech} message PartOfSpeech + * @param {google.cloud.language.v1beta2.Token} message Token * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PartOfSpeech.toObject = function toObject(message, options) { + Token.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.tag = options.enums === String ? "UNKNOWN" : 0; - object.aspect = options.enums === String ? "ASPECT_UNKNOWN" : 0; - object["case"] = options.enums === String ? "CASE_UNKNOWN" : 0; - object.form = options.enums === String ? "FORM_UNKNOWN" : 0; - object.gender = options.enums === String ? "GENDER_UNKNOWN" : 0; - object.mood = options.enums === String ? "MOOD_UNKNOWN" : 0; - object.number = options.enums === String ? "NUMBER_UNKNOWN" : 0; - object.person = options.enums === String ? "PERSON_UNKNOWN" : 0; - object.proper = options.enums === String ? "PROPER_UNKNOWN" : 0; - object.reciprocity = options.enums === String ? "RECIPROCITY_UNKNOWN" : 0; - object.tense = options.enums === String ? "TENSE_UNKNOWN" : 0; - object.voice = options.enums === String ? "VOICE_UNKNOWN" : 0; + object.text = null; + object.partOfSpeech = null; + object.dependencyEdge = null; + object.lemma = ""; } - if (message.tag != null && message.hasOwnProperty("tag")) - object.tag = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Tag[message.tag] : message.tag; - if (message.aspect != null && message.hasOwnProperty("aspect")) - object.aspect = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Aspect[message.aspect] : message.aspect; - if (message["case"] != null && message.hasOwnProperty("case")) - object["case"] = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Case[message["case"]] : message["case"]; - if (message.form != null && message.hasOwnProperty("form")) - object.form = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Form[message.form] : message.form; - if (message.gender != null && message.hasOwnProperty("gender")) - object.gender = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Gender[message.gender] : message.gender; - if (message.mood != null && message.hasOwnProperty("mood")) - object.mood = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Mood[message.mood] : message.mood; - if (message.number != null && message.hasOwnProperty("number")) - object.number = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Number[message.number] : message.number; - if (message.person != null && message.hasOwnProperty("person")) - object.person = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Person[message.person] : message.person; - if (message.proper != null && message.hasOwnProperty("proper")) - object.proper = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Proper[message.proper] : message.proper; - if (message.reciprocity != null && message.hasOwnProperty("reciprocity")) - object.reciprocity = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Reciprocity[message.reciprocity] : message.reciprocity; - if (message.tense != null && message.hasOwnProperty("tense")) - object.tense = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Tense[message.tense] : message.tense; - if (message.voice != null && message.hasOwnProperty("voice")) - object.voice = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Voice[message.voice] : message.voice; + if (message.text != null && message.hasOwnProperty("text")) + object.text = $root.google.cloud.language.v1beta2.TextSpan.toObject(message.text, options); + if (message.partOfSpeech != null && message.hasOwnProperty("partOfSpeech")) + object.partOfSpeech = $root.google.cloud.language.v1beta2.PartOfSpeech.toObject(message.partOfSpeech, options); + if (message.dependencyEdge != null && message.hasOwnProperty("dependencyEdge")) + object.dependencyEdge = $root.google.cloud.language.v1beta2.DependencyEdge.toObject(message.dependencyEdge, options); + if (message.lemma != null && message.hasOwnProperty("lemma")) + object.lemma = message.lemma; return object; }; /** - * Converts this PartOfSpeech to JSON. + * Converts this Token to JSON. * @function toJSON - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @instance * @returns {Object.} JSON object */ - PartOfSpeech.prototype.toJSON = function toJSON() { + Token.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PartOfSpeech + * Gets the default type url for Token * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @memberof google.cloud.language.v1beta2.Token * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PartOfSpeech.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Token.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1beta2.PartOfSpeech"; + return typeUrlPrefix + "/google.cloud.language.v1beta2.Token"; }; + return Token; + })(); + + v1beta2.Sentiment = (function() { + /** - * Tag enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Tag - * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} ADJ=1 ADJ value - * @property {number} ADP=2 ADP value - * @property {number} ADV=3 ADV value - * @property {number} CONJ=4 CONJ value - * @property {number} DET=5 DET value - * @property {number} NOUN=6 NOUN value - * @property {number} NUM=7 NUM value - * @property {number} PRON=8 PRON value - * @property {number} PRT=9 PRT value - * @property {number} PUNCT=10 PUNCT value - * @property {number} VERB=11 VERB value - * @property {number} X=12 X value - * @property {number} AFFIX=13 AFFIX value + * Properties of a Sentiment. + * @memberof google.cloud.language.v1beta2 + * @interface ISentiment + * @property {number|null} [magnitude] Sentiment magnitude + * @property {number|null} [score] Sentiment score */ - PartOfSpeech.Tag = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "ADJ"] = 1; - values[valuesById[2] = "ADP"] = 2; - values[valuesById[3] = "ADV"] = 3; - values[valuesById[4] = "CONJ"] = 4; - values[valuesById[5] = "DET"] = 5; - values[valuesById[6] = "NOUN"] = 6; - values[valuesById[7] = "NUM"] = 7; - values[valuesById[8] = "PRON"] = 8; - values[valuesById[9] = "PRT"] = 9; - values[valuesById[10] = "PUNCT"] = 10; - values[valuesById[11] = "VERB"] = 11; - values[valuesById[12] = "X"] = 12; - values[valuesById[13] = "AFFIX"] = 13; - return values; - })(); /** - * Aspect enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Aspect - * @enum {number} - * @property {number} ASPECT_UNKNOWN=0 ASPECT_UNKNOWN value - * @property {number} PERFECTIVE=1 PERFECTIVE value - * @property {number} IMPERFECTIVE=2 IMPERFECTIVE value - * @property {number} PROGRESSIVE=3 PROGRESSIVE value + * Constructs a new Sentiment. + * @memberof google.cloud.language.v1beta2 + * @classdesc Represents a Sentiment. + * @implements ISentiment + * @constructor + * @param {google.cloud.language.v1beta2.ISentiment=} [properties] Properties to set */ - PartOfSpeech.Aspect = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ASPECT_UNKNOWN"] = 0; - values[valuesById[1] = "PERFECTIVE"] = 1; - values[valuesById[2] = "IMPERFECTIVE"] = 2; - values[valuesById[3] = "PROGRESSIVE"] = 3; - return values; - })(); + function Sentiment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Case enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Case - * @enum {number} - * @property {number} CASE_UNKNOWN=0 CASE_UNKNOWN value - * @property {number} ACCUSATIVE=1 ACCUSATIVE value - * @property {number} ADVERBIAL=2 ADVERBIAL value - * @property {number} COMPLEMENTIVE=3 COMPLEMENTIVE value - * @property {number} DATIVE=4 DATIVE value - * @property {number} GENITIVE=5 GENITIVE value - * @property {number} INSTRUMENTAL=6 INSTRUMENTAL value - * @property {number} LOCATIVE=7 LOCATIVE value - * @property {number} NOMINATIVE=8 NOMINATIVE value - * @property {number} OBLIQUE=9 OBLIQUE value - * @property {number} PARTITIVE=10 PARTITIVE value - * @property {number} PREPOSITIONAL=11 PREPOSITIONAL value - * @property {number} REFLEXIVE_CASE=12 REFLEXIVE_CASE value - * @property {number} RELATIVE_CASE=13 RELATIVE_CASE value - * @property {number} VOCATIVE=14 VOCATIVE value + * Sentiment magnitude. + * @member {number} magnitude + * @memberof google.cloud.language.v1beta2.Sentiment + * @instance */ - PartOfSpeech.Case = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CASE_UNKNOWN"] = 0; - values[valuesById[1] = "ACCUSATIVE"] = 1; - values[valuesById[2] = "ADVERBIAL"] = 2; - values[valuesById[3] = "COMPLEMENTIVE"] = 3; - values[valuesById[4] = "DATIVE"] = 4; - values[valuesById[5] = "GENITIVE"] = 5; - values[valuesById[6] = "INSTRUMENTAL"] = 6; - values[valuesById[7] = "LOCATIVE"] = 7; - values[valuesById[8] = "NOMINATIVE"] = 8; - values[valuesById[9] = "OBLIQUE"] = 9; - values[valuesById[10] = "PARTITIVE"] = 10; - values[valuesById[11] = "PREPOSITIONAL"] = 11; - values[valuesById[12] = "REFLEXIVE_CASE"] = 12; - values[valuesById[13] = "RELATIVE_CASE"] = 13; - values[valuesById[14] = "VOCATIVE"] = 14; - return values; - })(); + Sentiment.prototype.magnitude = 0; /** - * Form enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Form - * @enum {number} - * @property {number} FORM_UNKNOWN=0 FORM_UNKNOWN value - * @property {number} ADNOMIAL=1 ADNOMIAL value - * @property {number} AUXILIARY=2 AUXILIARY value - * @property {number} COMPLEMENTIZER=3 COMPLEMENTIZER value - * @property {number} FINAL_ENDING=4 FINAL_ENDING value - * @property {number} GERUND=5 GERUND value - * @property {number} REALIS=6 REALIS value - * @property {number} IRREALIS=7 IRREALIS value - * @property {number} SHORT=8 SHORT value - * @property {number} LONG=9 LONG value - * @property {number} ORDER=10 ORDER value - * @property {number} SPECIFIC=11 SPECIFIC value + * Sentiment score. + * @member {number} score + * @memberof google.cloud.language.v1beta2.Sentiment + * @instance */ - PartOfSpeech.Form = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FORM_UNKNOWN"] = 0; - values[valuesById[1] = "ADNOMIAL"] = 1; - values[valuesById[2] = "AUXILIARY"] = 2; - values[valuesById[3] = "COMPLEMENTIZER"] = 3; - values[valuesById[4] = "FINAL_ENDING"] = 4; - values[valuesById[5] = "GERUND"] = 5; - values[valuesById[6] = "REALIS"] = 6; - values[valuesById[7] = "IRREALIS"] = 7; - values[valuesById[8] = "SHORT"] = 8; - values[valuesById[9] = "LONG"] = 9; - values[valuesById[10] = "ORDER"] = 10; - values[valuesById[11] = "SPECIFIC"] = 11; - return values; - })(); + Sentiment.prototype.score = 0; /** - * Gender enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Gender - * @enum {number} - * @property {number} GENDER_UNKNOWN=0 GENDER_UNKNOWN value - * @property {number} FEMININE=1 FEMININE value - * @property {number} MASCULINE=2 MASCULINE value - * @property {number} NEUTER=3 NEUTER value + * Creates a new Sentiment instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.Sentiment + * @static + * @param {google.cloud.language.v1beta2.ISentiment=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment instance */ - PartOfSpeech.Gender = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "GENDER_UNKNOWN"] = 0; - values[valuesById[1] = "FEMININE"] = 1; - values[valuesById[2] = "MASCULINE"] = 2; - values[valuesById[3] = "NEUTER"] = 3; - return values; - })(); + Sentiment.create = function create(properties) { + return new Sentiment(properties); + }; /** - * Mood enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Mood - * @enum {number} - * @property {number} MOOD_UNKNOWN=0 MOOD_UNKNOWN value - * @property {number} CONDITIONAL_MOOD=1 CONDITIONAL_MOOD value - * @property {number} IMPERATIVE=2 IMPERATIVE value - * @property {number} INDICATIVE=3 INDICATIVE value - * @property {number} INTERROGATIVE=4 INTERROGATIVE value - * @property {number} JUSSIVE=5 JUSSIVE value - * @property {number} SUBJUNCTIVE=6 SUBJUNCTIVE value + * Encodes the specified Sentiment message. Does not implicitly {@link google.cloud.language.v1beta2.Sentiment.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.Sentiment + * @static + * @param {google.cloud.language.v1beta2.ISentiment} message Sentiment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - PartOfSpeech.Mood = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MOOD_UNKNOWN"] = 0; - values[valuesById[1] = "CONDITIONAL_MOOD"] = 1; - values[valuesById[2] = "IMPERATIVE"] = 2; - values[valuesById[3] = "INDICATIVE"] = 3; - values[valuesById[4] = "INTERROGATIVE"] = 4; - values[valuesById[5] = "JUSSIVE"] = 5; - values[valuesById[6] = "SUBJUNCTIVE"] = 6; - return values; - })(); + Sentiment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.magnitude != null && Object.hasOwnProperty.call(message, "magnitude")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.magnitude); + if (message.score != null && Object.hasOwnProperty.call(message, "score")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.score); + return writer; + }; /** - * Number enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Number - * @enum {number} - * @property {number} NUMBER_UNKNOWN=0 NUMBER_UNKNOWN value - * @property {number} SINGULAR=1 SINGULAR value - * @property {number} PLURAL=2 PLURAL value - * @property {number} DUAL=3 DUAL value - */ - PartOfSpeech.Number = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NUMBER_UNKNOWN"] = 0; - values[valuesById[1] = "SINGULAR"] = 1; - values[valuesById[2] = "PLURAL"] = 2; - values[valuesById[3] = "DUAL"] = 3; - return values; - })(); - - /** - * Person enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Person - * @enum {number} - * @property {number} PERSON_UNKNOWN=0 PERSON_UNKNOWN value - * @property {number} FIRST=1 FIRST value - * @property {number} SECOND=2 SECOND value - * @property {number} THIRD=3 THIRD value - * @property {number} REFLEXIVE_PERSON=4 REFLEXIVE_PERSON value - */ - PartOfSpeech.Person = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "PERSON_UNKNOWN"] = 0; - values[valuesById[1] = "FIRST"] = 1; - values[valuesById[2] = "SECOND"] = 2; - values[valuesById[3] = "THIRD"] = 3; - values[valuesById[4] = "REFLEXIVE_PERSON"] = 4; - return values; - })(); - - /** - * Proper enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Proper - * @enum {number} - * @property {number} PROPER_UNKNOWN=0 PROPER_UNKNOWN value - * @property {number} PROPER=1 PROPER value - * @property {number} NOT_PROPER=2 NOT_PROPER value - */ - PartOfSpeech.Proper = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "PROPER_UNKNOWN"] = 0; - values[valuesById[1] = "PROPER"] = 1; - values[valuesById[2] = "NOT_PROPER"] = 2; - return values; - })(); - - /** - * Reciprocity enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Reciprocity - * @enum {number} - * @property {number} RECIPROCITY_UNKNOWN=0 RECIPROCITY_UNKNOWN value - * @property {number} RECIPROCAL=1 RECIPROCAL value - * @property {number} NON_RECIPROCAL=2 NON_RECIPROCAL value - */ - PartOfSpeech.Reciprocity = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RECIPROCITY_UNKNOWN"] = 0; - values[valuesById[1] = "RECIPROCAL"] = 1; - values[valuesById[2] = "NON_RECIPROCAL"] = 2; - return values; - })(); - - /** - * Tense enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Tense - * @enum {number} - * @property {number} TENSE_UNKNOWN=0 TENSE_UNKNOWN value - * @property {number} CONDITIONAL_TENSE=1 CONDITIONAL_TENSE value - * @property {number} FUTURE=2 FUTURE value - * @property {number} PAST=3 PAST value - * @property {number} PRESENT=4 PRESENT value - * @property {number} IMPERFECT=5 IMPERFECT value - * @property {number} PLUPERFECT=6 PLUPERFECT value - */ - PartOfSpeech.Tense = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TENSE_UNKNOWN"] = 0; - values[valuesById[1] = "CONDITIONAL_TENSE"] = 1; - values[valuesById[2] = "FUTURE"] = 2; - values[valuesById[3] = "PAST"] = 3; - values[valuesById[4] = "PRESENT"] = 4; - values[valuesById[5] = "IMPERFECT"] = 5; - values[valuesById[6] = "PLUPERFECT"] = 6; - return values; - })(); - - /** - * Voice enum. - * @name google.cloud.language.v1beta2.PartOfSpeech.Voice - * @enum {number} - * @property {number} VOICE_UNKNOWN=0 VOICE_UNKNOWN value - * @property {number} ACTIVE=1 ACTIVE value - * @property {number} CAUSATIVE=2 CAUSATIVE value - * @property {number} PASSIVE=3 PASSIVE value - */ - PartOfSpeech.Voice = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "VOICE_UNKNOWN"] = 0; - values[valuesById[1] = "ACTIVE"] = 1; - values[valuesById[2] = "CAUSATIVE"] = 2; - values[valuesById[3] = "PASSIVE"] = 3; - return values; - })(); - - return PartOfSpeech; - })(); - - v1beta2.DependencyEdge = (function() { - - /** - * Properties of a DependencyEdge. - * @memberof google.cloud.language.v1beta2 - * @interface IDependencyEdge - * @property {number|null} [headTokenIndex] DependencyEdge headTokenIndex - * @property {google.cloud.language.v1beta2.DependencyEdge.Label|null} [label] DependencyEdge label - */ - - /** - * Constructs a new DependencyEdge. - * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a DependencyEdge. - * @implements IDependencyEdge - * @constructor - * @param {google.cloud.language.v1beta2.IDependencyEdge=} [properties] Properties to set - */ - function DependencyEdge(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DependencyEdge headTokenIndex. - * @member {number} headTokenIndex - * @memberof google.cloud.language.v1beta2.DependencyEdge - * @instance - */ - DependencyEdge.prototype.headTokenIndex = 0; - - /** - * DependencyEdge label. - * @member {google.cloud.language.v1beta2.DependencyEdge.Label} label - * @memberof google.cloud.language.v1beta2.DependencyEdge - * @instance - */ - DependencyEdge.prototype.label = 0; - - /** - * Creates a new DependencyEdge instance using the specified properties. - * @function create - * @memberof google.cloud.language.v1beta2.DependencyEdge - * @static - * @param {google.cloud.language.v1beta2.IDependencyEdge=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge instance - */ - DependencyEdge.create = function create(properties) { - return new DependencyEdge(properties); - }; - - /** - * Encodes the specified DependencyEdge message. Does not implicitly {@link google.cloud.language.v1beta2.DependencyEdge.verify|verify} messages. - * @function encode - * @memberof google.cloud.language.v1beta2.DependencyEdge - * @static - * @param {google.cloud.language.v1beta2.IDependencyEdge} message DependencyEdge message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DependencyEdge.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.headTokenIndex != null && Object.hasOwnProperty.call(message, "headTokenIndex")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.headTokenIndex); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.label); - return writer; - }; - - /** - * Encodes the specified DependencyEdge message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.DependencyEdge.verify|verify} messages. + * Encodes the specified Sentiment message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.Sentiment.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.Sentiment * @static - * @param {google.cloud.language.v1beta2.IDependencyEdge} message DependencyEdge message or plain object to encode + * @param {google.cloud.language.v1beta2.ISentiment} message Sentiment message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DependencyEdge.encodeDelimited = function encodeDelimited(message, writer) { + Sentiment.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DependencyEdge message from the specified reader or buffer. + * Decodes a Sentiment message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.Sentiment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge + * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DependencyEdge.decode = function decode(reader, length) { + Sentiment.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.DependencyEdge(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.Sentiment(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: { - message.headTokenIndex = reader.int32(); + case 2: { + message.magnitude = reader.float(); break; } - case 2: { - message.label = reader.int32(); + case 3: { + message.score = reader.float(); break; } default: @@ -11290,321 +10687,1735 @@ }; /** - * Decodes a DependencyEdge message from the specified reader or buffer, length delimited. + * Decodes a Sentiment message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.Sentiment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge + * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DependencyEdge.decodeDelimited = function decodeDelimited(reader) { + Sentiment.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DependencyEdge message. + * Verifies a Sentiment message. * @function verify - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.Sentiment * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DependencyEdge.verify = function verify(message) { + Sentiment.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.headTokenIndex != null && message.hasOwnProperty("headTokenIndex")) - if (!$util.isInteger(message.headTokenIndex)) - return "headTokenIndex: integer expected"; - if (message.label != null && message.hasOwnProperty("label")) - switch (message.label) { - default: - return "label: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - case 59: - case 60: - case 61: - case 62: - case 63: - case 64: - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - break; - } + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + if (typeof message.magnitude !== "number") + return "magnitude: number expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; return null; }; /** - * Creates a DependencyEdge message from a plain object. Also converts values to their respective internal types. + * Creates a Sentiment message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.Sentiment * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge + * @returns {google.cloud.language.v1beta2.Sentiment} Sentiment */ - DependencyEdge.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.DependencyEdge) + Sentiment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.Sentiment) return object; - var message = new $root.google.cloud.language.v1beta2.DependencyEdge(); - if (object.headTokenIndex != null) - message.headTokenIndex = object.headTokenIndex | 0; - switch (object.label) { - case "UNKNOWN": - case 0: - message.label = 0; - break; - case "ABBREV": - case 1: - message.label = 1; - break; - case "ACOMP": - case 2: - message.label = 2; - break; - case "ADVCL": - case 3: - message.label = 3; - break; - case "ADVMOD": - case 4: - message.label = 4; - break; - case "AMOD": - case 5: - message.label = 5; - break; - case "APPOS": - case 6: - message.label = 6; - break; - case "ATTR": - case 7: - message.label = 7; - break; - case "AUX": - case 8: - message.label = 8; - break; - case "AUXPASS": - case 9: - message.label = 9; - break; - case "CC": - case 10: - message.label = 10; - break; - case "CCOMP": - case 11: - message.label = 11; - break; - case "CONJ": - case 12: - message.label = 12; - break; - case "CSUBJ": - case 13: - message.label = 13; - break; - case "CSUBJPASS": - case 14: - message.label = 14; - break; - case "DEP": - case 15: - message.label = 15; - break; - case "DET": - case 16: - message.label = 16; - break; - case "DISCOURSE": - case 17: - message.label = 17; - break; - case "DOBJ": - case 18: - message.label = 18; - break; - case "EXPL": - case 19: - message.label = 19; - break; - case "GOESWITH": - case 20: - message.label = 20; - break; - case "IOBJ": - case 21: - message.label = 21; - break; - case "MARK": - case 22: - message.label = 22; - break; - case "MWE": - case 23: - message.label = 23; - break; - case "MWV": - case 24: - message.label = 24; - break; - case "NEG": - case 25: - message.label = 25; - break; - case "NN": - case 26: - message.label = 26; - break; - case "NPADVMOD": - case 27: - message.label = 27; - break; - case "NSUBJ": - case 28: - message.label = 28; - break; - case "NSUBJPASS": - case 29: - message.label = 29; - break; - case "NUM": - case 30: - message.label = 30; - break; - case "NUMBER": - case 31: - message.label = 31; - break; - case "P": - case 32: - message.label = 32; - break; - case "PARATAXIS": - case 33: - message.label = 33; - break; - case "PARTMOD": - case 34: - message.label = 34; - break; - case "PCOMP": - case 35: - message.label = 35; - break; - case "POBJ": - case 36: - message.label = 36; - break; - case "POSS": - case 37: - message.label = 37; - break; - case "POSTNEG": - case 38: - message.label = 38; - break; - case "PRECOMP": - case 39: - message.label = 39; - break; - case "PRECONJ": - case 40: - message.label = 40; - break; - case "PREDET": - case 41: - message.label = 41; - break; - case "PREF": - case 42: - message.label = 42; - break; - case "PREP": - case 43: - message.label = 43; - break; - case "PRONL": - case 44: - message.label = 44; + var message = new $root.google.cloud.language.v1beta2.Sentiment(); + if (object.magnitude != null) + message.magnitude = Number(object.magnitude); + if (object.score != null) + message.score = Number(object.score); + return message; + }; + + /** + * Creates a plain object from a Sentiment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1beta2.Sentiment + * @static + * @param {google.cloud.language.v1beta2.Sentiment} message Sentiment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Sentiment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.magnitude = 0; + object.score = 0; + } + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + object.magnitude = options.json && !isFinite(message.magnitude) ? String(message.magnitude) : message.magnitude; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + return object; + }; + + /** + * Converts this Sentiment to JSON. + * @function toJSON + * @memberof google.cloud.language.v1beta2.Sentiment + * @instance + * @returns {Object.} JSON object + */ + Sentiment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Sentiment + * @function getTypeUrl + * @memberof google.cloud.language.v1beta2.Sentiment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Sentiment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1beta2.Sentiment"; + }; + + return Sentiment; + })(); + + v1beta2.PartOfSpeech = (function() { + + /** + * Properties of a PartOfSpeech. + * @memberof google.cloud.language.v1beta2 + * @interface IPartOfSpeech + * @property {google.cloud.language.v1beta2.PartOfSpeech.Tag|null} [tag] PartOfSpeech tag + * @property {google.cloud.language.v1beta2.PartOfSpeech.Aspect|null} [aspect] PartOfSpeech aspect + * @property {google.cloud.language.v1beta2.PartOfSpeech.Case|null} ["case"] PartOfSpeech case + * @property {google.cloud.language.v1beta2.PartOfSpeech.Form|null} [form] PartOfSpeech form + * @property {google.cloud.language.v1beta2.PartOfSpeech.Gender|null} [gender] PartOfSpeech gender + * @property {google.cloud.language.v1beta2.PartOfSpeech.Mood|null} [mood] PartOfSpeech mood + * @property {google.cloud.language.v1beta2.PartOfSpeech.Number|null} [number] PartOfSpeech number + * @property {google.cloud.language.v1beta2.PartOfSpeech.Person|null} [person] PartOfSpeech person + * @property {google.cloud.language.v1beta2.PartOfSpeech.Proper|null} [proper] PartOfSpeech proper + * @property {google.cloud.language.v1beta2.PartOfSpeech.Reciprocity|null} [reciprocity] PartOfSpeech reciprocity + * @property {google.cloud.language.v1beta2.PartOfSpeech.Tense|null} [tense] PartOfSpeech tense + * @property {google.cloud.language.v1beta2.PartOfSpeech.Voice|null} [voice] PartOfSpeech voice + */ + + /** + * Constructs a new PartOfSpeech. + * @memberof google.cloud.language.v1beta2 + * @classdesc Represents a PartOfSpeech. + * @implements IPartOfSpeech + * @constructor + * @param {google.cloud.language.v1beta2.IPartOfSpeech=} [properties] Properties to set + */ + function PartOfSpeech(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PartOfSpeech tag. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Tag} tag + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.tag = 0; + + /** + * PartOfSpeech aspect. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Aspect} aspect + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.aspect = 0; + + /** + * PartOfSpeech case. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Case} case + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype["case"] = 0; + + /** + * PartOfSpeech form. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Form} form + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.form = 0; + + /** + * PartOfSpeech gender. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Gender} gender + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.gender = 0; + + /** + * PartOfSpeech mood. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Mood} mood + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.mood = 0; + + /** + * PartOfSpeech number. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Number} number + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.number = 0; + + /** + * PartOfSpeech person. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Person} person + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.person = 0; + + /** + * PartOfSpeech proper. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Proper} proper + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.proper = 0; + + /** + * PartOfSpeech reciprocity. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Reciprocity} reciprocity + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.reciprocity = 0; + + /** + * PartOfSpeech tense. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Tense} tense + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.tense = 0; + + /** + * PartOfSpeech voice. + * @member {google.cloud.language.v1beta2.PartOfSpeech.Voice} voice + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + */ + PartOfSpeech.prototype.voice = 0; + + /** + * Creates a new PartOfSpeech instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {google.cloud.language.v1beta2.IPartOfSpeech=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech instance + */ + PartOfSpeech.create = function create(properties) { + return new PartOfSpeech(properties); + }; + + /** + * Encodes the specified PartOfSpeech message. Does not implicitly {@link google.cloud.language.v1beta2.PartOfSpeech.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {google.cloud.language.v1beta2.IPartOfSpeech} message PartOfSpeech message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartOfSpeech.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tag != null && Object.hasOwnProperty.call(message, "tag")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.tag); + if (message.aspect != null && Object.hasOwnProperty.call(message, "aspect")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.aspect); + if (message["case"] != null && Object.hasOwnProperty.call(message, "case")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message["case"]); + if (message.form != null && Object.hasOwnProperty.call(message, "form")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.form); + if (message.gender != null && Object.hasOwnProperty.call(message, "gender")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.gender); + if (message.mood != null && Object.hasOwnProperty.call(message, "mood")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.mood); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.number); + if (message.person != null && Object.hasOwnProperty.call(message, "person")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.person); + if (message.proper != null && Object.hasOwnProperty.call(message, "proper")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.proper); + if (message.reciprocity != null && Object.hasOwnProperty.call(message, "reciprocity")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.reciprocity); + if (message.tense != null && Object.hasOwnProperty.call(message, "tense")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.tense); + if (message.voice != null && Object.hasOwnProperty.call(message, "voice")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.voice); + return writer; + }; + + /** + * Encodes the specified PartOfSpeech message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.PartOfSpeech.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {google.cloud.language.v1beta2.IPartOfSpeech} message PartOfSpeech message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartOfSpeech.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PartOfSpeech message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartOfSpeech.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.PartOfSpeech(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.tag = reader.int32(); + break; + } + case 2: { + message.aspect = reader.int32(); + break; + } + case 3: { + message["case"] = reader.int32(); + break; + } + case 4: { + message.form = reader.int32(); + break; + } + case 5: { + message.gender = reader.int32(); + break; + } + case 6: { + message.mood = reader.int32(); + break; + } + case 7: { + message.number = reader.int32(); + break; + } + case 8: { + message.person = reader.int32(); + break; + } + case 9: { + message.proper = reader.int32(); + break; + } + case 10: { + message.reciprocity = reader.int32(); + break; + } + case 11: { + message.tense = reader.int32(); + break; + } + case 12: { + message.voice = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PartOfSpeech message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartOfSpeech.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PartOfSpeech message. + * @function verify + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PartOfSpeech.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tag != null && message.hasOwnProperty("tag")) + switch (message.tag) { + default: + return "tag: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + break; + } + if (message.aspect != null && message.hasOwnProperty("aspect")) + switch (message.aspect) { + default: + return "aspect: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message["case"] != null && message.hasOwnProperty("case")) + switch (message["case"]) { + default: + return "case: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + break; + } + if (message.form != null && message.hasOwnProperty("form")) + switch (message.form) { + default: + return "form: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + break; + } + if (message.gender != null && message.hasOwnProperty("gender")) + switch (message.gender) { + default: + return "gender: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.mood != null && message.hasOwnProperty("mood")) + switch (message.mood) { + default: + return "mood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.number != null && message.hasOwnProperty("number")) + switch (message.number) { + default: + return "number: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.person != null && message.hasOwnProperty("person")) + switch (message.person) { + default: + return "person: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.proper != null && message.hasOwnProperty("proper")) + switch (message.proper) { + default: + return "proper: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.reciprocity != null && message.hasOwnProperty("reciprocity")) + switch (message.reciprocity) { + default: + return "reciprocity: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.tense != null && message.hasOwnProperty("tense")) + switch (message.tense) { + default: + return "tense: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.voice != null && message.hasOwnProperty("voice")) + switch (message.voice) { + default: + return "voice: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a PartOfSpeech message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1beta2.PartOfSpeech} PartOfSpeech + */ + PartOfSpeech.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.PartOfSpeech) + return object; + var message = new $root.google.cloud.language.v1beta2.PartOfSpeech(); + switch (object.tag) { + case "UNKNOWN": + case 0: + message.tag = 0; + break; + case "ADJ": + case 1: + message.tag = 1; + break; + case "ADP": + case 2: + message.tag = 2; + break; + case "ADV": + case 3: + message.tag = 3; + break; + case "CONJ": + case 4: + message.tag = 4; + break; + case "DET": + case 5: + message.tag = 5; + break; + case "NOUN": + case 6: + message.tag = 6; + break; + case "NUM": + case 7: + message.tag = 7; + break; + case "PRON": + case 8: + message.tag = 8; + break; + case "PRT": + case 9: + message.tag = 9; + break; + case "PUNCT": + case 10: + message.tag = 10; + break; + case "VERB": + case 11: + message.tag = 11; + break; + case "X": + case 12: + message.tag = 12; + break; + case "AFFIX": + case 13: + message.tag = 13; + break; + } + switch (object.aspect) { + case "ASPECT_UNKNOWN": + case 0: + message.aspect = 0; + break; + case "PERFECTIVE": + case 1: + message.aspect = 1; + break; + case "IMPERFECTIVE": + case 2: + message.aspect = 2; + break; + case "PROGRESSIVE": + case 3: + message.aspect = 3; + break; + } + switch (object["case"]) { + case "CASE_UNKNOWN": + case 0: + message["case"] = 0; + break; + case "ACCUSATIVE": + case 1: + message["case"] = 1; + break; + case "ADVERBIAL": + case 2: + message["case"] = 2; + break; + case "COMPLEMENTIVE": + case 3: + message["case"] = 3; + break; + case "DATIVE": + case 4: + message["case"] = 4; + break; + case "GENITIVE": + case 5: + message["case"] = 5; + break; + case "INSTRUMENTAL": + case 6: + message["case"] = 6; + break; + case "LOCATIVE": + case 7: + message["case"] = 7; + break; + case "NOMINATIVE": + case 8: + message["case"] = 8; + break; + case "OBLIQUE": + case 9: + message["case"] = 9; + break; + case "PARTITIVE": + case 10: + message["case"] = 10; + break; + case "PREPOSITIONAL": + case 11: + message["case"] = 11; + break; + case "REFLEXIVE_CASE": + case 12: + message["case"] = 12; + break; + case "RELATIVE_CASE": + case 13: + message["case"] = 13; + break; + case "VOCATIVE": + case 14: + message["case"] = 14; + break; + } + switch (object.form) { + case "FORM_UNKNOWN": + case 0: + message.form = 0; + break; + case "ADNOMIAL": + case 1: + message.form = 1; + break; + case "AUXILIARY": + case 2: + message.form = 2; + break; + case "COMPLEMENTIZER": + case 3: + message.form = 3; + break; + case "FINAL_ENDING": + case 4: + message.form = 4; + break; + case "GERUND": + case 5: + message.form = 5; + break; + case "REALIS": + case 6: + message.form = 6; + break; + case "IRREALIS": + case 7: + message.form = 7; + break; + case "SHORT": + case 8: + message.form = 8; + break; + case "LONG": + case 9: + message.form = 9; + break; + case "ORDER": + case 10: + message.form = 10; + break; + case "SPECIFIC": + case 11: + message.form = 11; + break; + } + switch (object.gender) { + case "GENDER_UNKNOWN": + case 0: + message.gender = 0; + break; + case "FEMININE": + case 1: + message.gender = 1; + break; + case "MASCULINE": + case 2: + message.gender = 2; + break; + case "NEUTER": + case 3: + message.gender = 3; + break; + } + switch (object.mood) { + case "MOOD_UNKNOWN": + case 0: + message.mood = 0; + break; + case "CONDITIONAL_MOOD": + case 1: + message.mood = 1; + break; + case "IMPERATIVE": + case 2: + message.mood = 2; + break; + case "INDICATIVE": + case 3: + message.mood = 3; + break; + case "INTERROGATIVE": + case 4: + message.mood = 4; + break; + case "JUSSIVE": + case 5: + message.mood = 5; + break; + case "SUBJUNCTIVE": + case 6: + message.mood = 6; + break; + } + switch (object.number) { + case "NUMBER_UNKNOWN": + case 0: + message.number = 0; + break; + case "SINGULAR": + case 1: + message.number = 1; + break; + case "PLURAL": + case 2: + message.number = 2; + break; + case "DUAL": + case 3: + message.number = 3; + break; + } + switch (object.person) { + case "PERSON_UNKNOWN": + case 0: + message.person = 0; + break; + case "FIRST": + case 1: + message.person = 1; + break; + case "SECOND": + case 2: + message.person = 2; + break; + case "THIRD": + case 3: + message.person = 3; + break; + case "REFLEXIVE_PERSON": + case 4: + message.person = 4; + break; + } + switch (object.proper) { + case "PROPER_UNKNOWN": + case 0: + message.proper = 0; + break; + case "PROPER": + case 1: + message.proper = 1; + break; + case "NOT_PROPER": + case 2: + message.proper = 2; + break; + } + switch (object.reciprocity) { + case "RECIPROCITY_UNKNOWN": + case 0: + message.reciprocity = 0; + break; + case "RECIPROCAL": + case 1: + message.reciprocity = 1; + break; + case "NON_RECIPROCAL": + case 2: + message.reciprocity = 2; + break; + } + switch (object.tense) { + case "TENSE_UNKNOWN": + case 0: + message.tense = 0; + break; + case "CONDITIONAL_TENSE": + case 1: + message.tense = 1; + break; + case "FUTURE": + case 2: + message.tense = 2; + break; + case "PAST": + case 3: + message.tense = 3; + break; + case "PRESENT": + case 4: + message.tense = 4; + break; + case "IMPERFECT": + case 5: + message.tense = 5; + break; + case "PLUPERFECT": + case 6: + message.tense = 6; + break; + } + switch (object.voice) { + case "VOICE_UNKNOWN": + case 0: + message.voice = 0; + break; + case "ACTIVE": + case 1: + message.voice = 1; + break; + case "CAUSATIVE": + case 2: + message.voice = 2; + break; + case "PASSIVE": + case 3: + message.voice = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a PartOfSpeech message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {google.cloud.language.v1beta2.PartOfSpeech} message PartOfSpeech + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PartOfSpeech.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.tag = options.enums === String ? "UNKNOWN" : 0; + object.aspect = options.enums === String ? "ASPECT_UNKNOWN" : 0; + object["case"] = options.enums === String ? "CASE_UNKNOWN" : 0; + object.form = options.enums === String ? "FORM_UNKNOWN" : 0; + object.gender = options.enums === String ? "GENDER_UNKNOWN" : 0; + object.mood = options.enums === String ? "MOOD_UNKNOWN" : 0; + object.number = options.enums === String ? "NUMBER_UNKNOWN" : 0; + object.person = options.enums === String ? "PERSON_UNKNOWN" : 0; + object.proper = options.enums === String ? "PROPER_UNKNOWN" : 0; + object.reciprocity = options.enums === String ? "RECIPROCITY_UNKNOWN" : 0; + object.tense = options.enums === String ? "TENSE_UNKNOWN" : 0; + object.voice = options.enums === String ? "VOICE_UNKNOWN" : 0; + } + if (message.tag != null && message.hasOwnProperty("tag")) + object.tag = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Tag[message.tag] : message.tag; + if (message.aspect != null && message.hasOwnProperty("aspect")) + object.aspect = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Aspect[message.aspect] : message.aspect; + if (message["case"] != null && message.hasOwnProperty("case")) + object["case"] = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Case[message["case"]] : message["case"]; + if (message.form != null && message.hasOwnProperty("form")) + object.form = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Form[message.form] : message.form; + if (message.gender != null && message.hasOwnProperty("gender")) + object.gender = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Gender[message.gender] : message.gender; + if (message.mood != null && message.hasOwnProperty("mood")) + object.mood = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Mood[message.mood] : message.mood; + if (message.number != null && message.hasOwnProperty("number")) + object.number = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Number[message.number] : message.number; + if (message.person != null && message.hasOwnProperty("person")) + object.person = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Person[message.person] : message.person; + if (message.proper != null && message.hasOwnProperty("proper")) + object.proper = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Proper[message.proper] : message.proper; + if (message.reciprocity != null && message.hasOwnProperty("reciprocity")) + object.reciprocity = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Reciprocity[message.reciprocity] : message.reciprocity; + if (message.tense != null && message.hasOwnProperty("tense")) + object.tense = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Tense[message.tense] : message.tense; + if (message.voice != null && message.hasOwnProperty("voice")) + object.voice = options.enums === String ? $root.google.cloud.language.v1beta2.PartOfSpeech.Voice[message.voice] : message.voice; + return object; + }; + + /** + * Converts this PartOfSpeech to JSON. + * @function toJSON + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @instance + * @returns {Object.} JSON object + */ + PartOfSpeech.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PartOfSpeech + * @function getTypeUrl + * @memberof google.cloud.language.v1beta2.PartOfSpeech + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PartOfSpeech.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1beta2.PartOfSpeech"; + }; + + /** + * Tag enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Tag + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} ADJ=1 ADJ value + * @property {number} ADP=2 ADP value + * @property {number} ADV=3 ADV value + * @property {number} CONJ=4 CONJ value + * @property {number} DET=5 DET value + * @property {number} NOUN=6 NOUN value + * @property {number} NUM=7 NUM value + * @property {number} PRON=8 PRON value + * @property {number} PRT=9 PRT value + * @property {number} PUNCT=10 PUNCT value + * @property {number} VERB=11 VERB value + * @property {number} X=12 X value + * @property {number} AFFIX=13 AFFIX value + */ + PartOfSpeech.Tag = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "ADJ"] = 1; + values[valuesById[2] = "ADP"] = 2; + values[valuesById[3] = "ADV"] = 3; + values[valuesById[4] = "CONJ"] = 4; + values[valuesById[5] = "DET"] = 5; + values[valuesById[6] = "NOUN"] = 6; + values[valuesById[7] = "NUM"] = 7; + values[valuesById[8] = "PRON"] = 8; + values[valuesById[9] = "PRT"] = 9; + values[valuesById[10] = "PUNCT"] = 10; + values[valuesById[11] = "VERB"] = 11; + values[valuesById[12] = "X"] = 12; + values[valuesById[13] = "AFFIX"] = 13; + return values; + })(); + + /** + * Aspect enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Aspect + * @enum {number} + * @property {number} ASPECT_UNKNOWN=0 ASPECT_UNKNOWN value + * @property {number} PERFECTIVE=1 PERFECTIVE value + * @property {number} IMPERFECTIVE=2 IMPERFECTIVE value + * @property {number} PROGRESSIVE=3 PROGRESSIVE value + */ + PartOfSpeech.Aspect = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ASPECT_UNKNOWN"] = 0; + values[valuesById[1] = "PERFECTIVE"] = 1; + values[valuesById[2] = "IMPERFECTIVE"] = 2; + values[valuesById[3] = "PROGRESSIVE"] = 3; + return values; + })(); + + /** + * Case enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Case + * @enum {number} + * @property {number} CASE_UNKNOWN=0 CASE_UNKNOWN value + * @property {number} ACCUSATIVE=1 ACCUSATIVE value + * @property {number} ADVERBIAL=2 ADVERBIAL value + * @property {number} COMPLEMENTIVE=3 COMPLEMENTIVE value + * @property {number} DATIVE=4 DATIVE value + * @property {number} GENITIVE=5 GENITIVE value + * @property {number} INSTRUMENTAL=6 INSTRUMENTAL value + * @property {number} LOCATIVE=7 LOCATIVE value + * @property {number} NOMINATIVE=8 NOMINATIVE value + * @property {number} OBLIQUE=9 OBLIQUE value + * @property {number} PARTITIVE=10 PARTITIVE value + * @property {number} PREPOSITIONAL=11 PREPOSITIONAL value + * @property {number} REFLEXIVE_CASE=12 REFLEXIVE_CASE value + * @property {number} RELATIVE_CASE=13 RELATIVE_CASE value + * @property {number} VOCATIVE=14 VOCATIVE value + */ + PartOfSpeech.Case = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CASE_UNKNOWN"] = 0; + values[valuesById[1] = "ACCUSATIVE"] = 1; + values[valuesById[2] = "ADVERBIAL"] = 2; + values[valuesById[3] = "COMPLEMENTIVE"] = 3; + values[valuesById[4] = "DATIVE"] = 4; + values[valuesById[5] = "GENITIVE"] = 5; + values[valuesById[6] = "INSTRUMENTAL"] = 6; + values[valuesById[7] = "LOCATIVE"] = 7; + values[valuesById[8] = "NOMINATIVE"] = 8; + values[valuesById[9] = "OBLIQUE"] = 9; + values[valuesById[10] = "PARTITIVE"] = 10; + values[valuesById[11] = "PREPOSITIONAL"] = 11; + values[valuesById[12] = "REFLEXIVE_CASE"] = 12; + values[valuesById[13] = "RELATIVE_CASE"] = 13; + values[valuesById[14] = "VOCATIVE"] = 14; + return values; + })(); + + /** + * Form enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Form + * @enum {number} + * @property {number} FORM_UNKNOWN=0 FORM_UNKNOWN value + * @property {number} ADNOMIAL=1 ADNOMIAL value + * @property {number} AUXILIARY=2 AUXILIARY value + * @property {number} COMPLEMENTIZER=3 COMPLEMENTIZER value + * @property {number} FINAL_ENDING=4 FINAL_ENDING value + * @property {number} GERUND=5 GERUND value + * @property {number} REALIS=6 REALIS value + * @property {number} IRREALIS=7 IRREALIS value + * @property {number} SHORT=8 SHORT value + * @property {number} LONG=9 LONG value + * @property {number} ORDER=10 ORDER value + * @property {number} SPECIFIC=11 SPECIFIC value + */ + PartOfSpeech.Form = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FORM_UNKNOWN"] = 0; + values[valuesById[1] = "ADNOMIAL"] = 1; + values[valuesById[2] = "AUXILIARY"] = 2; + values[valuesById[3] = "COMPLEMENTIZER"] = 3; + values[valuesById[4] = "FINAL_ENDING"] = 4; + values[valuesById[5] = "GERUND"] = 5; + values[valuesById[6] = "REALIS"] = 6; + values[valuesById[7] = "IRREALIS"] = 7; + values[valuesById[8] = "SHORT"] = 8; + values[valuesById[9] = "LONG"] = 9; + values[valuesById[10] = "ORDER"] = 10; + values[valuesById[11] = "SPECIFIC"] = 11; + return values; + })(); + + /** + * Gender enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Gender + * @enum {number} + * @property {number} GENDER_UNKNOWN=0 GENDER_UNKNOWN value + * @property {number} FEMININE=1 FEMININE value + * @property {number} MASCULINE=2 MASCULINE value + * @property {number} NEUTER=3 NEUTER value + */ + PartOfSpeech.Gender = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "GENDER_UNKNOWN"] = 0; + values[valuesById[1] = "FEMININE"] = 1; + values[valuesById[2] = "MASCULINE"] = 2; + values[valuesById[3] = "NEUTER"] = 3; + return values; + })(); + + /** + * Mood enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Mood + * @enum {number} + * @property {number} MOOD_UNKNOWN=0 MOOD_UNKNOWN value + * @property {number} CONDITIONAL_MOOD=1 CONDITIONAL_MOOD value + * @property {number} IMPERATIVE=2 IMPERATIVE value + * @property {number} INDICATIVE=3 INDICATIVE value + * @property {number} INTERROGATIVE=4 INTERROGATIVE value + * @property {number} JUSSIVE=5 JUSSIVE value + * @property {number} SUBJUNCTIVE=6 SUBJUNCTIVE value + */ + PartOfSpeech.Mood = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MOOD_UNKNOWN"] = 0; + values[valuesById[1] = "CONDITIONAL_MOOD"] = 1; + values[valuesById[2] = "IMPERATIVE"] = 2; + values[valuesById[3] = "INDICATIVE"] = 3; + values[valuesById[4] = "INTERROGATIVE"] = 4; + values[valuesById[5] = "JUSSIVE"] = 5; + values[valuesById[6] = "SUBJUNCTIVE"] = 6; + return values; + })(); + + /** + * Number enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Number + * @enum {number} + * @property {number} NUMBER_UNKNOWN=0 NUMBER_UNKNOWN value + * @property {number} SINGULAR=1 SINGULAR value + * @property {number} PLURAL=2 PLURAL value + * @property {number} DUAL=3 DUAL value + */ + PartOfSpeech.Number = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NUMBER_UNKNOWN"] = 0; + values[valuesById[1] = "SINGULAR"] = 1; + values[valuesById[2] = "PLURAL"] = 2; + values[valuesById[3] = "DUAL"] = 3; + return values; + })(); + + /** + * Person enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Person + * @enum {number} + * @property {number} PERSON_UNKNOWN=0 PERSON_UNKNOWN value + * @property {number} FIRST=1 FIRST value + * @property {number} SECOND=2 SECOND value + * @property {number} THIRD=3 THIRD value + * @property {number} REFLEXIVE_PERSON=4 REFLEXIVE_PERSON value + */ + PartOfSpeech.Person = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PERSON_UNKNOWN"] = 0; + values[valuesById[1] = "FIRST"] = 1; + values[valuesById[2] = "SECOND"] = 2; + values[valuesById[3] = "THIRD"] = 3; + values[valuesById[4] = "REFLEXIVE_PERSON"] = 4; + return values; + })(); + + /** + * Proper enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Proper + * @enum {number} + * @property {number} PROPER_UNKNOWN=0 PROPER_UNKNOWN value + * @property {number} PROPER=1 PROPER value + * @property {number} NOT_PROPER=2 NOT_PROPER value + */ + PartOfSpeech.Proper = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PROPER_UNKNOWN"] = 0; + values[valuesById[1] = "PROPER"] = 1; + values[valuesById[2] = "NOT_PROPER"] = 2; + return values; + })(); + + /** + * Reciprocity enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Reciprocity + * @enum {number} + * @property {number} RECIPROCITY_UNKNOWN=0 RECIPROCITY_UNKNOWN value + * @property {number} RECIPROCAL=1 RECIPROCAL value + * @property {number} NON_RECIPROCAL=2 NON_RECIPROCAL value + */ + PartOfSpeech.Reciprocity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECIPROCITY_UNKNOWN"] = 0; + values[valuesById[1] = "RECIPROCAL"] = 1; + values[valuesById[2] = "NON_RECIPROCAL"] = 2; + return values; + })(); + + /** + * Tense enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Tense + * @enum {number} + * @property {number} TENSE_UNKNOWN=0 TENSE_UNKNOWN value + * @property {number} CONDITIONAL_TENSE=1 CONDITIONAL_TENSE value + * @property {number} FUTURE=2 FUTURE value + * @property {number} PAST=3 PAST value + * @property {number} PRESENT=4 PRESENT value + * @property {number} IMPERFECT=5 IMPERFECT value + * @property {number} PLUPERFECT=6 PLUPERFECT value + */ + PartOfSpeech.Tense = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TENSE_UNKNOWN"] = 0; + values[valuesById[1] = "CONDITIONAL_TENSE"] = 1; + values[valuesById[2] = "FUTURE"] = 2; + values[valuesById[3] = "PAST"] = 3; + values[valuesById[4] = "PRESENT"] = 4; + values[valuesById[5] = "IMPERFECT"] = 5; + values[valuesById[6] = "PLUPERFECT"] = 6; + return values; + })(); + + /** + * Voice enum. + * @name google.cloud.language.v1beta2.PartOfSpeech.Voice + * @enum {number} + * @property {number} VOICE_UNKNOWN=0 VOICE_UNKNOWN value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} CAUSATIVE=2 CAUSATIVE value + * @property {number} PASSIVE=3 PASSIVE value + */ + PartOfSpeech.Voice = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VOICE_UNKNOWN"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "CAUSATIVE"] = 2; + values[valuesById[3] = "PASSIVE"] = 3; + return values; + })(); + + return PartOfSpeech; + })(); + + v1beta2.DependencyEdge = (function() { + + /** + * Properties of a DependencyEdge. + * @memberof google.cloud.language.v1beta2 + * @interface IDependencyEdge + * @property {number|null} [headTokenIndex] DependencyEdge headTokenIndex + * @property {google.cloud.language.v1beta2.DependencyEdge.Label|null} [label] DependencyEdge label + */ + + /** + * Constructs a new DependencyEdge. + * @memberof google.cloud.language.v1beta2 + * @classdesc Represents a DependencyEdge. + * @implements IDependencyEdge + * @constructor + * @param {google.cloud.language.v1beta2.IDependencyEdge=} [properties] Properties to set + */ + function DependencyEdge(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DependencyEdge headTokenIndex. + * @member {number} headTokenIndex + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @instance + */ + DependencyEdge.prototype.headTokenIndex = 0; + + /** + * DependencyEdge label. + * @member {google.cloud.language.v1beta2.DependencyEdge.Label} label + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @instance + */ + DependencyEdge.prototype.label = 0; + + /** + * Creates a new DependencyEdge instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {google.cloud.language.v1beta2.IDependencyEdge=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge instance + */ + DependencyEdge.create = function create(properties) { + return new DependencyEdge(properties); + }; + + /** + * Encodes the specified DependencyEdge message. Does not implicitly {@link google.cloud.language.v1beta2.DependencyEdge.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {google.cloud.language.v1beta2.IDependencyEdge} message DependencyEdge message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DependencyEdge.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.headTokenIndex != null && Object.hasOwnProperty.call(message, "headTokenIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.headTokenIndex); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.label); + return writer; + }; + + /** + * Encodes the specified DependencyEdge message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.DependencyEdge.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {google.cloud.language.v1beta2.IDependencyEdge} message DependencyEdge message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DependencyEdge.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DependencyEdge message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DependencyEdge.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.DependencyEdge(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.headTokenIndex = reader.int32(); + break; + } + case 2: { + message.label = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DependencyEdge message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DependencyEdge.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DependencyEdge message. + * @function verify + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DependencyEdge.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.headTokenIndex != null && message.hasOwnProperty("headTokenIndex")) + if (!$util.isInteger(message.headTokenIndex)) + return "headTokenIndex: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + break; + } + return null; + }; + + /** + * Creates a DependencyEdge message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1beta2.DependencyEdge} DependencyEdge + */ + DependencyEdge.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.DependencyEdge) + return object; + var message = new $root.google.cloud.language.v1beta2.DependencyEdge(); + if (object.headTokenIndex != null) + message.headTokenIndex = object.headTokenIndex | 0; + switch (object.label) { + case "UNKNOWN": + case 0: + message.label = 0; + break; + case "ABBREV": + case 1: + message.label = 1; + break; + case "ACOMP": + case 2: + message.label = 2; + break; + case "ADVCL": + case 3: + message.label = 3; + break; + case "ADVMOD": + case 4: + message.label = 4; + break; + case "AMOD": + case 5: + message.label = 5; + break; + case "APPOS": + case 6: + message.label = 6; + break; + case "ATTR": + case 7: + message.label = 7; + break; + case "AUX": + case 8: + message.label = 8; + break; + case "AUXPASS": + case 9: + message.label = 9; + break; + case "CC": + case 10: + message.label = 10; + break; + case "CCOMP": + case 11: + message.label = 11; + break; + case "CONJ": + case 12: + message.label = 12; + break; + case "CSUBJ": + case 13: + message.label = 13; + break; + case "CSUBJPASS": + case 14: + message.label = 14; + break; + case "DEP": + case 15: + message.label = 15; + break; + case "DET": + case 16: + message.label = 16; + break; + case "DISCOURSE": + case 17: + message.label = 17; + break; + case "DOBJ": + case 18: + message.label = 18; + break; + case "EXPL": + case 19: + message.label = 19; + break; + case "GOESWITH": + case 20: + message.label = 20; + break; + case "IOBJ": + case 21: + message.label = 21; + break; + case "MARK": + case 22: + message.label = 22; + break; + case "MWE": + case 23: + message.label = 23; + break; + case "MWV": + case 24: + message.label = 24; + break; + case "NEG": + case 25: + message.label = 25; + break; + case "NN": + case 26: + message.label = 26; + break; + case "NPADVMOD": + case 27: + message.label = 27; + break; + case "NSUBJ": + case 28: + message.label = 28; + break; + case "NSUBJPASS": + case 29: + message.label = 29; + break; + case "NUM": + case 30: + message.label = 30; + break; + case "NUMBER": + case 31: + message.label = 31; + break; + case "P": + case 32: + message.label = 32; + break; + case "PARATAXIS": + case 33: + message.label = 33; + break; + case "PARTMOD": + case 34: + message.label = 34; + break; + case "PCOMP": + case 35: + message.label = 35; + break; + case "POBJ": + case 36: + message.label = 36; + break; + case "POSS": + case 37: + message.label = 37; + break; + case "POSTNEG": + case 38: + message.label = 38; + break; + case "PRECOMP": + case 39: + message.label = 39; + break; + case "PRECONJ": + case 40: + message.label = 40; + break; + case "PREDET": + case 41: + message.label = 41; + break; + case "PREF": + case 42: + message.label = 42; + break; + case "PREP": + case 43: + message.label = 43; + break; + case "PRONL": + case 44: + message.label = 44; break; case "PRT": case 45: @@ -11750,267 +12561,787 @@ case 80: message.label = 80; break; - case "MES": - case 81: - message.label = 81; + case "MES": + case 81: + message.label = 81; + break; + case "NCOMP": + case 82: + message.label = 82; + break; + } + return message; + }; + + /** + * Creates a plain object from a DependencyEdge message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {google.cloud.language.v1beta2.DependencyEdge} message DependencyEdge + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DependencyEdge.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.headTokenIndex = 0; + object.label = options.enums === String ? "UNKNOWN" : 0; + } + if (message.headTokenIndex != null && message.hasOwnProperty("headTokenIndex")) + object.headTokenIndex = message.headTokenIndex; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.cloud.language.v1beta2.DependencyEdge.Label[message.label] : message.label; + return object; + }; + + /** + * Converts this DependencyEdge to JSON. + * @function toJSON + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @instance + * @returns {Object.} JSON object + */ + DependencyEdge.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DependencyEdge + * @function getTypeUrl + * @memberof google.cloud.language.v1beta2.DependencyEdge + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DependencyEdge.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1beta2.DependencyEdge"; + }; + + /** + * Label enum. + * @name google.cloud.language.v1beta2.DependencyEdge.Label + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} ABBREV=1 ABBREV value + * @property {number} ACOMP=2 ACOMP value + * @property {number} ADVCL=3 ADVCL value + * @property {number} ADVMOD=4 ADVMOD value + * @property {number} AMOD=5 AMOD value + * @property {number} APPOS=6 APPOS value + * @property {number} ATTR=7 ATTR value + * @property {number} AUX=8 AUX value + * @property {number} AUXPASS=9 AUXPASS value + * @property {number} CC=10 CC value + * @property {number} CCOMP=11 CCOMP value + * @property {number} CONJ=12 CONJ value + * @property {number} CSUBJ=13 CSUBJ value + * @property {number} CSUBJPASS=14 CSUBJPASS value + * @property {number} DEP=15 DEP value + * @property {number} DET=16 DET value + * @property {number} DISCOURSE=17 DISCOURSE value + * @property {number} DOBJ=18 DOBJ value + * @property {number} EXPL=19 EXPL value + * @property {number} GOESWITH=20 GOESWITH value + * @property {number} IOBJ=21 IOBJ value + * @property {number} MARK=22 MARK value + * @property {number} MWE=23 MWE value + * @property {number} MWV=24 MWV value + * @property {number} NEG=25 NEG value + * @property {number} NN=26 NN value + * @property {number} NPADVMOD=27 NPADVMOD value + * @property {number} NSUBJ=28 NSUBJ value + * @property {number} NSUBJPASS=29 NSUBJPASS value + * @property {number} NUM=30 NUM value + * @property {number} NUMBER=31 NUMBER value + * @property {number} P=32 P value + * @property {number} PARATAXIS=33 PARATAXIS value + * @property {number} PARTMOD=34 PARTMOD value + * @property {number} PCOMP=35 PCOMP value + * @property {number} POBJ=36 POBJ value + * @property {number} POSS=37 POSS value + * @property {number} POSTNEG=38 POSTNEG value + * @property {number} PRECOMP=39 PRECOMP value + * @property {number} PRECONJ=40 PRECONJ value + * @property {number} PREDET=41 PREDET value + * @property {number} PREF=42 PREF value + * @property {number} PREP=43 PREP value + * @property {number} PRONL=44 PRONL value + * @property {number} PRT=45 PRT value + * @property {number} PS=46 PS value + * @property {number} QUANTMOD=47 QUANTMOD value + * @property {number} RCMOD=48 RCMOD value + * @property {number} RCMODREL=49 RCMODREL value + * @property {number} RDROP=50 RDROP value + * @property {number} REF=51 REF value + * @property {number} REMNANT=52 REMNANT value + * @property {number} REPARANDUM=53 REPARANDUM value + * @property {number} ROOT=54 ROOT value + * @property {number} SNUM=55 SNUM value + * @property {number} SUFF=56 SUFF value + * @property {number} TMOD=57 TMOD value + * @property {number} TOPIC=58 TOPIC value + * @property {number} VMOD=59 VMOD value + * @property {number} VOCATIVE=60 VOCATIVE value + * @property {number} XCOMP=61 XCOMP value + * @property {number} SUFFIX=62 SUFFIX value + * @property {number} TITLE=63 TITLE value + * @property {number} ADVPHMOD=64 ADVPHMOD value + * @property {number} AUXCAUS=65 AUXCAUS value + * @property {number} AUXVV=66 AUXVV value + * @property {number} DTMOD=67 DTMOD value + * @property {number} FOREIGN=68 FOREIGN value + * @property {number} KW=69 KW value + * @property {number} LIST=70 LIST value + * @property {number} NOMC=71 NOMC value + * @property {number} NOMCSUBJ=72 NOMCSUBJ value + * @property {number} NOMCSUBJPASS=73 NOMCSUBJPASS value + * @property {number} NUMC=74 NUMC value + * @property {number} COP=75 COP value + * @property {number} DISLOCATED=76 DISLOCATED value + * @property {number} ASP=77 ASP value + * @property {number} GMOD=78 GMOD value + * @property {number} GOBJ=79 GOBJ value + * @property {number} INFMOD=80 INFMOD value + * @property {number} MES=81 MES value + * @property {number} NCOMP=82 NCOMP value + */ + DependencyEdge.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "ABBREV"] = 1; + values[valuesById[2] = "ACOMP"] = 2; + values[valuesById[3] = "ADVCL"] = 3; + values[valuesById[4] = "ADVMOD"] = 4; + values[valuesById[5] = "AMOD"] = 5; + values[valuesById[6] = "APPOS"] = 6; + values[valuesById[7] = "ATTR"] = 7; + values[valuesById[8] = "AUX"] = 8; + values[valuesById[9] = "AUXPASS"] = 9; + values[valuesById[10] = "CC"] = 10; + values[valuesById[11] = "CCOMP"] = 11; + values[valuesById[12] = "CONJ"] = 12; + values[valuesById[13] = "CSUBJ"] = 13; + values[valuesById[14] = "CSUBJPASS"] = 14; + values[valuesById[15] = "DEP"] = 15; + values[valuesById[16] = "DET"] = 16; + values[valuesById[17] = "DISCOURSE"] = 17; + values[valuesById[18] = "DOBJ"] = 18; + values[valuesById[19] = "EXPL"] = 19; + values[valuesById[20] = "GOESWITH"] = 20; + values[valuesById[21] = "IOBJ"] = 21; + values[valuesById[22] = "MARK"] = 22; + values[valuesById[23] = "MWE"] = 23; + values[valuesById[24] = "MWV"] = 24; + values[valuesById[25] = "NEG"] = 25; + values[valuesById[26] = "NN"] = 26; + values[valuesById[27] = "NPADVMOD"] = 27; + values[valuesById[28] = "NSUBJ"] = 28; + values[valuesById[29] = "NSUBJPASS"] = 29; + values[valuesById[30] = "NUM"] = 30; + values[valuesById[31] = "NUMBER"] = 31; + values[valuesById[32] = "P"] = 32; + values[valuesById[33] = "PARATAXIS"] = 33; + values[valuesById[34] = "PARTMOD"] = 34; + values[valuesById[35] = "PCOMP"] = 35; + values[valuesById[36] = "POBJ"] = 36; + values[valuesById[37] = "POSS"] = 37; + values[valuesById[38] = "POSTNEG"] = 38; + values[valuesById[39] = "PRECOMP"] = 39; + values[valuesById[40] = "PRECONJ"] = 40; + values[valuesById[41] = "PREDET"] = 41; + values[valuesById[42] = "PREF"] = 42; + values[valuesById[43] = "PREP"] = 43; + values[valuesById[44] = "PRONL"] = 44; + values[valuesById[45] = "PRT"] = 45; + values[valuesById[46] = "PS"] = 46; + values[valuesById[47] = "QUANTMOD"] = 47; + values[valuesById[48] = "RCMOD"] = 48; + values[valuesById[49] = "RCMODREL"] = 49; + values[valuesById[50] = "RDROP"] = 50; + values[valuesById[51] = "REF"] = 51; + values[valuesById[52] = "REMNANT"] = 52; + values[valuesById[53] = "REPARANDUM"] = 53; + values[valuesById[54] = "ROOT"] = 54; + values[valuesById[55] = "SNUM"] = 55; + values[valuesById[56] = "SUFF"] = 56; + values[valuesById[57] = "TMOD"] = 57; + values[valuesById[58] = "TOPIC"] = 58; + values[valuesById[59] = "VMOD"] = 59; + values[valuesById[60] = "VOCATIVE"] = 60; + values[valuesById[61] = "XCOMP"] = 61; + values[valuesById[62] = "SUFFIX"] = 62; + values[valuesById[63] = "TITLE"] = 63; + values[valuesById[64] = "ADVPHMOD"] = 64; + values[valuesById[65] = "AUXCAUS"] = 65; + values[valuesById[66] = "AUXVV"] = 66; + values[valuesById[67] = "DTMOD"] = 67; + values[valuesById[68] = "FOREIGN"] = 68; + values[valuesById[69] = "KW"] = 69; + values[valuesById[70] = "LIST"] = 70; + values[valuesById[71] = "NOMC"] = 71; + values[valuesById[72] = "NOMCSUBJ"] = 72; + values[valuesById[73] = "NOMCSUBJPASS"] = 73; + values[valuesById[74] = "NUMC"] = 74; + values[valuesById[75] = "COP"] = 75; + values[valuesById[76] = "DISLOCATED"] = 76; + values[valuesById[77] = "ASP"] = 77; + values[valuesById[78] = "GMOD"] = 78; + values[valuesById[79] = "GOBJ"] = 79; + values[valuesById[80] = "INFMOD"] = 80; + values[valuesById[81] = "MES"] = 81; + values[valuesById[82] = "NCOMP"] = 82; + return values; + })(); + + return DependencyEdge; + })(); + + v1beta2.EntityMention = (function() { + + /** + * Properties of an EntityMention. + * @memberof google.cloud.language.v1beta2 + * @interface IEntityMention + * @property {google.cloud.language.v1beta2.ITextSpan|null} [text] EntityMention text + * @property {google.cloud.language.v1beta2.EntityMention.Type|null} [type] EntityMention type + * @property {google.cloud.language.v1beta2.ISentiment|null} [sentiment] EntityMention sentiment + */ + + /** + * Constructs a new EntityMention. + * @memberof google.cloud.language.v1beta2 + * @classdesc Represents an EntityMention. + * @implements IEntityMention + * @constructor + * @param {google.cloud.language.v1beta2.IEntityMention=} [properties] Properties to set + */ + function EntityMention(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityMention text. + * @member {google.cloud.language.v1beta2.ITextSpan|null|undefined} text + * @memberof google.cloud.language.v1beta2.EntityMention + * @instance + */ + EntityMention.prototype.text = null; + + /** + * EntityMention type. + * @member {google.cloud.language.v1beta2.EntityMention.Type} type + * @memberof google.cloud.language.v1beta2.EntityMention + * @instance + */ + EntityMention.prototype.type = 0; + + /** + * EntityMention sentiment. + * @member {google.cloud.language.v1beta2.ISentiment|null|undefined} sentiment + * @memberof google.cloud.language.v1beta2.EntityMention + * @instance + */ + EntityMention.prototype.sentiment = null; + + /** + * Creates a new EntityMention instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {google.cloud.language.v1beta2.IEntityMention=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention instance + */ + EntityMention.create = function create(properties) { + return new EntityMention(properties); + }; + + /** + * Encodes the specified EntityMention message. Does not implicitly {@link google.cloud.language.v1beta2.EntityMention.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {google.cloud.language.v1beta2.IEntityMention} message EntityMention message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityMention.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.language.v1beta2.TextSpan.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.sentiment != null && Object.hasOwnProperty.call(message, "sentiment")) + $root.google.cloud.language.v1beta2.Sentiment.encode(message.sentiment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EntityMention message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.EntityMention.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {google.cloud.language.v1beta2.IEntityMention} message EntityMention message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityMention.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityMention message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityMention.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.EntityMention(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = $root.google.cloud.language.v1beta2.TextSpan.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityMention message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityMention.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityMention message. + * @function verify + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityMention.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + var error = $root.google.cloud.language.v1beta2.TextSpan.verify(message.text); + if (error) + return "text." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.sentiment != null && message.hasOwnProperty("sentiment")) { + var error = $root.google.cloud.language.v1beta2.Sentiment.verify(message.sentiment); + if (error) + return "sentiment." + error; + } + return null; + }; + + /** + * Creates an EntityMention message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention + */ + EntityMention.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.EntityMention) + return object; + var message = new $root.google.cloud.language.v1beta2.EntityMention(); + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.language.v1beta2.EntityMention.text: object expected"); + message.text = $root.google.cloud.language.v1beta2.TextSpan.fromObject(object.text); + } + switch (object.type) { + case "TYPE_UNKNOWN": + case 0: + message.type = 0; + break; + case "PROPER": + case 1: + message.type = 1; break; - case "NCOMP": - case 82: - message.label = 82; + case "COMMON": + case 2: + message.type = 2; break; } + if (object.sentiment != null) { + if (typeof object.sentiment !== "object") + throw TypeError(".google.cloud.language.v1beta2.EntityMention.sentiment: object expected"); + message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.fromObject(object.sentiment); + } return message; }; /** - * Creates a plain object from a DependencyEdge message. Also converts values to other types if specified. + * Creates a plain object from an EntityMention message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {google.cloud.language.v1beta2.EntityMention} message EntityMention + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityMention.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = null; + object.type = options.enums === String ? "TYPE_UNKNOWN" : 0; + object.sentiment = null; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = $root.google.cloud.language.v1beta2.TextSpan.toObject(message.text, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.language.v1beta2.EntityMention.Type[message.type] : message.type; + if (message.sentiment != null && message.hasOwnProperty("sentiment")) + object.sentiment = $root.google.cloud.language.v1beta2.Sentiment.toObject(message.sentiment, options); + return object; + }; + + /** + * Converts this EntityMention to JSON. + * @function toJSON + * @memberof google.cloud.language.v1beta2.EntityMention + * @instance + * @returns {Object.} JSON object + */ + EntityMention.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EntityMention + * @function getTypeUrl + * @memberof google.cloud.language.v1beta2.EntityMention + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityMention.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1beta2.EntityMention"; + }; + + /** + * Type enum. + * @name google.cloud.language.v1beta2.EntityMention.Type + * @enum {number} + * @property {number} TYPE_UNKNOWN=0 TYPE_UNKNOWN value + * @property {number} PROPER=1 PROPER value + * @property {number} COMMON=2 COMMON value + */ + EntityMention.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "PROPER"] = 1; + values[valuesById[2] = "COMMON"] = 2; + return values; + })(); + + return EntityMention; + })(); + + v1beta2.TextSpan = (function() { + + /** + * Properties of a TextSpan. + * @memberof google.cloud.language.v1beta2 + * @interface ITextSpan + * @property {string|null} [content] TextSpan content + * @property {number|null} [beginOffset] TextSpan beginOffset + */ + + /** + * Constructs a new TextSpan. + * @memberof google.cloud.language.v1beta2 + * @classdesc Represents a TextSpan. + * @implements ITextSpan + * @constructor + * @param {google.cloud.language.v1beta2.ITextSpan=} [properties] Properties to set + */ + function TextSpan(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextSpan content. + * @member {string} content + * @memberof google.cloud.language.v1beta2.TextSpan + * @instance + */ + TextSpan.prototype.content = ""; + + /** + * TextSpan beginOffset. + * @member {number} beginOffset + * @memberof google.cloud.language.v1beta2.TextSpan + * @instance + */ + TextSpan.prototype.beginOffset = 0; + + /** + * Creates a new TextSpan instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.TextSpan + * @static + * @param {google.cloud.language.v1beta2.ITextSpan=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan instance + */ + TextSpan.create = function create(properties) { + return new TextSpan(properties); + }; + + /** + * Encodes the specified TextSpan message. Does not implicitly {@link google.cloud.language.v1beta2.TextSpan.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.TextSpan + * @static + * @param {google.cloud.language.v1beta2.ITextSpan} message TextSpan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSpan.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.content); + if (message.beginOffset != null && Object.hasOwnProperty.call(message, "beginOffset")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.beginOffset); + return writer; + }; + + /** + * Encodes the specified TextSpan message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.TextSpan.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1beta2.TextSpan + * @static + * @param {google.cloud.language.v1beta2.ITextSpan} message TextSpan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextSpan.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextSpan message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1beta2.TextSpan + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSpan.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.TextSpan(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.content = reader.string(); + break; + } + case 2: { + message.beginOffset = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextSpan message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1beta2.TextSpan + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextSpan.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextSpan message. + * @function verify + * @memberof google.cloud.language.v1beta2.TextSpan + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextSpan.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + if (message.beginOffset != null && message.hasOwnProperty("beginOffset")) + if (!$util.isInteger(message.beginOffset)) + return "beginOffset: integer expected"; + return null; + }; + + /** + * Creates a TextSpan message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1beta2.TextSpan + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan + */ + TextSpan.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.TextSpan) + return object; + var message = new $root.google.cloud.language.v1beta2.TextSpan(); + if (object.content != null) + message.content = String(object.content); + if (object.beginOffset != null) + message.beginOffset = object.beginOffset | 0; + return message; + }; + + /** + * Creates a plain object from a TextSpan message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.TextSpan * @static - * @param {google.cloud.language.v1beta2.DependencyEdge} message DependencyEdge + * @param {google.cloud.language.v1beta2.TextSpan} message TextSpan * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DependencyEdge.toObject = function toObject(message, options) { + TextSpan.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.headTokenIndex = 0; - object.label = options.enums === String ? "UNKNOWN" : 0; + object.content = ""; + object.beginOffset = 0; } - if (message.headTokenIndex != null && message.hasOwnProperty("headTokenIndex")) - object.headTokenIndex = message.headTokenIndex; - if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.cloud.language.v1beta2.DependencyEdge.Label[message.label] : message.label; + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + if (message.beginOffset != null && message.hasOwnProperty("beginOffset")) + object.beginOffset = message.beginOffset; return object; }; /** - * Converts this DependencyEdge to JSON. + * Converts this TextSpan to JSON. * @function toJSON - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.TextSpan * @instance * @returns {Object.} JSON object */ - DependencyEdge.prototype.toJSON = function toJSON() { + TextSpan.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for DependencyEdge + * Gets the default type url for TextSpan * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.DependencyEdge + * @memberof google.cloud.language.v1beta2.TextSpan * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - DependencyEdge.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + TextSpan.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1beta2.DependencyEdge"; + return typeUrlPrefix + "/google.cloud.language.v1beta2.TextSpan"; }; - /** - * Label enum. - * @name google.cloud.language.v1beta2.DependencyEdge.Label - * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} ABBREV=1 ABBREV value - * @property {number} ACOMP=2 ACOMP value - * @property {number} ADVCL=3 ADVCL value - * @property {number} ADVMOD=4 ADVMOD value - * @property {number} AMOD=5 AMOD value - * @property {number} APPOS=6 APPOS value - * @property {number} ATTR=7 ATTR value - * @property {number} AUX=8 AUX value - * @property {number} AUXPASS=9 AUXPASS value - * @property {number} CC=10 CC value - * @property {number} CCOMP=11 CCOMP value - * @property {number} CONJ=12 CONJ value - * @property {number} CSUBJ=13 CSUBJ value - * @property {number} CSUBJPASS=14 CSUBJPASS value - * @property {number} DEP=15 DEP value - * @property {number} DET=16 DET value - * @property {number} DISCOURSE=17 DISCOURSE value - * @property {number} DOBJ=18 DOBJ value - * @property {number} EXPL=19 EXPL value - * @property {number} GOESWITH=20 GOESWITH value - * @property {number} IOBJ=21 IOBJ value - * @property {number} MARK=22 MARK value - * @property {number} MWE=23 MWE value - * @property {number} MWV=24 MWV value - * @property {number} NEG=25 NEG value - * @property {number} NN=26 NN value - * @property {number} NPADVMOD=27 NPADVMOD value - * @property {number} NSUBJ=28 NSUBJ value - * @property {number} NSUBJPASS=29 NSUBJPASS value - * @property {number} NUM=30 NUM value - * @property {number} NUMBER=31 NUMBER value - * @property {number} P=32 P value - * @property {number} PARATAXIS=33 PARATAXIS value - * @property {number} PARTMOD=34 PARTMOD value - * @property {number} PCOMP=35 PCOMP value - * @property {number} POBJ=36 POBJ value - * @property {number} POSS=37 POSS value - * @property {number} POSTNEG=38 POSTNEG value - * @property {number} PRECOMP=39 PRECOMP value - * @property {number} PRECONJ=40 PRECONJ value - * @property {number} PREDET=41 PREDET value - * @property {number} PREF=42 PREF value - * @property {number} PREP=43 PREP value - * @property {number} PRONL=44 PRONL value - * @property {number} PRT=45 PRT value - * @property {number} PS=46 PS value - * @property {number} QUANTMOD=47 QUANTMOD value - * @property {number} RCMOD=48 RCMOD value - * @property {number} RCMODREL=49 RCMODREL value - * @property {number} RDROP=50 RDROP value - * @property {number} REF=51 REF value - * @property {number} REMNANT=52 REMNANT value - * @property {number} REPARANDUM=53 REPARANDUM value - * @property {number} ROOT=54 ROOT value - * @property {number} SNUM=55 SNUM value - * @property {number} SUFF=56 SUFF value - * @property {number} TMOD=57 TMOD value - * @property {number} TOPIC=58 TOPIC value - * @property {number} VMOD=59 VMOD value - * @property {number} VOCATIVE=60 VOCATIVE value - * @property {number} XCOMP=61 XCOMP value - * @property {number} SUFFIX=62 SUFFIX value - * @property {number} TITLE=63 TITLE value - * @property {number} ADVPHMOD=64 ADVPHMOD value - * @property {number} AUXCAUS=65 AUXCAUS value - * @property {number} AUXVV=66 AUXVV value - * @property {number} DTMOD=67 DTMOD value - * @property {number} FOREIGN=68 FOREIGN value - * @property {number} KW=69 KW value - * @property {number} LIST=70 LIST value - * @property {number} NOMC=71 NOMC value - * @property {number} NOMCSUBJ=72 NOMCSUBJ value - * @property {number} NOMCSUBJPASS=73 NOMCSUBJPASS value - * @property {number} NUMC=74 NUMC value - * @property {number} COP=75 COP value - * @property {number} DISLOCATED=76 DISLOCATED value - * @property {number} ASP=77 ASP value - * @property {number} GMOD=78 GMOD value - * @property {number} GOBJ=79 GOBJ value - * @property {number} INFMOD=80 INFMOD value - * @property {number} MES=81 MES value - * @property {number} NCOMP=82 NCOMP value - */ - DependencyEdge.Label = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "ABBREV"] = 1; - values[valuesById[2] = "ACOMP"] = 2; - values[valuesById[3] = "ADVCL"] = 3; - values[valuesById[4] = "ADVMOD"] = 4; - values[valuesById[5] = "AMOD"] = 5; - values[valuesById[6] = "APPOS"] = 6; - values[valuesById[7] = "ATTR"] = 7; - values[valuesById[8] = "AUX"] = 8; - values[valuesById[9] = "AUXPASS"] = 9; - values[valuesById[10] = "CC"] = 10; - values[valuesById[11] = "CCOMP"] = 11; - values[valuesById[12] = "CONJ"] = 12; - values[valuesById[13] = "CSUBJ"] = 13; - values[valuesById[14] = "CSUBJPASS"] = 14; - values[valuesById[15] = "DEP"] = 15; - values[valuesById[16] = "DET"] = 16; - values[valuesById[17] = "DISCOURSE"] = 17; - values[valuesById[18] = "DOBJ"] = 18; - values[valuesById[19] = "EXPL"] = 19; - values[valuesById[20] = "GOESWITH"] = 20; - values[valuesById[21] = "IOBJ"] = 21; - values[valuesById[22] = "MARK"] = 22; - values[valuesById[23] = "MWE"] = 23; - values[valuesById[24] = "MWV"] = 24; - values[valuesById[25] = "NEG"] = 25; - values[valuesById[26] = "NN"] = 26; - values[valuesById[27] = "NPADVMOD"] = 27; - values[valuesById[28] = "NSUBJ"] = 28; - values[valuesById[29] = "NSUBJPASS"] = 29; - values[valuesById[30] = "NUM"] = 30; - values[valuesById[31] = "NUMBER"] = 31; - values[valuesById[32] = "P"] = 32; - values[valuesById[33] = "PARATAXIS"] = 33; - values[valuesById[34] = "PARTMOD"] = 34; - values[valuesById[35] = "PCOMP"] = 35; - values[valuesById[36] = "POBJ"] = 36; - values[valuesById[37] = "POSS"] = 37; - values[valuesById[38] = "POSTNEG"] = 38; - values[valuesById[39] = "PRECOMP"] = 39; - values[valuesById[40] = "PRECONJ"] = 40; - values[valuesById[41] = "PREDET"] = 41; - values[valuesById[42] = "PREF"] = 42; - values[valuesById[43] = "PREP"] = 43; - values[valuesById[44] = "PRONL"] = 44; - values[valuesById[45] = "PRT"] = 45; - values[valuesById[46] = "PS"] = 46; - values[valuesById[47] = "QUANTMOD"] = 47; - values[valuesById[48] = "RCMOD"] = 48; - values[valuesById[49] = "RCMODREL"] = 49; - values[valuesById[50] = "RDROP"] = 50; - values[valuesById[51] = "REF"] = 51; - values[valuesById[52] = "REMNANT"] = 52; - values[valuesById[53] = "REPARANDUM"] = 53; - values[valuesById[54] = "ROOT"] = 54; - values[valuesById[55] = "SNUM"] = 55; - values[valuesById[56] = "SUFF"] = 56; - values[valuesById[57] = "TMOD"] = 57; - values[valuesById[58] = "TOPIC"] = 58; - values[valuesById[59] = "VMOD"] = 59; - values[valuesById[60] = "VOCATIVE"] = 60; - values[valuesById[61] = "XCOMP"] = 61; - values[valuesById[62] = "SUFFIX"] = 62; - values[valuesById[63] = "TITLE"] = 63; - values[valuesById[64] = "ADVPHMOD"] = 64; - values[valuesById[65] = "AUXCAUS"] = 65; - values[valuesById[66] = "AUXVV"] = 66; - values[valuesById[67] = "DTMOD"] = 67; - values[valuesById[68] = "FOREIGN"] = 68; - values[valuesById[69] = "KW"] = 69; - values[valuesById[70] = "LIST"] = 70; - values[valuesById[71] = "NOMC"] = 71; - values[valuesById[72] = "NOMCSUBJ"] = 72; - values[valuesById[73] = "NOMCSUBJPASS"] = 73; - values[valuesById[74] = "NUMC"] = 74; - values[valuesById[75] = "COP"] = 75; - values[valuesById[76] = "DISLOCATED"] = 76; - values[valuesById[77] = "ASP"] = 77; - values[valuesById[78] = "GMOD"] = 78; - values[valuesById[79] = "GOBJ"] = 79; - values[valuesById[80] = "INFMOD"] = 80; - values[valuesById[81] = "MES"] = 81; - values[valuesById[82] = "NCOMP"] = 82; - return values; - })(); - - return DependencyEdge; + return TextSpan; })(); - v1beta2.EntityMention = (function() { + v1beta2.ClassificationCategory = (function() { /** - * Properties of an EntityMention. + * Properties of a ClassificationCategory. * @memberof google.cloud.language.v1beta2 - * @interface IEntityMention - * @property {google.cloud.language.v1beta2.ITextSpan|null} [text] EntityMention text - * @property {google.cloud.language.v1beta2.EntityMention.Type|null} [type] EntityMention type - * @property {google.cloud.language.v1beta2.ISentiment|null} [sentiment] EntityMention sentiment + * @interface IClassificationCategory + * @property {string|null} [name] ClassificationCategory name + * @property {number|null} [confidence] ClassificationCategory confidence */ /** - * Constructs a new EntityMention. + * Constructs a new ClassificationCategory. * @memberof google.cloud.language.v1beta2 - * @classdesc Represents an EntityMention. - * @implements IEntityMention + * @classdesc Represents a ClassificationCategory. + * @implements IClassificationCategory * @constructor - * @param {google.cloud.language.v1beta2.IEntityMention=} [properties] Properties to set + * @param {google.cloud.language.v1beta2.IClassificationCategory=} [properties] Properties to set */ - function EntityMention(properties) { + function ClassificationCategory(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12018,103 +13349,89 @@ } /** - * EntityMention text. - * @member {google.cloud.language.v1beta2.ITextSpan|null|undefined} text - * @memberof google.cloud.language.v1beta2.EntityMention - * @instance - */ - EntityMention.prototype.text = null; - - /** - * EntityMention type. - * @member {google.cloud.language.v1beta2.EntityMention.Type} type - * @memberof google.cloud.language.v1beta2.EntityMention + * ClassificationCategory name. + * @member {string} name + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @instance */ - EntityMention.prototype.type = 0; + ClassificationCategory.prototype.name = ""; /** - * EntityMention sentiment. - * @member {google.cloud.language.v1beta2.ISentiment|null|undefined} sentiment - * @memberof google.cloud.language.v1beta2.EntityMention + * ClassificationCategory confidence. + * @member {number} confidence + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @instance */ - EntityMention.prototype.sentiment = null; + ClassificationCategory.prototype.confidence = 0; /** - * Creates a new EntityMention instance using the specified properties. + * Creates a new ClassificationCategory instance using the specified properties. * @function create - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static - * @param {google.cloud.language.v1beta2.IEntityMention=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention instance + * @param {google.cloud.language.v1beta2.IClassificationCategory=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory instance */ - EntityMention.create = function create(properties) { - return new EntityMention(properties); + ClassificationCategory.create = function create(properties) { + return new ClassificationCategory(properties); }; /** - * Encodes the specified EntityMention message. Does not implicitly {@link google.cloud.language.v1beta2.EntityMention.verify|verify} messages. + * Encodes the specified ClassificationCategory message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationCategory.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static - * @param {google.cloud.language.v1beta2.IEntityMention} message EntityMention message or plain object to encode + * @param {google.cloud.language.v1beta2.IClassificationCategory} message ClassificationCategory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityMention.encode = function encode(message, writer) { + ClassificationCategory.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.text != null && Object.hasOwnProperty.call(message, "text")) - $root.google.cloud.language.v1beta2.TextSpan.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - if (message.sentiment != null && Object.hasOwnProperty.call(message, "sentiment")) - $root.google.cloud.language.v1beta2.Sentiment.encode(message.sentiment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); return writer; }; /** - * Encodes the specified EntityMention message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.EntityMention.verify|verify} messages. + * Encodes the specified ClassificationCategory message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationCategory.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static - * @param {google.cloud.language.v1beta2.IEntityMention} message EntityMention message or plain object to encode + * @param {google.cloud.language.v1beta2.IClassificationCategory} message ClassificationCategory message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityMention.encodeDelimited = function encodeDelimited(message, writer) { + ClassificationCategory.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EntityMention message from the specified reader or buffer. + * Decodes a ClassificationCategory message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention + * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityMention.decode = function decode(reader, length) { + ClassificationCategory.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.EntityMention(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.ClassificationCategory(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.text = $root.google.cloud.language.v1beta2.TextSpan.decode(reader, reader.uint32()); + message.name = reader.string(); break; } case 2: { - message.type = reader.int32(); - break; - } - case 3: { - message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.decode(reader, reader.uint32()); + message.confidence = reader.float(); break; } default: @@ -12126,184 +13443,132 @@ }; /** - * Decodes an EntityMention message from the specified reader or buffer, length delimited. + * Decodes a ClassificationCategory message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention + * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityMention.decodeDelimited = function decodeDelimited(reader) { + ClassificationCategory.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EntityMention message. + * Verifies a ClassificationCategory message. * @function verify - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EntityMention.verify = function verify(message) { + ClassificationCategory.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.text != null && message.hasOwnProperty("text")) { - var error = $root.google.cloud.language.v1beta2.TextSpan.verify(message.text); - if (error) - return "text." + error; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.sentiment != null && message.hasOwnProperty("sentiment")) { - var error = $root.google.cloud.language.v1beta2.Sentiment.verify(message.sentiment); - if (error) - return "sentiment." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; return null; }; /** - * Creates an EntityMention message from a plain object. Also converts values to their respective internal types. + * Creates a ClassificationCategory message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.EntityMention} EntityMention + * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory */ - EntityMention.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.EntityMention) + ClassificationCategory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.ClassificationCategory) return object; - var message = new $root.google.cloud.language.v1beta2.EntityMention(); - if (object.text != null) { - if (typeof object.text !== "object") - throw TypeError(".google.cloud.language.v1beta2.EntityMention.text: object expected"); - message.text = $root.google.cloud.language.v1beta2.TextSpan.fromObject(object.text); - } - switch (object.type) { - case "TYPE_UNKNOWN": - case 0: - message.type = 0; - break; - case "PROPER": - case 1: - message.type = 1; - break; - case "COMMON": - case 2: - message.type = 2; - break; - } - if (object.sentiment != null) { - if (typeof object.sentiment !== "object") - throw TypeError(".google.cloud.language.v1beta2.EntityMention.sentiment: object expected"); - message.sentiment = $root.google.cloud.language.v1beta2.Sentiment.fromObject(object.sentiment); - } + var message = new $root.google.cloud.language.v1beta2.ClassificationCategory(); + if (object.name != null) + message.name = String(object.name); + if (object.confidence != null) + message.confidence = Number(object.confidence); return message; }; /** - * Creates a plain object from an EntityMention message. Also converts values to other types if specified. + * Creates a plain object from a ClassificationCategory message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static - * @param {google.cloud.language.v1beta2.EntityMention} message EntityMention + * @param {google.cloud.language.v1beta2.ClassificationCategory} message ClassificationCategory * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EntityMention.toObject = function toObject(message, options) { + ClassificationCategory.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.text = null; - object.type = options.enums === String ? "TYPE_UNKNOWN" : 0; - object.sentiment = null; + object.name = ""; + object.confidence = 0; } - if (message.text != null && message.hasOwnProperty("text")) - object.text = $root.google.cloud.language.v1beta2.TextSpan.toObject(message.text, options); - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.language.v1beta2.EntityMention.Type[message.type] : message.type; - if (message.sentiment != null && message.hasOwnProperty("sentiment")) - object.sentiment = $root.google.cloud.language.v1beta2.Sentiment.toObject(message.sentiment, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; return object; }; /** - * Converts this EntityMention to JSON. + * Converts this ClassificationCategory to JSON. * @function toJSON - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @instance * @returns {Object.} JSON object */ - EntityMention.prototype.toJSON = function toJSON() { + ClassificationCategory.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EntityMention + * Gets the default type url for ClassificationCategory * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.EntityMention + * @memberof google.cloud.language.v1beta2.ClassificationCategory * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EntityMention.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ClassificationCategory.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1beta2.EntityMention"; + return typeUrlPrefix + "/google.cloud.language.v1beta2.ClassificationCategory"; }; - /** - * Type enum. - * @name google.cloud.language.v1beta2.EntityMention.Type - * @enum {number} - * @property {number} TYPE_UNKNOWN=0 TYPE_UNKNOWN value - * @property {number} PROPER=1 PROPER value - * @property {number} COMMON=2 COMMON value - */ - EntityMention.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNKNOWN"] = 0; - values[valuesById[1] = "PROPER"] = 1; - values[valuesById[2] = "COMMON"] = 2; - return values; - })(); - - return EntityMention; + return ClassificationCategory; })(); - v1beta2.TextSpan = (function() { + v1beta2.ClassificationModelOptions = (function() { /** - * Properties of a TextSpan. + * Properties of a ClassificationModelOptions. * @memberof google.cloud.language.v1beta2 - * @interface ITextSpan - * @property {string|null} [content] TextSpan content - * @property {number|null} [beginOffset] TextSpan beginOffset + * @interface IClassificationModelOptions + * @property {google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model|null} [v1Model] ClassificationModelOptions v1Model + * @property {google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model|null} [v2Model] ClassificationModelOptions v2Model */ /** - * Constructs a new TextSpan. + * Constructs a new ClassificationModelOptions. * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a TextSpan. - * @implements ITextSpan + * @classdesc Represents a ClassificationModelOptions. + * @implements IClassificationModelOptions * @constructor - * @param {google.cloud.language.v1beta2.ITextSpan=} [properties] Properties to set + * @param {google.cloud.language.v1beta2.IClassificationModelOptions=} [properties] Properties to set */ - function TextSpan(properties) { + function ClassificationModelOptions(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12311,89 +13576,103 @@ } /** - * TextSpan content. - * @member {string} content - * @memberof google.cloud.language.v1beta2.TextSpan + * ClassificationModelOptions v1Model. + * @member {google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model|null|undefined} v1Model + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @instance */ - TextSpan.prototype.content = ""; + ClassificationModelOptions.prototype.v1Model = null; /** - * TextSpan beginOffset. - * @member {number} beginOffset - * @memberof google.cloud.language.v1beta2.TextSpan + * ClassificationModelOptions v2Model. + * @member {google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model|null|undefined} v2Model + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @instance */ - TextSpan.prototype.beginOffset = 0; + ClassificationModelOptions.prototype.v2Model = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new TextSpan instance using the specified properties. + * ClassificationModelOptions modelType. + * @member {"v1Model"|"v2Model"|undefined} modelType + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions + * @instance + */ + Object.defineProperty(ClassificationModelOptions.prototype, "modelType", { + get: $util.oneOfGetter($oneOfFields = ["v1Model", "v2Model"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ClassificationModelOptions instance using the specified properties. * @function create - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static - * @param {google.cloud.language.v1beta2.ITextSpan=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan instance + * @param {google.cloud.language.v1beta2.IClassificationModelOptions=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions} ClassificationModelOptions instance */ - TextSpan.create = function create(properties) { - return new TextSpan(properties); + ClassificationModelOptions.create = function create(properties) { + return new ClassificationModelOptions(properties); }; /** - * Encodes the specified TextSpan message. Does not implicitly {@link google.cloud.language.v1beta2.TextSpan.verify|verify} messages. + * Encodes the specified ClassificationModelOptions message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.verify|verify} messages. * @function encode - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static - * @param {google.cloud.language.v1beta2.ITextSpan} message TextSpan message or plain object to encode + * @param {google.cloud.language.v1beta2.IClassificationModelOptions} message ClassificationModelOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextSpan.encode = function encode(message, writer) { + ClassificationModelOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.content); - if (message.beginOffset != null && Object.hasOwnProperty.call(message, "beginOffset")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.beginOffset); + if (message.v1Model != null && Object.hasOwnProperty.call(message, "v1Model")) + $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.encode(message.v1Model, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.v2Model != null && Object.hasOwnProperty.call(message, "v2Model")) + $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.encode(message.v2Model, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified TextSpan message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.TextSpan.verify|verify} messages. + * Encodes the specified ClassificationModelOptions message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static - * @param {google.cloud.language.v1beta2.ITextSpan} message TextSpan message or plain object to encode + * @param {google.cloud.language.v1beta2.IClassificationModelOptions} message ClassificationModelOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextSpan.encodeDelimited = function encodeDelimited(message, writer) { + ClassificationModelOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TextSpan message from the specified reader or buffer. + * Decodes a ClassificationModelOptions message from the specified reader or buffer. * @function decode - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions} ClassificationModelOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TextSpan.decode = function decode(reader, length) { + ClassificationModelOptions.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.TextSpan(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.ClassificationModelOptions(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.content = reader.string(); + message.v1Model = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.decode(reader, reader.uint32()); break; } case 2: { - message.beginOffset = reader.int32(); + message.v2Model = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.decode(reader, reader.uint32()); break; } default: @@ -12405,338 +13684,544 @@ }; /** - * Decodes a TextSpan message from the specified reader or buffer, length delimited. + * Decodes a ClassificationModelOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions} ClassificationModelOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TextSpan.decodeDelimited = function decodeDelimited(reader) { + ClassificationModelOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TextSpan message. + * Verifies a ClassificationModelOptions message. * @function verify - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TextSpan.verify = function verify(message) { + ClassificationModelOptions.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.content != null && message.hasOwnProperty("content")) - if (!$util.isString(message.content)) - return "content: string expected"; - if (message.beginOffset != null && message.hasOwnProperty("beginOffset")) - if (!$util.isInteger(message.beginOffset)) - return "beginOffset: integer expected"; + var properties = {}; + if (message.v1Model != null && message.hasOwnProperty("v1Model")) { + properties.modelType = 1; + { + var error = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.verify(message.v1Model); + if (error) + return "v1Model." + error; + } + } + if (message.v2Model != null && message.hasOwnProperty("v2Model")) { + if (properties.modelType === 1) + return "modelType: multiple values"; + properties.modelType = 1; + { + var error = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.verify(message.v2Model); + if (error) + return "v2Model." + error; + } + } return null; }; /** - * Creates a TextSpan message from a plain object. Also converts values to their respective internal types. + * Creates a ClassificationModelOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.TextSpan} TextSpan + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions} ClassificationModelOptions */ - TextSpan.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.TextSpan) + ClassificationModelOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.ClassificationModelOptions) return object; - var message = new $root.google.cloud.language.v1beta2.TextSpan(); - if (object.content != null) - message.content = String(object.content); - if (object.beginOffset != null) - message.beginOffset = object.beginOffset | 0; + var message = new $root.google.cloud.language.v1beta2.ClassificationModelOptions(); + if (object.v1Model != null) { + if (typeof object.v1Model !== "object") + throw TypeError(".google.cloud.language.v1beta2.ClassificationModelOptions.v1Model: object expected"); + message.v1Model = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.fromObject(object.v1Model); + } + if (object.v2Model != null) { + if (typeof object.v2Model !== "object") + throw TypeError(".google.cloud.language.v1beta2.ClassificationModelOptions.v2Model: object expected"); + message.v2Model = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.fromObject(object.v2Model); + } return message; }; /** - * Creates a plain object from a TextSpan message. Also converts values to other types if specified. + * Creates a plain object from a ClassificationModelOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static - * @param {google.cloud.language.v1beta2.TextSpan} message TextSpan + * @param {google.cloud.language.v1beta2.ClassificationModelOptions} message ClassificationModelOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TextSpan.toObject = function toObject(message, options) { + ClassificationModelOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.content = ""; - object.beginOffset = 0; + if (message.v1Model != null && message.hasOwnProperty("v1Model")) { + object.v1Model = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.toObject(message.v1Model, options); + if (options.oneofs) + object.modelType = "v1Model"; + } + if (message.v2Model != null && message.hasOwnProperty("v2Model")) { + object.v2Model = $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.toObject(message.v2Model, options); + if (options.oneofs) + object.modelType = "v2Model"; } - if (message.content != null && message.hasOwnProperty("content")) - object.content = message.content; - if (message.beginOffset != null && message.hasOwnProperty("beginOffset")) - object.beginOffset = message.beginOffset; return object; }; /** - * Converts this TextSpan to JSON. + * Converts this ClassificationModelOptions to JSON. * @function toJSON - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @instance * @returns {Object.} JSON object */ - TextSpan.prototype.toJSON = function toJSON() { + ClassificationModelOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for TextSpan + * Gets the default type url for ClassificationModelOptions * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.TextSpan + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - TextSpan.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ClassificationModelOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.language.v1beta2.TextSpan"; + return typeUrlPrefix + "/google.cloud.language.v1beta2.ClassificationModelOptions"; }; - return TextSpan; - })(); + ClassificationModelOptions.V1Model = (function() { - v1beta2.ClassificationCategory = (function() { + /** + * Properties of a V1Model. + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions + * @interface IV1Model + */ - /** - * Properties of a ClassificationCategory. - * @memberof google.cloud.language.v1beta2 - * @interface IClassificationCategory - * @property {string|null} [name] ClassificationCategory name - * @property {number|null} [confidence] ClassificationCategory confidence - */ + /** + * Constructs a new V1Model. + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions + * @classdesc Represents a V1Model. + * @implements IV1Model + * @constructor + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model=} [properties] Properties to set + */ + function V1Model(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new ClassificationCategory. - * @memberof google.cloud.language.v1beta2 - * @classdesc Represents a ClassificationCategory. - * @implements IClassificationCategory - * @constructor - * @param {google.cloud.language.v1beta2.IClassificationCategory=} [properties] Properties to set - */ - function ClassificationCategory(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Creates a new V1Model instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V1Model} V1Model instance + */ + V1Model.create = function create(properties) { + return new V1Model(properties); + }; - /** - * ClassificationCategory name. - * @member {string} name - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @instance - */ - ClassificationCategory.prototype.name = ""; + /** + * Encodes the specified V1Model message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model} message V1Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V1Model.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * ClassificationCategory confidence. - * @member {number} confidence - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @instance - */ - ClassificationCategory.prototype.confidence = 0; + /** + * Encodes the specified V1Model message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V1Model.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV1Model} message V1Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V1Model.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new ClassificationCategory instance using the specified properties. - * @function create - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {google.cloud.language.v1beta2.IClassificationCategory=} [properties] Properties to set - * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory instance - */ - ClassificationCategory.create = function create(properties) { - return new ClassificationCategory(properties); - }; + /** + * Decodes a V1Model message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V1Model} V1Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V1Model.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified ClassificationCategory message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationCategory.verify|verify} messages. - * @function encode - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {google.cloud.language.v1beta2.IClassificationCategory} message ClassificationCategory message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClassificationCategory.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; + /** + * Decodes a V1Model message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V1Model} V1Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V1Model.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified ClassificationCategory message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationCategory.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {google.cloud.language.v1beta2.IClassificationCategory} message ClassificationCategory message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClassificationCategory.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Verifies a V1Model message. + * @function verify + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + V1Model.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a V1Model message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V1Model} V1Model + */ + V1Model.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model) + return object; + return new $root.google.cloud.language.v1beta2.ClassificationModelOptions.V1Model(); + }; + + /** + * Creates a plain object from a V1Model message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.V1Model} message V1Model + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + V1Model.toObject = function toObject() { + return {}; + }; + + /** + * Converts this V1Model to JSON. + * @function toJSON + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @instance + * @returns {Object.} JSON object + */ + V1Model.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for V1Model + * @function getTypeUrl + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V1Model + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + V1Model.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1beta2.ClassificationModelOptions.V1Model"; + }; + + return V1Model; + })(); + + ClassificationModelOptions.V2Model = (function() { + + /** + * Properties of a V2Model. + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions + * @interface IV2Model + * @property {google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion|null} [contentCategoriesVersion] V2Model contentCategoriesVersion + */ + + /** + * Constructs a new V2Model. + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions + * @classdesc Represents a V2Model. + * @implements IV2Model + * @constructor + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model=} [properties] Properties to set + */ + function V2Model(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * V2Model contentCategoriesVersion. + * @member {google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion} contentCategoriesVersion + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @instance + */ + V2Model.prototype.contentCategoriesVersion = 0; + + /** + * Creates a new V2Model instance using the specified properties. + * @function create + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model=} [properties] Properties to set + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V2Model} V2Model instance + */ + V2Model.create = function create(properties) { + return new V2Model(properties); + }; + + /** + * Encodes the specified V2Model message. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.verify|verify} messages. + * @function encode + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model} message V2Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V2Model.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contentCategoriesVersion != null && Object.hasOwnProperty.call(message, "contentCategoriesVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.contentCategoriesVersion); + return writer; + }; - /** - * Decodes a ClassificationCategory message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClassificationCategory.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.ClassificationCategory(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); + /** + * Encodes the specified V2Model message, length delimited. Does not implicitly {@link google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.IV2Model} message V2Model message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + V2Model.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a V2Model message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V2Model} V2Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V2Model.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.contentCategoriesVersion = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); break; } - case 2: { - message.confidence = reader.float(); + } + return message; + }; + + /** + * Decodes a V2Model message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V2Model} V2Model + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + V2Model.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a V2Model message. + * @function verify + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + V2Model.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contentCategoriesVersion != null && message.hasOwnProperty("contentCategoriesVersion")) + switch (message.contentCategoriesVersion) { + default: + return "contentCategoriesVersion: enum value expected"; + case 0: + case 1: + case 2: break; } - default: - reader.skipType(tag & 7); + return null; + }; + + /** + * Creates a V2Model message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.language.v1beta2.ClassificationModelOptions.V2Model} V2Model + */ + V2Model.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model) + return object; + var message = new $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model(); + switch (object.contentCategoriesVersion) { + case "CONTENT_CATEGORIES_VERSION_UNSPECIFIED": + case 0: + message.contentCategoriesVersion = 0; + break; + case "V1": + case 1: + message.contentCategoriesVersion = 1; + break; + case "V2": + case 2: + message.contentCategoriesVersion = 2; break; } - } - return message; - }; - - /** - * Decodes a ClassificationCategory message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClassificationCategory.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClassificationCategory message. - * @function verify - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClassificationCategory.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - return null; - }; + return message; + }; - /** - * Creates a ClassificationCategory message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.language.v1beta2.ClassificationCategory} ClassificationCategory - */ - ClassificationCategory.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.language.v1beta2.ClassificationCategory) + /** + * Creates a plain object from a V2Model message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {google.cloud.language.v1beta2.ClassificationModelOptions.V2Model} message V2Model + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + V2Model.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.contentCategoriesVersion = options.enums === String ? "CONTENT_CATEGORIES_VERSION_UNSPECIFIED" : 0; + if (message.contentCategoriesVersion != null && message.hasOwnProperty("contentCategoriesVersion")) + object.contentCategoriesVersion = options.enums === String ? $root.google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion[message.contentCategoriesVersion] : message.contentCategoriesVersion; return object; - var message = new $root.google.cloud.language.v1beta2.ClassificationCategory(); - if (object.name != null) - message.name = String(object.name); - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; + }; - /** - * Creates a plain object from a ClassificationCategory message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {google.cloud.language.v1beta2.ClassificationCategory} message ClassificationCategory - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClassificationCategory.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.confidence = 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - return object; - }; + /** + * Converts this V2Model to JSON. + * @function toJSON + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @instance + * @returns {Object.} JSON object + */ + V2Model.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this ClassificationCategory to JSON. - * @function toJSON - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @instance - * @returns {Object.} JSON object - */ - ClassificationCategory.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for V2Model + * @function getTypeUrl + * @memberof google.cloud.language.v1beta2.ClassificationModelOptions.V2Model + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + V2Model.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.language.v1beta2.ClassificationModelOptions.V2Model"; + }; - /** - * Gets the default type url for ClassificationCategory - * @function getTypeUrl - * @memberof google.cloud.language.v1beta2.ClassificationCategory - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ClassificationCategory.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.language.v1beta2.ClassificationCategory"; - }; + /** + * ContentCategoriesVersion enum. + * @name google.cloud.language.v1beta2.ClassificationModelOptions.V2Model.ContentCategoriesVersion + * @enum {number} + * @property {number} CONTENT_CATEGORIES_VERSION_UNSPECIFIED=0 CONTENT_CATEGORIES_VERSION_UNSPECIFIED value + * @property {number} V1=1 V1 value + * @property {number} V2=2 V2 value + */ + V2Model.ContentCategoriesVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONTENT_CATEGORIES_VERSION_UNSPECIFIED"] = 0; + values[valuesById[1] = "V1"] = 1; + values[valuesById[2] = "V2"] = 2; + return values; + })(); + + return V2Model; + })(); - return ClassificationCategory; + return ClassificationModelOptions; })(); v1beta2.AnalyzeSentimentRequest = (function() { @@ -14832,6 +16317,7 @@ * @memberof google.cloud.language.v1beta2 * @interface IClassifyTextRequest * @property {google.cloud.language.v1beta2.IDocument|null} [document] ClassifyTextRequest document + * @property {google.cloud.language.v1beta2.IClassificationModelOptions|null} [classificationModelOptions] ClassifyTextRequest classificationModelOptions */ /** @@ -14857,6 +16343,14 @@ */ ClassifyTextRequest.prototype.document = null; + /** + * ClassifyTextRequest classificationModelOptions. + * @member {google.cloud.language.v1beta2.IClassificationModelOptions|null|undefined} classificationModelOptions + * @memberof google.cloud.language.v1beta2.ClassifyTextRequest + * @instance + */ + ClassifyTextRequest.prototype.classificationModelOptions = null; + /** * Creates a new ClassifyTextRequest instance using the specified properties. * @function create @@ -14883,6 +16377,8 @@ writer = $Writer.create(); if (message.document != null && Object.hasOwnProperty.call(message, "document")) $root.google.cloud.language.v1beta2.Document.encode(message.document, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.classificationModelOptions != null && Object.hasOwnProperty.call(message, "classificationModelOptions")) + $root.google.cloud.language.v1beta2.ClassificationModelOptions.encode(message.classificationModelOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -14921,6 +16417,10 @@ message.document = $root.google.cloud.language.v1beta2.Document.decode(reader, reader.uint32()); break; } + case 3: { + message.classificationModelOptions = $root.google.cloud.language.v1beta2.ClassificationModelOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -14961,6 +16461,11 @@ if (error) return "document." + error; } + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) { + var error = $root.google.cloud.language.v1beta2.ClassificationModelOptions.verify(message.classificationModelOptions); + if (error) + return "classificationModelOptions." + error; + } return null; }; @@ -14981,6 +16486,11 @@ throw TypeError(".google.cloud.language.v1beta2.ClassifyTextRequest.document: object expected"); message.document = $root.google.cloud.language.v1beta2.Document.fromObject(object.document); } + if (object.classificationModelOptions != null) { + if (typeof object.classificationModelOptions !== "object") + throw TypeError(".google.cloud.language.v1beta2.ClassifyTextRequest.classificationModelOptions: object expected"); + message.classificationModelOptions = $root.google.cloud.language.v1beta2.ClassificationModelOptions.fromObject(object.classificationModelOptions); + } return message; }; @@ -14997,10 +16507,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.document = null; + object.classificationModelOptions = null; + } if (message.document != null && message.hasOwnProperty("document")) object.document = $root.google.cloud.language.v1beta2.Document.toObject(message.document, options); + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) + object.classificationModelOptions = $root.google.cloud.language.v1beta2.ClassificationModelOptions.toObject(message.classificationModelOptions, options); return object; }; @@ -15548,6 +17062,7 @@ * @property {boolean|null} [extractDocumentSentiment] Features extractDocumentSentiment * @property {boolean|null} [extractEntitySentiment] Features extractEntitySentiment * @property {boolean|null} [classifyText] Features classifyText + * @property {google.cloud.language.v1beta2.IClassificationModelOptions|null} [classificationModelOptions] Features classificationModelOptions */ /** @@ -15605,6 +17120,14 @@ */ Features.prototype.classifyText = false; + /** + * Features classificationModelOptions. + * @member {google.cloud.language.v1beta2.IClassificationModelOptions|null|undefined} classificationModelOptions + * @memberof google.cloud.language.v1beta2.AnnotateTextRequest.Features + * @instance + */ + Features.prototype.classificationModelOptions = null; + /** * Creates a new Features instance using the specified properties. * @function create @@ -15639,6 +17162,8 @@ writer.uint32(/* id 4, wireType 0 =*/32).bool(message.extractEntitySentiment); if (message.classifyText != null && Object.hasOwnProperty.call(message, "classifyText")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.classifyText); + if (message.classificationModelOptions != null && Object.hasOwnProperty.call(message, "classificationModelOptions")) + $root.google.cloud.language.v1beta2.ClassificationModelOptions.encode(message.classificationModelOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); return writer; }; @@ -15693,6 +17218,10 @@ message.classifyText = reader.bool(); break; } + case 10: { + message.classificationModelOptions = $root.google.cloud.language.v1beta2.ClassificationModelOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -15743,6 +17272,11 @@ if (message.classifyText != null && message.hasOwnProperty("classifyText")) if (typeof message.classifyText !== "boolean") return "classifyText: boolean expected"; + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) { + var error = $root.google.cloud.language.v1beta2.ClassificationModelOptions.verify(message.classificationModelOptions); + if (error) + return "classificationModelOptions." + error; + } return null; }; @@ -15768,6 +17302,11 @@ message.extractEntitySentiment = Boolean(object.extractEntitySentiment); if (object.classifyText != null) message.classifyText = Boolean(object.classifyText); + if (object.classificationModelOptions != null) { + if (typeof object.classificationModelOptions !== "object") + throw TypeError(".google.cloud.language.v1beta2.AnnotateTextRequest.Features.classificationModelOptions: object expected"); + message.classificationModelOptions = $root.google.cloud.language.v1beta2.ClassificationModelOptions.fromObject(object.classificationModelOptions); + } return message; }; @@ -15790,6 +17329,7 @@ object.extractDocumentSentiment = false; object.extractEntitySentiment = false; object.classifyText = false; + object.classificationModelOptions = null; } if (message.extractSyntax != null && message.hasOwnProperty("extractSyntax")) object.extractSyntax = message.extractSyntax; @@ -15801,6 +17341,8 @@ object.extractEntitySentiment = message.extractEntitySentiment; if (message.classifyText != null && message.hasOwnProperty("classifyText")) object.classifyText = message.classifyText; + if (message.classificationModelOptions != null && message.hasOwnProperty("classificationModelOptions")) + object.classificationModelOptions = $root.google.cloud.language.v1beta2.ClassificationModelOptions.toObject(message.classificationModelOptions, options); return object; }; diff --git a/packages/google-cloud-language/protos/protos.json b/packages/google-cloud-language/protos/protos.json index 70a8291cf94..043713bcd1b 100644 --- a/packages/google-cloud-language/protos/protos.json +++ b/packages/google-cloud-language/protos/protos.json @@ -206,6 +206,14 @@ } } }, + "EncodingType": { + "values": { + "NONE": 0, + "UTF8": 1, + "UTF16": 2, + "UTF32": 3 + } + }, "Entity": { "fields": { "name": { @@ -255,14 +263,6 @@ } } }, - "EncodingType": { - "values": { - "NONE": 0, - "UTF8": 1, - "UTF16": 2, - "UTF32": 3 - } - }, "Token": { "fields": { "text": { @@ -629,6 +629,48 @@ } } }, + "ClassificationModelOptions": { + "oneofs": { + "modelType": { + "oneof": [ + "v1Model", + "v2Model" + ] + } + }, + "fields": { + "v1Model": { + "type": "V1Model", + "id": 1 + }, + "v2Model": { + "type": "V2Model", + "id": 2 + } + }, + "nested": { + "V1Model": { + "fields": {} + }, + "V2Model": { + "fields": { + "contentCategoriesVersion": { + "type": "ContentCategoriesVersion", + "id": 1 + } + }, + "nested": { + "ContentCategoriesVersion": { + "values": { + "CONTENT_CATEGORIES_VERSION_UNSPECIFIED": 0, + "V1": 1, + "V2": 2 + } + } + } + } + } + }, "AnalyzeSentimentRequest": { "fields": { "document": { @@ -758,6 +800,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "classificationModelOptions": { + "type": "ClassificationModelOptions", + "id": 3 } } }, @@ -813,6 +859,10 @@ "classifyText": { "type": "bool", "id": 6 + }, + "classificationModelOptions": { + "type": "ClassificationModelOptions", + "id": 10 } } } @@ -1028,6 +1078,14 @@ "language": { "type": "string", "id": 4 + }, + "referenceWebUri": { + "type": "string", + "id": 5 + }, + "boilerplateHandling": { + "type": "BoilerplateHandling", + "id": 6 } }, "nested": { @@ -1037,6 +1095,13 @@ "PLAIN_TEXT": 1, "HTML": 2 } + }, + "BoilerplateHandling": { + "values": { + "BOILERPLATE_HANDLING_UNSPECIFIED": 0, + "SKIP_BOILERPLATE": 1, + "KEEP_BOILERPLATE": 2 + } } } }, @@ -1052,6 +1117,14 @@ } } }, + "EncodingType": { + "values": { + "NONE": 0, + "UTF8": 1, + "UTF16": 2, + "UTF32": 3 + } + }, "Entity": { "fields": { "name": { @@ -1121,14 +1194,6 @@ } } }, - "EncodingType": { - "values": { - "NONE": 0, - "UTF8": 1, - "UTF16": 2, - "UTF32": 3 - } - }, "Sentiment": { "fields": { "magnitude": { @@ -1475,6 +1540,48 @@ } } }, + "ClassificationModelOptions": { + "oneofs": { + "modelType": { + "oneof": [ + "v1Model", + "v2Model" + ] + } + }, + "fields": { + "v1Model": { + "type": "V1Model", + "id": 1 + }, + "v2Model": { + "type": "V2Model", + "id": 2 + } + }, + "nested": { + "V1Model": { + "fields": {} + }, + "V2Model": { + "fields": { + "contentCategoriesVersion": { + "type": "ContentCategoriesVersion", + "id": 1 + } + }, + "nested": { + "ContentCategoriesVersion": { + "values": { + "CONTENT_CATEGORIES_VERSION_UNSPECIFIED": 0, + "V1": 1, + "V2": 2 + } + } + } + } + } + }, "AnalyzeSentimentRequest": { "fields": { "document": { @@ -1604,6 +1711,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "classificationModelOptions": { + "type": "ClassificationModelOptions", + "id": 3 } } }, @@ -1659,6 +1770,10 @@ "classifyText": { "type": "bool", "id": 6 + }, + "classificationModelOptions": { + "type": "ClassificationModelOptions", + "id": 10 } } } diff --git a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entities.js b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entities.js index 5bc14a05ef7..6578ecf4a8c 100644 --- a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entities.js +++ b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entities.js @@ -29,7 +29,7 @@ function main(document) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Input document. + * Required. Input document. */ // const document = {} /** diff --git a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entity_sentiment.js b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entity_sentiment.js index b005b23992c..f14643b689a 100644 --- a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entity_sentiment.js +++ b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_entity_sentiment.js @@ -29,7 +29,7 @@ function main(document) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Input document. + * Required. Input document. */ // const document = {} /** diff --git a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_sentiment.js b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_sentiment.js index cf8c1b63199..3f817360b1d 100644 --- a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_sentiment.js +++ b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_sentiment.js @@ -29,7 +29,7 @@ function main(document) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Input document. + * Required. Input document. */ // const document = {} /** diff --git a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_syntax.js b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_syntax.js index 5d32c85b6b6..f820de1de1a 100644 --- a/packages/google-cloud-language/samples/generated/v1/language_service.analyze_syntax.js +++ b/packages/google-cloud-language/samples/generated/v1/language_service.analyze_syntax.js @@ -29,7 +29,7 @@ function main(document) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Input document. + * Required. Input document. */ // const document = {} /** diff --git a/packages/google-cloud-language/samples/generated/v1/language_service.annotate_text.js b/packages/google-cloud-language/samples/generated/v1/language_service.annotate_text.js index b17c4a774d4..16819e379b2 100644 --- a/packages/google-cloud-language/samples/generated/v1/language_service.annotate_text.js +++ b/packages/google-cloud-language/samples/generated/v1/language_service.annotate_text.js @@ -29,11 +29,11 @@ function main(document, features) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Input document. + * Required. Input document. */ // const document = {} /** - * The enabled features. + * Required. The enabled features. */ // const features = {} /** diff --git a/packages/google-cloud-language/samples/generated/v1/language_service.classify_text.js b/packages/google-cloud-language/samples/generated/v1/language_service.classify_text.js index befda5943f4..3787a2664d4 100644 --- a/packages/google-cloud-language/samples/generated/v1/language_service.classify_text.js +++ b/packages/google-cloud-language/samples/generated/v1/language_service.classify_text.js @@ -29,9 +29,14 @@ function main(document) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Input document. + * Required. Input document. */ // const document = {} + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + */ + // const classificationModelOptions = {} // Imports the Language library const {LanguageServiceClient} = require('@google-cloud/language').v1; diff --git a/packages/google-cloud-language/samples/generated/v1/snippet_metadata.google.cloud.language.v1.json b/packages/google-cloud-language/samples/generated/v1/snippet_metadata.google.cloud.language.v1.json index 79fdbdeebee..d128f793d0e 100644 --- a/packages/google-cloud-language/samples/generated/v1/snippet_metadata.google.cloud.language.v1.json +++ b/packages/google-cloud-language/samples/generated/v1/snippet_metadata.google.cloud.language.v1.json @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 58, "type": "FULL" } ], @@ -210,6 +210,10 @@ { "name": "document", "type": ".google.cloud.language.v1.Document" + }, + { + "name": "classification_model_options", + "type": ".google.cloud.language.v1.ClassificationModelOptions" } ], "resultType": ".google.cloud.language.v1.ClassifyTextResponse", diff --git a/packages/google-cloud-language/samples/generated/v1beta2/language_service.classify_text.js b/packages/google-cloud-language/samples/generated/v1beta2/language_service.classify_text.js index cbb8e1e70a0..a5838919683 100644 --- a/packages/google-cloud-language/samples/generated/v1beta2/language_service.classify_text.js +++ b/packages/google-cloud-language/samples/generated/v1beta2/language_service.classify_text.js @@ -32,6 +32,11 @@ function main(document) { * Required. Input document. */ // const document = {} + /** + * Model options to use for classification. Defaults to v1 options if not + * specified. + */ + // const classificationModelOptions = {} // Imports the Language library const {LanguageServiceClient} = require('@google-cloud/language').v1beta2; diff --git a/packages/google-cloud-language/samples/generated/v1beta2/snippet_metadata.google.cloud.language.v1beta2.json b/packages/google-cloud-language/samples/generated/v1beta2/snippet_metadata.google.cloud.language.v1beta2.json index 0a84af81ff7..5273ef9ed45 100644 --- a/packages/google-cloud-language/samples/generated/v1beta2/snippet_metadata.google.cloud.language.v1beta2.json +++ b/packages/google-cloud-language/samples/generated/v1beta2/snippet_metadata.google.cloud.language.v1beta2.json @@ -147,7 +147,7 @@ "regionTag": "language_v1beta2_generated_LanguageService_AnalyzeSyntax_async", "title": "LanguageService analyzeSyntax Sample", "origin": "API_DEFINITION", - "description": " Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part-of-speech tags, dependency trees, and other properties.", + "description": " Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.", "canonical": true, "file": "language_service.analyze_syntax.js", "language": "JAVASCRIPT", @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 58, "type": "FULL" } ], @@ -210,6 +210,10 @@ { "name": "document", "type": ".google.cloud.language.v1beta2.Document" + }, + { + "name": "classification_model_options", + "type": ".google.cloud.language.v1beta2.ClassificationModelOptions" } ], "resultType": ".google.cloud.language.v1beta2.ClassifyTextResponse", diff --git a/packages/google-cloud-language/src/v1/language_service_client.ts b/packages/google-cloud-language/src/v1/language_service_client.ts index 04e488f1e98..d0890620d76 100644 --- a/packages/google-cloud-language/src/v1/language_service_client.ts +++ b/packages/google-cloud-language/src/v1/language_service_client.ts @@ -317,7 +317,7 @@ export class LanguageServiceClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.language.v1.Document} request.document - * Input document. + * Required. Input document. * @param {google.cloud.language.v1.EncodingType} request.encodingType * The encoding type used by the API to calculate sentence offsets. * @param {object} [options] @@ -408,7 +408,7 @@ export class LanguageServiceClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.language.v1.Document} request.document - * Input document. + * Required. Input document. * @param {google.cloud.language.v1.EncodingType} request.encodingType * The encoding type used by the API to calculate offsets. * @param {object} [options] @@ -492,13 +492,15 @@ export class LanguageServiceClient { return this.innerApiCalls.analyzeEntities(request, options, callback); } /** - * Finds entities, similar to {@link google.cloud.language.v1.LanguageService.AnalyzeEntities|AnalyzeEntities} in the text and analyzes - * sentiment associated with each entity and its mentions. + * Finds entities, similar to + * {@link google.cloud.language.v1.LanguageService.AnalyzeEntities|AnalyzeEntities} + * in the text and analyzes sentiment associated with each entity and its + * mentions. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.language.v1.Document} request.document - * Input document. + * Required. Input document. * @param {google.cloud.language.v1.EncodingType} request.encodingType * The encoding type used by the API to calculate offsets. * @param {object} [options] @@ -599,7 +601,7 @@ export class LanguageServiceClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.language.v1.Document} request.document - * Input document. + * Required. Input document. * @param {google.cloud.language.v1.EncodingType} request.encodingType * The encoding type used by the API to calculate offsets. * @param {object} [options] @@ -682,7 +684,10 @@ export class LanguageServiceClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.language.v1.Document} request.document - * Input document. + * Required. Input document. + * @param {google.cloud.language.v1.ClassificationModelOptions} request.classificationModelOptions + * Model options to use for classification. Defaults to v1 options if not + * specified. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -764,9 +769,9 @@ export class LanguageServiceClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.language.v1.Document} request.document - * Input document. + * Required. Input document. * @param {google.cloud.language.v1.AnnotateTextRequest.Features} request.features - * The enabled features. + * Required. The enabled features. * @param {google.cloud.language.v1.EncodingType} request.encodingType * The encoding type used by the API to calculate offsets. * @param {object} [options] diff --git a/packages/google-cloud-language/src/v1beta2/language_service_client.ts b/packages/google-cloud-language/src/v1beta2/language_service_client.ts index 56e2b76b802..9130aa8e1f3 100644 --- a/packages/google-cloud-language/src/v1beta2/language_service_client.ts +++ b/packages/google-cloud-language/src/v1beta2/language_service_client.ts @@ -594,7 +594,7 @@ export class LanguageServiceClient { } /** * Analyzes the syntax of the text and provides sentence boundaries and - * tokenization along with part-of-speech tags, dependency trees, and other + * tokenization along with part of speech tags, dependency trees, and other * properties. * * @param {Object} request @@ -690,6 +690,9 @@ export class LanguageServiceClient { * The request object that will be sent. * @param {google.cloud.language.v1beta2.Document} request.document * Required. Input document. + * @param {google.cloud.language.v1beta2.ClassificationModelOptions} request.classificationModelOptions + * Model options to use for classification. Defaults to v1 options if not + * specified. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.