From 7c9440d1ee15549fd3dc05481308eb24fef85fbc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot <44816363+yoshi-automation@users.noreply.github.com> Date: Fri, 22 Mar 2019 10:29:33 -0700 Subject: [PATCH] feat: add additional entity types (#220) --- .../cloud/language/v1/language_service.proto | 73 ++++++++++++------- .../cloud/language/v1/doc_language_service.js | 32 +++++++- .../src/v1/language_service_client.js | 5 +- .../v1/language_service_client_config.json | 16 ++-- packages/google-cloud-language/synth.metadata | 10 +-- 5 files changed, 91 insertions(+), 45 deletions(-) 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 f9893385ffc..7a15c8bf14c 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 @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2019 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,6 +11,7 @@ // 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"; @@ -170,6 +171,21 @@ message Entity { // Other types OTHER = 7; + + // Phone number + PHONE_NUMBER = 9; + + // Address + ADDRESS = 10; + + // Date + DATE = 11; + + // Number + NUMBER = 12; + + // Price + PRICE = 13; } // The representative name for the entity. @@ -203,6 +219,32 @@ message Entity { 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. @@ -870,7 +912,8 @@ message TextSpan { // Represents a category returned from the text classifier. message ClassificationCategory { - // The name of the category representing the document. + // The name of the category representing the document, from the [predefined + // taxonomy](/natural-language/docs/categories). string name = 1; // The classifier's confidence of the category. Number represents how certain @@ -1041,29 +1084,3 @@ message AnnotateTextResponse { // Categories identified in the input document. repeated ClassificationCategory categories = 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; -} diff --git a/packages/google-cloud-language/src/v1/doc/google/cloud/language/v1/doc_language_service.js b/packages/google-cloud-language/src/v1/doc/google/cloud/language/v1/doc_language_service.js index ac2a0f21e3b..0b77e711c24 100644 --- a/packages/google-cloud-language/src/v1/doc/google/cloud/language/v1/doc_language_service.js +++ b/packages/google-cloud-language/src/v1/doc/google/cloud/language/v1/doc_language_service.js @@ -194,7 +194,32 @@ const Entity = { /** * Other types */ - OTHER: 7 + OTHER: 7, + + /** + * Phone number + */ + PHONE_NUMBER: 9, + + /** + * Address + */ + ADDRESS: 10, + + /** + * Date + */ + DATE: 11, + + /** + * Number + */ + NUMBER: 12, + + /** + * Price + */ + PRICE: 13 } }; @@ -1373,7 +1398,8 @@ const TextSpan = { * Represents a category returned from the text classifier. * * @property {string} name - * The name of the category representing the document. + * The name of the category representing the document, from the [predefined + * taxonomy](https://cloud.google.com/natural-language/docs/categories). * * @property {number} confidence * The classifier's confidence of the category. Number represents how certain @@ -1730,7 +1756,7 @@ const EncodingType = { /** * Encoding-dependent information (such as `begin_offset`) is calculated based - * on the UTF-16 encoding of the input. Java and Javascript are examples of + * on the UTF-16 encoding of the input. Java and JavaScript are examples of * languages that use this encoding natively. */ UTF16: 2, diff --git a/packages/google-cloud-language/src/v1/language_service_client.js b/packages/google-cloud-language/src/v1/language_service_client.js index b1c4872eda8..c06ac2f8de8 100644 --- a/packages/google-cloud-language/src/v1/language_service_client.js +++ b/packages/google-cloud-language/src/v1/language_service_client.js @@ -165,7 +165,10 @@ class LanguageServiceClient { * in this service. */ static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; + return [ + 'https://www.googleapis.com/auth/cloud-language', + 'https://www.googleapis.com/auth/cloud-platform', + ]; } /** diff --git a/packages/google-cloud-language/src/v1/language_service_client_config.json b/packages/google-cloud-language/src/v1/language_service_client_config.json index 0f2f69be6c1..d370c9322e7 100644 --- a/packages/google-cloud-language/src/v1/language_service_client_config.json +++ b/packages/google-cloud-language/src/v1/language_service_client_config.json @@ -13,40 +13,40 @@ "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, + "initial_rpc_timeout_millis": 20000, "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 60000, + "max_rpc_timeout_millis": 20000, "total_timeout_millis": 600000 } }, "methods": { "AnalyzeSentiment": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AnalyzeEntities": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AnalyzeEntitySentiment": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AnalyzeSyntax": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ClassifyText": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AnnotateText": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-language/synth.metadata b/packages/google-cloud-language/synth.metadata index a1b7ad57abf..3642d502c07 100644 --- a/packages/google-cloud-language/synth.metadata +++ b/packages/google-cloud-language/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-03-12T11:17:30.419888Z", + "updateTime": "2019-03-22T11:16:51.183804Z", "sources": [ { "generator": { "name": "artman", - "version": "0.16.16", - "dockerImage": "googleapis/artman@sha256:30babbfce7f05a62b1892c63c575aa2c8c502eb4bcc8f3bb90ec83e955d5d319" + "version": "0.16.18", + "dockerImage": "googleapis/artman@sha256:e8ac9200640e76d54643f370db71a1556bf254f565ce46b45a467bbcbacbdb37" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "abd1c9a99c5cd7179d8e5e0c8d4c8e761054cc78", - "internalRef": "237945492" + "sha": "e2a116ac081210002ec2e634f1f840a453ebd182", + "internalRef": "239695990" } }, {