Skip to content

Commit

Permalink
feat: add additional entity types (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Mar 22, 2019
1 parent 6930a9e commit 2cd6ab5
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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";

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
};

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/google-cloud-language/synth.metadata
Original file line number Diff line number Diff line change
@@ -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"
}
},
{
Expand Down

0 comments on commit 2cd6ab5

Please sign in to comment.