1- # Copyright 2017, Google LLC All rights reserved.
1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright 2018 Google LLC
24#
35# Licensed under the Apache License, Version 2.0 (the "License");
46# you may not use this file except in compliance with the License.
57# You may obtain a copy of the License at
68#
7- # http ://www.apache.org/licenses/LICENSE-2.0
9+ # https ://www.apache.org/licenses/LICENSE-2.0
810#
911# Unless required by applicable law or agreed to in writing, software
1012# distributed under the License is distributed on an "AS IS" BASIS,
1315# limitations under the License.
1416"""Wrappers for protocol buffer enum types."""
1517
18+ import enum
19+
1620
17- class EncodingType (object ):
21+ class EncodingType (enum . IntEnum ):
1822 """
1923 Represents the text encoding that the caller uses to process the output.
2024 Providing an ``EncodingType`` is recommended because the API provides the
@@ -42,7 +46,7 @@ class EncodingType(object):
4246
4347
4448class Document (object ):
45- class Type (object ):
49+ class Type (enum . IntEnum ):
4650 """
4751 The document types enum.
4852
@@ -57,7 +61,7 @@ class Type(object):
5761
5862
5963class Entity (object ):
60- class Type (object ):
64+ class Type (enum . IntEnum ):
6165 """
6266 The type of the entity.
6367
@@ -82,7 +86,7 @@ class Type(object):
8286
8387
8488class PartOfSpeech (object ):
85- class Tag (object ):
89+ class Tag (enum . IntEnum ):
8690 """
8791 The part of speech tags enum.
8892
@@ -117,7 +121,7 @@ class Tag(object):
117121 X = 12
118122 AFFIX = 13
119123
120- class Aspect (object ):
124+ class Aspect (enum . IntEnum ):
121125 """
122126 The characteristic of a verb that expresses time flow during an event.
123127
@@ -132,7 +136,7 @@ class Aspect(object):
132136 IMPERFECTIVE = 2
133137 PROGRESSIVE = 3
134138
135- class Case (object ):
139+ class Case (enum . IntEnum ):
136140 """
137141 The grammatical function performed by a noun or pronoun in a phrase,
138142 clause, or sentence. In some languages, other parts of speech, such as
@@ -171,7 +175,7 @@ class Case(object):
171175 RELATIVE_CASE = 13
172176 VOCATIVE = 14
173177
174- class Form (object ):
178+ class Form (enum . IntEnum ):
175179 """
176180 Depending on the language, Form can be categorizing different forms of
177181 verbs, adjectives, adverbs, etc. For example, categorizing inflected
@@ -205,7 +209,7 @@ class Form(object):
205209 ORDER = 10
206210 SPECIFIC = 11
207211
208- class Gender (object ):
212+ class Gender (enum . IntEnum ):
209213 """
210214 Gender classes of nouns reflected in the behaviour of associated words.
211215
@@ -220,7 +224,7 @@ class Gender(object):
220224 MASCULINE = 2
221225 NEUTER = 3
222226
223- class Mood (object ):
227+ class Mood (enum . IntEnum ):
224228 """
225229 The grammatical feature of verbs, used for showing modality and attitude.
226230
@@ -241,7 +245,7 @@ class Mood(object):
241245 JUSSIVE = 5
242246 SUBJUNCTIVE = 6
243247
244- class Number (object ):
248+ class Number (enum . IntEnum ):
245249 """
246250 Count distinctions.
247251
@@ -256,7 +260,7 @@ class Number(object):
256260 PLURAL = 2
257261 DUAL = 3
258262
259- class Person (object ):
263+ class Person (enum . IntEnum ):
260264 """
261265 The distinction between the speaker, second person, third person, etc.
262266
@@ -273,7 +277,7 @@ class Person(object):
273277 THIRD = 3
274278 REFLEXIVE_PERSON = 4
275279
276- class Proper (object ):
280+ class Proper (enum . IntEnum ):
277281 """
278282 This category shows if the token is part of a proper name.
279283
@@ -286,7 +290,7 @@ class Proper(object):
286290 PROPER = 1
287291 NOT_PROPER = 2
288292
289- class Reciprocity (object ):
293+ class Reciprocity (enum . IntEnum ):
290294 """
291295 Reciprocal features of a pronoun.
292296
@@ -300,7 +304,7 @@ class Reciprocity(object):
300304 RECIPROCAL = 1
301305 NON_RECIPROCAL = 2
302306
303- class Tense (object ):
307+ class Tense (enum . IntEnum ):
304308 """
305309 Time reference.
306310
@@ -321,7 +325,7 @@ class Tense(object):
321325 IMPERFECT = 5
322326 PLUPERFECT = 6
323327
324- class Voice (object ):
328+ class Voice (enum . IntEnum ):
325329 """
326330 The relationship between the action that a verb expresses and the
327331 participants identified by its arguments.
@@ -339,7 +343,7 @@ class Voice(object):
339343
340344
341345class DependencyEdge (object ):
342- class Label (object ):
346+ class Label (enum . IntEnum ):
343347 """
344348 The parse label enum for the token.
345349
@@ -514,7 +518,7 @@ class Label(object):
514518
515519
516520class EntityMention (object ):
517- class Type (object ):
521+ class Type (enum . IntEnum ):
518522 """
519523 The supported types of mentions.
520524
0 commit comments