File size: 6,320 Bytes
d552aac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

namespace libtextclassifier3.EntityData_.Datetime_;
enum Granularity : int {
  GRANULARITY_UNKNOWN = -1,
  GRANULARITY_YEAR = 0,
  GRANULARITY_MONTH = 1,
  GRANULARITY_WEEK = 2,
  GRANULARITY_DAY = 3,
  GRANULARITY_HOUR = 4,
  GRANULARITY_MINUTE = 5,
  GRANULARITY_SECOND = 6,
}

namespace libtextclassifier3.EntityData_.Datetime_.DatetimeComponent_;
enum ComponentType : int {
  UNSPECIFIED = 0,
  YEAR = 1,
  MONTH = 2,
  WEEK = 3,
  DAY_OF_WEEK = 4,
  DAY_OF_MONTH = 5,
  HOUR = 6,
  MINUTE = 7,
  SECOND = 8,
  MERIDIEM = 9,
  ZONE_OFFSET = 10,
  DST_OFFSET = 11,
}

// Enum to identify if the datetime component are relative or absolute.
namespace libtextclassifier3.EntityData_.Datetime_.DatetimeComponent_;
enum RelationType : int {
  RELATION_UNSPECIFIED = 0,

  // Absolute represents the datetime component that need no further
  // calculation e.g. in a datetime span "21-03-2019" components
  // year=2019, month=3 and day=21 is explicitly mentioned in the span
  ABSOLUTE = 1,

  // Identify datetime component where datetime expressions are relative.
  // e.g. "three days ago", "2 days after March 1st", "next monday",
  // "last Mondays".
  RELATIVE = 2,
}

namespace libtextclassifier3.EntityData_.Datetime_;
table DatetimeComponent {
  component_type:DatetimeComponent_.ComponentType = UNSPECIFIED;
  absolute_value:int;
  relative_count:int;
  relation_type:DatetimeComponent_.RelationType = RELATION_UNSPECIFIED;
}

namespace libtextclassifier3.EntityData_;
table Datetime {
  time_ms_utc:long;
  granularity:Datetime_.Granularity = GRANULARITY_UNKNOWN;
  datetime_component:[Datetime_.DatetimeComponent];
}

namespace libtextclassifier3.EntityData_;
table Contact {
  name:string;
  given_name:string;
  nickname:string;
  email_address:string;
  phone_number:string;
  contact_id:string;
}

namespace libtextclassifier3.EntityData_;
table App {
  name:string;
  package_name:string;
}

// The issuer/network of the payment card.
namespace libtextclassifier3.EntityData_.PaymentCard_;
enum CardNetwork : int {
  UNKNOWN_CARD_NETWORK = 0,
  AMEX = 1,
  DINERS_CLUB = 2,
  DISCOVER = 3,
  INTER_PAYMENT = 4,
  JCB = 5,
  MAESTRO = 6,
  MASTERCARD = 7,
  MIR = 8,
  TROY = 9,
  UNIONPAY = 10,
  VISA = 11,
}

// Details about a payment card.
namespace libtextclassifier3.EntityData_;
table PaymentCard {
  card_network:PaymentCard_.CardNetwork;

  // The card number.
  card_number:string;
}

// Details about a flight number.
namespace libtextclassifier3.EntityData_;
table Flight {
  // The IATA or ICAO airline code of the flight number.
  airline_code:string;

  // The flight number.
  flight_number:string;
}

// Details about an ISBN number.
namespace libtextclassifier3.EntityData_;
table Isbn {
  // The (normalized) number.
  number:string;
}

// Details about an IBAN number.
namespace libtextclassifier3.EntityData_;
table Iban {
  // The (normalized) number.
  number:string;

  // The country code.
  country_code:string;
}

// The issuer/network of the package tracking number.
namespace libtextclassifier3.EntityData_.ParcelTracking_;
enum Carrier : int {
  UNKNOWN_CARRIER = 0,
  FEDEX = 1,
  UPS = 2,
  DHL = 3,
  USPS = 4,
  ONTRAC = 5,
  LASERSHIP = 6,
  ISRAEL_POST = 7,
  SWISS_POST = 8,
  MSC = 9,
  AMAZON = 10,
  I_PARCEL = 11,
}

// Details about a tracking number.
namespace libtextclassifier3.EntityData_;
table ParcelTracking {
  carrier:ParcelTracking_.Carrier;
  tracking_number:string;
}

// Parsed money amount.
namespace libtextclassifier3.EntityData_;
table Money {
  // String representation of currency, unnormalized.
  unnormalized_currency:string;

  // Whole part of the amount (e.g. 123 from "CHF 123.45").
  amount_whole_part:int;

  // Decimal part of the amount (e.g. 45 from "CHF 123.45"). Will be
  // deprecated, use nanos instead.
  amount_decimal_part:int;

  // Money amount (e.g. 123.45 from "CHF 123.45").
  unnormalized_amount:string;

  // Number of nano (10^-9) units of the amount fractional part.
  // The value must be between -999,999,999 and +999,999,999 inclusive.
  // If `units` is positive, `nanos` must be positive or zero.
  // If `units` is zero, `nanos` can be positive, zero, or negative.
  // If `units` is negative, `nanos` must be negative or zero.
  // For example $-1.75 is represented as `amount_whole_part`=-1 and
  // `nanos`=-750,000,000.
  nanos:int;

  // Money quantity (e.g. k from "CHF 123.45k").
  quantity:string;
}

namespace libtextclassifier3.EntityData_.Translate_;
table LanguagePredictionResult {
  // BCP 47 tag for the language prediction result.
  language_tag:string;

  // Confidence score for the language prediction result.
  confidence_score:float;
}

// Details about detected foreign text.
namespace libtextclassifier3.EntityData_;
table Translate {
  language_prediction_results:[Translate_.LanguagePredictionResult];
}

// Represents an entity annotated in text.
namespace libtextclassifier3;
table EntityData {
  // Codepoint indices of the annotation, start is inclusive, end is
  // exclusive.
  start:int;

  end:int;

  // The entity type, as in the TextClassifier APIs.
  type:string;

  datetime:EntityData_.Datetime;
  reserved_5:int (deprecated);
  contact:EntityData_.Contact;
  app:EntityData_.App;
  payment_card:EntityData_.PaymentCard;
  flight:EntityData_.Flight;
  isbn:EntityData_.Isbn;
  iban:EntityData_.Iban;
  parcel:EntityData_.ParcelTracking;
  money:EntityData_.Money;
  translate:EntityData_.Translate;
}

root_type libtextclassifier3.EntityData;