Upload 51 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- 19/libtextclassifier3/AnnotationUsecase.py +8 -0
- 19/libtextclassifier3/CapturingGroup.py +80 -0
- 19/libtextclassifier3/ClassificationModelOptions.py +60 -0
- 19/libtextclassifier3/ContactAnnotatorOptions.py +44 -0
- 19/libtextclassifier3/DatetimeExtractorType.py +81 -0
- 19/libtextclassifier3/DatetimeGroupType.py +21 -0
- 19/libtextclassifier3/DatetimeModel.py +165 -0
- 19/libtextclassifier3/DatetimeModelExtractor.py +85 -0
- 19/libtextclassifier3/DatetimeModelLibrary.py +55 -0
- 19/libtextclassifier3/DatetimeModelLibrary_/Item.py +48 -0
- 19/libtextclassifier3/DatetimeModelPattern.py +116 -0
- 19/libtextclassifier3/DatetimeModelPattern_/Regex.py +77 -0
- 19/libtextclassifier3/DurationAnnotatorOptions.py +267 -0
- 19/libtextclassifier3/FeatureProcessorOptions.py +429 -0
- 19/libtextclassifier3/FeatureProcessorOptions_/BoundsSensitiveFeatures.py +92 -0
- 19/libtextclassifier3/FeatureProcessorOptions_/CenterTokenSelectionMethod.py +9 -0
- 19/libtextclassifier3/FeatureProcessorOptions_/__init__.py +0 -0
- 19/libtextclassifier3/GrammarModel.py +95 -0
- 19/libtextclassifier3/GrammarModel_/RuleClassificationResult.py +107 -0
- 19/libtextclassifier3/GrammarTokenizerOptions.py +106 -0
- 19/libtextclassifier3/ModeFlag.py +14 -0
- 19/libtextclassifier3/Model.py +456 -0
- 19/libtextclassifier3/ModelTriggeringOptions.py +103 -0
- 19/libtextclassifier3/ModelTriggeringOptions_/CollectionToPriorityEntry.py +44 -0
- 19/libtextclassifier3/Model_/ConflictResolutionOptions.py +44 -0
- 19/libtextclassifier3/Model_/EmbeddingPruningMask.py +81 -0
- 19/libtextclassifier3/Model_/__init__.py +0 -0
- 19/libtextclassifier3/MoneyParsingOptions.py +84 -0
- 19/libtextclassifier3/MoneyParsingOptions_/QuantitiesNameToExponentEntry.py +44 -0
- 19/libtextclassifier3/NumberAnnotatorOptions.py +261 -0
- 19/libtextclassifier3/OutputOptions.py +94 -0
- 19/libtextclassifier3/PodNerModel.py +212 -0
- 19/libtextclassifier3/PodNerModel_/Collection.py +52 -0
- 19/libtextclassifier3/PodNerModel_/Label.py +52 -0
- 19/libtextclassifier3/PodNerModel_/Label_/BoiseType.py +12 -0
- 19/libtextclassifier3/PodNerModel_/Label_/MentionType.py +9 -0
- 19/libtextclassifier3/PodNerModel_/Label_/__init__.py +0 -0
- 19/libtextclassifier3/PodNerModel_/__init__.py +0 -0
- 19/libtextclassifier3/RegexModel.py +85 -0
- 19/libtextclassifier3/RegexModel_/Pattern.py +147 -0
- 19/libtextclassifier3/SelectionModelOptions.py +60 -0
- 19/libtextclassifier3/TranslateAnnotatorOptions.py +72 -0
- 19/libtextclassifier3/TranslateAnnotatorOptions_/Algorithm.py +8 -0
- 19/libtextclassifier3/TranslateAnnotatorOptions_/BackoffOptions.py +52 -0
- 19/libtextclassifier3/TranslateAnnotatorOptions_/__init__.py +0 -0
- 19/libtextclassifier3/VerificationOptions.py +44 -0
- 19/libtextclassifier3/VocabModel.py +105 -0
- 19/libtextclassifier3/__init__.py +0 -0
- 19/libtextclassifier3/__pycache__/FeatureProcessorOptions.cpython-310.pyc +0 -0
- 19/libtextclassifier3/__pycache__/Model.cpython-310.pyc +0 -0
19/libtextclassifier3/AnnotationUsecase.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
class AnnotationUsecase(object):
|
| 6 |
+
ANNOTATION_USECASE_SMART = 0
|
| 7 |
+
ANNOTATION_USECASE_RAW = 1
|
| 8 |
+
|
19/libtextclassifier3/CapturingGroup.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class CapturingGroup(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsCapturingGroup(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = CapturingGroup()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def CapturingGroupBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# CapturingGroup
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# CapturingGroup
|
| 28 |
+
def ExtendSelection(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return True
|
| 33 |
+
|
| 34 |
+
# CapturingGroup
|
| 35 |
+
def EntityFieldPath(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 39 |
+
from libtextclassifier3.FlatbufferFieldPath import FlatbufferFieldPath
|
| 40 |
+
obj = FlatbufferFieldPath()
|
| 41 |
+
obj.Init(self._tab.Bytes, x)
|
| 42 |
+
return obj
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
# CapturingGroup
|
| 46 |
+
def SerializedEntityData(self):
|
| 47 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 48 |
+
if o != 0:
|
| 49 |
+
return self._tab.String(o + self._tab.Pos)
|
| 50 |
+
return None
|
| 51 |
+
|
| 52 |
+
# CapturingGroup
|
| 53 |
+
def NormalizationOptions(self):
|
| 54 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 55 |
+
if o != 0:
|
| 56 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 57 |
+
from libtextclassifier3.NormalizationOptions import NormalizationOptions
|
| 58 |
+
obj = NormalizationOptions()
|
| 59 |
+
obj.Init(self._tab.Bytes, x)
|
| 60 |
+
return obj
|
| 61 |
+
return None
|
| 62 |
+
|
| 63 |
+
# CapturingGroup
|
| 64 |
+
def EntityData(self):
|
| 65 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 66 |
+
if o != 0:
|
| 67 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 68 |
+
from libtextclassifier3.EntityData import EntityData
|
| 69 |
+
obj = EntityData()
|
| 70 |
+
obj.Init(self._tab.Bytes, x)
|
| 71 |
+
return obj
|
| 72 |
+
return None
|
| 73 |
+
|
| 74 |
+
def CapturingGroupStart(builder): builder.StartObject(5)
|
| 75 |
+
def CapturingGroupAddExtendSelection(builder, extendSelection): builder.PrependBoolSlot(0, extendSelection, 1)
|
| 76 |
+
def CapturingGroupAddEntityFieldPath(builder, entityFieldPath): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(entityFieldPath), 0)
|
| 77 |
+
def CapturingGroupAddSerializedEntityData(builder, serializedEntityData): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(serializedEntityData), 0)
|
| 78 |
+
def CapturingGroupAddNormalizationOptions(builder, normalizationOptions): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(normalizationOptions), 0)
|
| 79 |
+
def CapturingGroupAddEntityData(builder, entityData): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(entityData), 0)
|
| 80 |
+
def CapturingGroupEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/ClassificationModelOptions.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class ClassificationModelOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsClassificationModelOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = ClassificationModelOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def ClassificationModelOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# ClassificationModelOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# ClassificationModelOptions
|
| 28 |
+
def PhoneMinNumDigits(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 32 |
+
return 7
|
| 33 |
+
|
| 34 |
+
# ClassificationModelOptions
|
| 35 |
+
def PhoneMaxNumDigits(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return 15
|
| 40 |
+
|
| 41 |
+
# ClassificationModelOptions
|
| 42 |
+
def AddressMinNumTokens(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0
|
| 47 |
+
|
| 48 |
+
# ClassificationModelOptions
|
| 49 |
+
def MaxNumTokens(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 53 |
+
return -1
|
| 54 |
+
|
| 55 |
+
def ClassificationModelOptionsStart(builder): builder.StartObject(4)
|
| 56 |
+
def ClassificationModelOptionsAddPhoneMinNumDigits(builder, phoneMinNumDigits): builder.PrependInt32Slot(0, phoneMinNumDigits, 7)
|
| 57 |
+
def ClassificationModelOptionsAddPhoneMaxNumDigits(builder, phoneMaxNumDigits): builder.PrependInt32Slot(1, phoneMaxNumDigits, 15)
|
| 58 |
+
def ClassificationModelOptionsAddAddressMinNumTokens(builder, addressMinNumTokens): builder.PrependInt32Slot(2, addressMinNumTokens, 0)
|
| 59 |
+
def ClassificationModelOptionsAddMaxNumTokens(builder, maxNumTokens): builder.PrependInt32Slot(3, maxNumTokens, -1)
|
| 60 |
+
def ClassificationModelOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/ContactAnnotatorOptions.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class ContactAnnotatorOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsContactAnnotatorOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = ContactAnnotatorOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def ContactAnnotatorOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# ContactAnnotatorOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# ContactAnnotatorOptions
|
| 28 |
+
def EnableDeclension(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# ContactAnnotatorOptions
|
| 35 |
+
def Language(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.String(o + self._tab.Pos)
|
| 39 |
+
return None
|
| 40 |
+
|
| 41 |
+
def ContactAnnotatorOptionsStart(builder): builder.StartObject(2)
|
| 42 |
+
def ContactAnnotatorOptionsAddEnableDeclension(builder, enableDeclension): builder.PrependBoolSlot(0, enableDeclension, 0)
|
| 43 |
+
def ContactAnnotatorOptionsAddLanguage(builder, language): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(language), 0)
|
| 44 |
+
def ContactAnnotatorOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/DatetimeExtractorType.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
class DatetimeExtractorType(object):
|
| 6 |
+
UNKNOWN_DATETIME_EXTRACTOR_TYPE = 0
|
| 7 |
+
AM = 1
|
| 8 |
+
PM = 2
|
| 9 |
+
JANUARY = 3
|
| 10 |
+
FEBRUARY = 4
|
| 11 |
+
MARCH = 5
|
| 12 |
+
APRIL = 6
|
| 13 |
+
MAY = 7
|
| 14 |
+
JUNE = 8
|
| 15 |
+
JULY = 9
|
| 16 |
+
AUGUST = 10
|
| 17 |
+
SEPTEMBER = 11
|
| 18 |
+
OCTOBER = 12
|
| 19 |
+
NOVEMBER = 13
|
| 20 |
+
DECEMBER = 14
|
| 21 |
+
NEXT = 15
|
| 22 |
+
NEXT_OR_SAME = 16
|
| 23 |
+
LAST = 17
|
| 24 |
+
NOW = 18
|
| 25 |
+
TOMORROW = 19
|
| 26 |
+
YESTERDAY = 20
|
| 27 |
+
PAST = 21
|
| 28 |
+
FUTURE = 22
|
| 29 |
+
DAY = 23
|
| 30 |
+
WEEK = 24
|
| 31 |
+
MONTH = 25
|
| 32 |
+
YEAR = 26
|
| 33 |
+
MONDAY = 27
|
| 34 |
+
TUESDAY = 28
|
| 35 |
+
WEDNESDAY = 29
|
| 36 |
+
THURSDAY = 30
|
| 37 |
+
FRIDAY = 31
|
| 38 |
+
SATURDAY = 32
|
| 39 |
+
SUNDAY = 33
|
| 40 |
+
DAYS = 34
|
| 41 |
+
WEEKS = 35
|
| 42 |
+
MONTHS = 36
|
| 43 |
+
HOURS = 37
|
| 44 |
+
MINUTES = 38
|
| 45 |
+
SECONDS = 39
|
| 46 |
+
YEARS = 40
|
| 47 |
+
DIGITS = 41
|
| 48 |
+
SIGNEDDIGITS = 42
|
| 49 |
+
ZERO = 43
|
| 50 |
+
ONE = 44
|
| 51 |
+
TWO = 45
|
| 52 |
+
THREE = 46
|
| 53 |
+
FOUR = 47
|
| 54 |
+
FIVE = 48
|
| 55 |
+
SIX = 49
|
| 56 |
+
SEVEN = 50
|
| 57 |
+
EIGHT = 51
|
| 58 |
+
NINE = 52
|
| 59 |
+
TEN = 53
|
| 60 |
+
ELEVEN = 54
|
| 61 |
+
TWELVE = 55
|
| 62 |
+
THIRTEEN = 56
|
| 63 |
+
FOURTEEN = 57
|
| 64 |
+
FIFTEEN = 58
|
| 65 |
+
SIXTEEN = 59
|
| 66 |
+
SEVENTEEN = 60
|
| 67 |
+
EIGHTEEN = 61
|
| 68 |
+
NINETEEN = 62
|
| 69 |
+
TWENTY = 63
|
| 70 |
+
THIRTY = 64
|
| 71 |
+
FORTY = 65
|
| 72 |
+
FIFTY = 66
|
| 73 |
+
SIXTY = 67
|
| 74 |
+
SEVENTY = 68
|
| 75 |
+
EIGHTY = 69
|
| 76 |
+
NINETY = 70
|
| 77 |
+
HUNDRED = 71
|
| 78 |
+
THOUSAND = 72
|
| 79 |
+
NOON = 73
|
| 80 |
+
MIDNIGHT = 74
|
| 81 |
+
|
19/libtextclassifier3/DatetimeGroupType.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
class DatetimeGroupType(object):
|
| 6 |
+
GROUP_UNKNOWN = 0
|
| 7 |
+
GROUP_UNUSED = 1
|
| 8 |
+
GROUP_YEAR = 2
|
| 9 |
+
GROUP_MONTH = 3
|
| 10 |
+
GROUP_DAY = 4
|
| 11 |
+
GROUP_HOUR = 5
|
| 12 |
+
GROUP_MINUTE = 6
|
| 13 |
+
GROUP_SECOND = 7
|
| 14 |
+
GROUP_AMPM = 8
|
| 15 |
+
GROUP_RELATIONDISTANCE = 9
|
| 16 |
+
GROUP_RELATION = 10
|
| 17 |
+
GROUP_RELATIONTYPE = 11
|
| 18 |
+
GROUP_DUMMY1 = 12
|
| 19 |
+
GROUP_DUMMY2 = 13
|
| 20 |
+
GROUP_ABSOLUTETIME = 14
|
| 21 |
+
|
19/libtextclassifier3/DatetimeModel.py
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class DatetimeModel(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsDatetimeModel(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = DatetimeModel()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def DatetimeModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# DatetimeModel
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# DatetimeModel
|
| 28 |
+
def Locales(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
a = self._tab.Vector(o)
|
| 32 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 33 |
+
return ""
|
| 34 |
+
|
| 35 |
+
# DatetimeModel
|
| 36 |
+
def LocalesLength(self):
|
| 37 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 38 |
+
if o != 0:
|
| 39 |
+
return self._tab.VectorLen(o)
|
| 40 |
+
return 0
|
| 41 |
+
|
| 42 |
+
# DatetimeModel
|
| 43 |
+
def LocalesIsNone(self):
|
| 44 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 45 |
+
return o == 0
|
| 46 |
+
|
| 47 |
+
# DatetimeModel
|
| 48 |
+
def Patterns(self, j):
|
| 49 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 50 |
+
if o != 0:
|
| 51 |
+
x = self._tab.Vector(o)
|
| 52 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 53 |
+
x = self._tab.Indirect(x)
|
| 54 |
+
from libtextclassifier3.DatetimeModelPattern import DatetimeModelPattern
|
| 55 |
+
obj = DatetimeModelPattern()
|
| 56 |
+
obj.Init(self._tab.Bytes, x)
|
| 57 |
+
return obj
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# DatetimeModel
|
| 61 |
+
def PatternsLength(self):
|
| 62 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 63 |
+
if o != 0:
|
| 64 |
+
return self._tab.VectorLen(o)
|
| 65 |
+
return 0
|
| 66 |
+
|
| 67 |
+
# DatetimeModel
|
| 68 |
+
def PatternsIsNone(self):
|
| 69 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 70 |
+
return o == 0
|
| 71 |
+
|
| 72 |
+
# DatetimeModel
|
| 73 |
+
def Extractors(self, j):
|
| 74 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 75 |
+
if o != 0:
|
| 76 |
+
x = self._tab.Vector(o)
|
| 77 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 78 |
+
x = self._tab.Indirect(x)
|
| 79 |
+
from libtextclassifier3.DatetimeModelExtractor import DatetimeModelExtractor
|
| 80 |
+
obj = DatetimeModelExtractor()
|
| 81 |
+
obj.Init(self._tab.Bytes, x)
|
| 82 |
+
return obj
|
| 83 |
+
return None
|
| 84 |
+
|
| 85 |
+
# DatetimeModel
|
| 86 |
+
def ExtractorsLength(self):
|
| 87 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 88 |
+
if o != 0:
|
| 89 |
+
return self._tab.VectorLen(o)
|
| 90 |
+
return 0
|
| 91 |
+
|
| 92 |
+
# DatetimeModel
|
| 93 |
+
def ExtractorsIsNone(self):
|
| 94 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 95 |
+
return o == 0
|
| 96 |
+
|
| 97 |
+
# DatetimeModel
|
| 98 |
+
def UseExtractorsForLocating(self):
|
| 99 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 100 |
+
if o != 0:
|
| 101 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 102 |
+
return True
|
| 103 |
+
|
| 104 |
+
# DatetimeModel
|
| 105 |
+
def DefaultLocales(self, j):
|
| 106 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 107 |
+
if o != 0:
|
| 108 |
+
a = self._tab.Vector(o)
|
| 109 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 110 |
+
return 0
|
| 111 |
+
|
| 112 |
+
# DatetimeModel
|
| 113 |
+
def DefaultLocalesAsNumpy(self):
|
| 114 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 115 |
+
if o != 0:
|
| 116 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 117 |
+
return 0
|
| 118 |
+
|
| 119 |
+
# DatetimeModel
|
| 120 |
+
def DefaultLocalesLength(self):
|
| 121 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 122 |
+
if o != 0:
|
| 123 |
+
return self._tab.VectorLen(o)
|
| 124 |
+
return 0
|
| 125 |
+
|
| 126 |
+
# DatetimeModel
|
| 127 |
+
def DefaultLocalesIsNone(self):
|
| 128 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 129 |
+
return o == 0
|
| 130 |
+
|
| 131 |
+
# DatetimeModel
|
| 132 |
+
def GenerateAlternativeInterpretationsWhenAmbiguous(self):
|
| 133 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 134 |
+
if o != 0:
|
| 135 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 136 |
+
return False
|
| 137 |
+
|
| 138 |
+
# DatetimeModel
|
| 139 |
+
def LazyRegexCompilation(self):
|
| 140 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 141 |
+
if o != 0:
|
| 142 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 143 |
+
return True
|
| 144 |
+
|
| 145 |
+
# DatetimeModel
|
| 146 |
+
def PreferFutureForUnspecifiedDate(self):
|
| 147 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 148 |
+
if o != 0:
|
| 149 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 150 |
+
return False
|
| 151 |
+
|
| 152 |
+
def DatetimeModelStart(builder): builder.StartObject(8)
|
| 153 |
+
def DatetimeModelAddLocales(builder, locales): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(locales), 0)
|
| 154 |
+
def DatetimeModelStartLocalesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 155 |
+
def DatetimeModelAddPatterns(builder, patterns): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(patterns), 0)
|
| 156 |
+
def DatetimeModelStartPatternsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 157 |
+
def DatetimeModelAddExtractors(builder, extractors): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(extractors), 0)
|
| 158 |
+
def DatetimeModelStartExtractorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 159 |
+
def DatetimeModelAddUseExtractorsForLocating(builder, useExtractorsForLocating): builder.PrependBoolSlot(3, useExtractorsForLocating, 1)
|
| 160 |
+
def DatetimeModelAddDefaultLocales(builder, defaultLocales): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(defaultLocales), 0)
|
| 161 |
+
def DatetimeModelStartDefaultLocalesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 162 |
+
def DatetimeModelAddGenerateAlternativeInterpretationsWhenAmbiguous(builder, generateAlternativeInterpretationsWhenAmbiguous): builder.PrependBoolSlot(5, generateAlternativeInterpretationsWhenAmbiguous, 0)
|
| 163 |
+
def DatetimeModelAddLazyRegexCompilation(builder, lazyRegexCompilation): builder.PrependBoolSlot(6, lazyRegexCompilation, 1)
|
| 164 |
+
def DatetimeModelAddPreferFutureForUnspecifiedDate(builder, preferFutureForUnspecifiedDate): builder.PrependBoolSlot(7, preferFutureForUnspecifiedDate, 0)
|
| 165 |
+
def DatetimeModelEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/DatetimeModelExtractor.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class DatetimeModelExtractor(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsDatetimeModelExtractor(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = DatetimeModelExtractor()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def DatetimeModelExtractorBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# DatetimeModelExtractor
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# DatetimeModelExtractor
|
| 28 |
+
def Extractor(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 32 |
+
return 0
|
| 33 |
+
|
| 34 |
+
# DatetimeModelExtractor
|
| 35 |
+
def Pattern(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.String(o + self._tab.Pos)
|
| 39 |
+
return None
|
| 40 |
+
|
| 41 |
+
# DatetimeModelExtractor
|
| 42 |
+
def Locales(self, j):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
a = self._tab.Vector(o)
|
| 46 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 47 |
+
return 0
|
| 48 |
+
|
| 49 |
+
# DatetimeModelExtractor
|
| 50 |
+
def LocalesAsNumpy(self):
|
| 51 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 52 |
+
if o != 0:
|
| 53 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 54 |
+
return 0
|
| 55 |
+
|
| 56 |
+
# DatetimeModelExtractor
|
| 57 |
+
def LocalesLength(self):
|
| 58 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 59 |
+
if o != 0:
|
| 60 |
+
return self._tab.VectorLen(o)
|
| 61 |
+
return 0
|
| 62 |
+
|
| 63 |
+
# DatetimeModelExtractor
|
| 64 |
+
def LocalesIsNone(self):
|
| 65 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 66 |
+
return o == 0
|
| 67 |
+
|
| 68 |
+
# DatetimeModelExtractor
|
| 69 |
+
def CompressedPattern(self):
|
| 70 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 71 |
+
if o != 0:
|
| 72 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 73 |
+
from libtextclassifier3.CompressedBuffer import CompressedBuffer
|
| 74 |
+
obj = CompressedBuffer()
|
| 75 |
+
obj.Init(self._tab.Bytes, x)
|
| 76 |
+
return obj
|
| 77 |
+
return None
|
| 78 |
+
|
| 79 |
+
def DatetimeModelExtractorStart(builder): builder.StartObject(4)
|
| 80 |
+
def DatetimeModelExtractorAddExtractor(builder, extractor): builder.PrependInt32Slot(0, extractor, 0)
|
| 81 |
+
def DatetimeModelExtractorAddPattern(builder, pattern): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(pattern), 0)
|
| 82 |
+
def DatetimeModelExtractorAddLocales(builder, locales): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(locales), 0)
|
| 83 |
+
def DatetimeModelExtractorStartLocalesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 84 |
+
def DatetimeModelExtractorAddCompressedPattern(builder, compressedPattern): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(compressedPattern), 0)
|
| 85 |
+
def DatetimeModelExtractorEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/DatetimeModelLibrary.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class DatetimeModelLibrary(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsDatetimeModelLibrary(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = DatetimeModelLibrary()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def DatetimeModelLibraryBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# DatetimeModelLibrary
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# DatetimeModelLibrary
|
| 28 |
+
def Models(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
x = self._tab.Vector(o)
|
| 32 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 33 |
+
x = self._tab.Indirect(x)
|
| 34 |
+
from libtextclassifier3.DatetimeModelLibrary_.Item import Item
|
| 35 |
+
obj = Item()
|
| 36 |
+
obj.Init(self._tab.Bytes, x)
|
| 37 |
+
return obj
|
| 38 |
+
return None
|
| 39 |
+
|
| 40 |
+
# DatetimeModelLibrary
|
| 41 |
+
def ModelsLength(self):
|
| 42 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 43 |
+
if o != 0:
|
| 44 |
+
return self._tab.VectorLen(o)
|
| 45 |
+
return 0
|
| 46 |
+
|
| 47 |
+
# DatetimeModelLibrary
|
| 48 |
+
def ModelsIsNone(self):
|
| 49 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 50 |
+
return o == 0
|
| 51 |
+
|
| 52 |
+
def DatetimeModelLibraryStart(builder): builder.StartObject(1)
|
| 53 |
+
def DatetimeModelLibraryAddModels(builder, models): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(models), 0)
|
| 54 |
+
def DatetimeModelLibraryStartModelsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 55 |
+
def DatetimeModelLibraryEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/DatetimeModelLibrary_/Item.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: DatetimeModelLibrary_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class Item(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsItem(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = Item()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def ItemBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# Item
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# Item
|
| 28 |
+
def Key(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# Item
|
| 35 |
+
def Value(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 39 |
+
from libtextclassifier3.DatetimeModel import DatetimeModel
|
| 40 |
+
obj = DatetimeModel()
|
| 41 |
+
obj.Init(self._tab.Bytes, x)
|
| 42 |
+
return obj
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
def ItemStart(builder): builder.StartObject(2)
|
| 46 |
+
def ItemAddKey(builder, key): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)
|
| 47 |
+
def ItemAddValue(builder, value): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0)
|
| 48 |
+
def ItemEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/DatetimeModelPattern.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class DatetimeModelPattern(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsDatetimeModelPattern(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = DatetimeModelPattern()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def DatetimeModelPatternBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# DatetimeModelPattern
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# DatetimeModelPattern
|
| 28 |
+
def Regexes(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
x = self._tab.Vector(o)
|
| 32 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 33 |
+
x = self._tab.Indirect(x)
|
| 34 |
+
from libtextclassifier3.DatetimeModelPattern_.Regex import Regex
|
| 35 |
+
obj = Regex()
|
| 36 |
+
obj.Init(self._tab.Bytes, x)
|
| 37 |
+
return obj
|
| 38 |
+
return None
|
| 39 |
+
|
| 40 |
+
# DatetimeModelPattern
|
| 41 |
+
def RegexesLength(self):
|
| 42 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 43 |
+
if o != 0:
|
| 44 |
+
return self._tab.VectorLen(o)
|
| 45 |
+
return 0
|
| 46 |
+
|
| 47 |
+
# DatetimeModelPattern
|
| 48 |
+
def RegexesIsNone(self):
|
| 49 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 50 |
+
return o == 0
|
| 51 |
+
|
| 52 |
+
# DatetimeModelPattern
|
| 53 |
+
def Locales(self, j):
|
| 54 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 55 |
+
if o != 0:
|
| 56 |
+
a = self._tab.Vector(o)
|
| 57 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 58 |
+
return 0
|
| 59 |
+
|
| 60 |
+
# DatetimeModelPattern
|
| 61 |
+
def LocalesAsNumpy(self):
|
| 62 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 63 |
+
if o != 0:
|
| 64 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 65 |
+
return 0
|
| 66 |
+
|
| 67 |
+
# DatetimeModelPattern
|
| 68 |
+
def LocalesLength(self):
|
| 69 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 70 |
+
if o != 0:
|
| 71 |
+
return self._tab.VectorLen(o)
|
| 72 |
+
return 0
|
| 73 |
+
|
| 74 |
+
# DatetimeModelPattern
|
| 75 |
+
def LocalesIsNone(self):
|
| 76 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 77 |
+
return o == 0
|
| 78 |
+
|
| 79 |
+
# DatetimeModelPattern
|
| 80 |
+
def TargetClassificationScore(self):
|
| 81 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 82 |
+
if o != 0:
|
| 83 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 84 |
+
return 1.0
|
| 85 |
+
|
| 86 |
+
# DatetimeModelPattern
|
| 87 |
+
def PriorityScore(self):
|
| 88 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 89 |
+
if o != 0:
|
| 90 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 91 |
+
return 0.0
|
| 92 |
+
|
| 93 |
+
# DatetimeModelPattern
|
| 94 |
+
def EnabledModes(self):
|
| 95 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 96 |
+
if o != 0:
|
| 97 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 98 |
+
return 7
|
| 99 |
+
|
| 100 |
+
# DatetimeModelPattern
|
| 101 |
+
def EnabledAnnotationUsecases(self):
|
| 102 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 103 |
+
if o != 0:
|
| 104 |
+
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
| 105 |
+
return 4294967295
|
| 106 |
+
|
| 107 |
+
def DatetimeModelPatternStart(builder): builder.StartObject(6)
|
| 108 |
+
def DatetimeModelPatternAddRegexes(builder, regexes): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(regexes), 0)
|
| 109 |
+
def DatetimeModelPatternStartRegexesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 110 |
+
def DatetimeModelPatternAddLocales(builder, locales): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(locales), 0)
|
| 111 |
+
def DatetimeModelPatternStartLocalesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 112 |
+
def DatetimeModelPatternAddTargetClassificationScore(builder, targetClassificationScore): builder.PrependFloat32Slot(2, targetClassificationScore, 1.0)
|
| 113 |
+
def DatetimeModelPatternAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(3, priorityScore, 0.0)
|
| 114 |
+
def DatetimeModelPatternAddEnabledModes(builder, enabledModes): builder.PrependInt32Slot(4, enabledModes, 7)
|
| 115 |
+
def DatetimeModelPatternAddEnabledAnnotationUsecases(builder, enabledAnnotationUsecases): builder.PrependUint32Slot(5, enabledAnnotationUsecases, 4294967295)
|
| 116 |
+
def DatetimeModelPatternEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/DatetimeModelPattern_/Regex.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: DatetimeModelPattern_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class Regex(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsRegex(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = Regex()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def RegexBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# Regex
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# Regex
|
| 28 |
+
def Pattern(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# Regex
|
| 35 |
+
def Groups(self, j):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
a = self._tab.Vector(o)
|
| 39 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 40 |
+
return 0
|
| 41 |
+
|
| 42 |
+
# Regex
|
| 43 |
+
def GroupsAsNumpy(self):
|
| 44 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 45 |
+
if o != 0:
|
| 46 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 47 |
+
return 0
|
| 48 |
+
|
| 49 |
+
# Regex
|
| 50 |
+
def GroupsLength(self):
|
| 51 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 52 |
+
if o != 0:
|
| 53 |
+
return self._tab.VectorLen(o)
|
| 54 |
+
return 0
|
| 55 |
+
|
| 56 |
+
# Regex
|
| 57 |
+
def GroupsIsNone(self):
|
| 58 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 59 |
+
return o == 0
|
| 60 |
+
|
| 61 |
+
# Regex
|
| 62 |
+
def CompressedPattern(self):
|
| 63 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 64 |
+
if o != 0:
|
| 65 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 66 |
+
from libtextclassifier3.CompressedBuffer import CompressedBuffer
|
| 67 |
+
obj = CompressedBuffer()
|
| 68 |
+
obj.Init(self._tab.Bytes, x)
|
| 69 |
+
return obj
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
+
def RegexStart(builder): builder.StartObject(3)
|
| 73 |
+
def RegexAddPattern(builder, pattern): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pattern), 0)
|
| 74 |
+
def RegexAddGroups(builder, groups): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(groups), 0)
|
| 75 |
+
def RegexStartGroupsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 76 |
+
def RegexAddCompressedPattern(builder, compressedPattern): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(compressedPattern), 0)
|
| 77 |
+
def RegexEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/DurationAnnotatorOptions.py
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class DurationAnnotatorOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsDurationAnnotatorOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = DurationAnnotatorOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def DurationAnnotatorOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# DurationAnnotatorOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# DurationAnnotatorOptions
|
| 28 |
+
def Enabled(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# DurationAnnotatorOptions
|
| 35 |
+
def Score(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 39 |
+
return 1.0
|
| 40 |
+
|
| 41 |
+
# DurationAnnotatorOptions
|
| 42 |
+
def PriorityScore(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0.0
|
| 47 |
+
|
| 48 |
+
# DurationAnnotatorOptions
|
| 49 |
+
def EnabledModes(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 53 |
+
return 7
|
| 54 |
+
|
| 55 |
+
# DurationAnnotatorOptions
|
| 56 |
+
def EnabledAnnotationUsecases(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 58 |
+
if o != 0:
|
| 59 |
+
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
| 60 |
+
return 4294967295
|
| 61 |
+
|
| 62 |
+
# DurationAnnotatorOptions
|
| 63 |
+
def WeekExpressions(self, j):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 65 |
+
if o != 0:
|
| 66 |
+
a = self._tab.Vector(o)
|
| 67 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 68 |
+
return ""
|
| 69 |
+
|
| 70 |
+
# DurationAnnotatorOptions
|
| 71 |
+
def WeekExpressionsLength(self):
|
| 72 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 73 |
+
if o != 0:
|
| 74 |
+
return self._tab.VectorLen(o)
|
| 75 |
+
return 0
|
| 76 |
+
|
| 77 |
+
# DurationAnnotatorOptions
|
| 78 |
+
def WeekExpressionsIsNone(self):
|
| 79 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 80 |
+
return o == 0
|
| 81 |
+
|
| 82 |
+
# DurationAnnotatorOptions
|
| 83 |
+
def DayExpressions(self, j):
|
| 84 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 85 |
+
if o != 0:
|
| 86 |
+
a = self._tab.Vector(o)
|
| 87 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 88 |
+
return ""
|
| 89 |
+
|
| 90 |
+
# DurationAnnotatorOptions
|
| 91 |
+
def DayExpressionsLength(self):
|
| 92 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 93 |
+
if o != 0:
|
| 94 |
+
return self._tab.VectorLen(o)
|
| 95 |
+
return 0
|
| 96 |
+
|
| 97 |
+
# DurationAnnotatorOptions
|
| 98 |
+
def DayExpressionsIsNone(self):
|
| 99 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 100 |
+
return o == 0
|
| 101 |
+
|
| 102 |
+
# DurationAnnotatorOptions
|
| 103 |
+
def HourExpressions(self, j):
|
| 104 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 105 |
+
if o != 0:
|
| 106 |
+
a = self._tab.Vector(o)
|
| 107 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 108 |
+
return ""
|
| 109 |
+
|
| 110 |
+
# DurationAnnotatorOptions
|
| 111 |
+
def HourExpressionsLength(self):
|
| 112 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 113 |
+
if o != 0:
|
| 114 |
+
return self._tab.VectorLen(o)
|
| 115 |
+
return 0
|
| 116 |
+
|
| 117 |
+
# DurationAnnotatorOptions
|
| 118 |
+
def HourExpressionsIsNone(self):
|
| 119 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 120 |
+
return o == 0
|
| 121 |
+
|
| 122 |
+
# DurationAnnotatorOptions
|
| 123 |
+
def MinuteExpressions(self, j):
|
| 124 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 125 |
+
if o != 0:
|
| 126 |
+
a = self._tab.Vector(o)
|
| 127 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 128 |
+
return ""
|
| 129 |
+
|
| 130 |
+
# DurationAnnotatorOptions
|
| 131 |
+
def MinuteExpressionsLength(self):
|
| 132 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 133 |
+
if o != 0:
|
| 134 |
+
return self._tab.VectorLen(o)
|
| 135 |
+
return 0
|
| 136 |
+
|
| 137 |
+
# DurationAnnotatorOptions
|
| 138 |
+
def MinuteExpressionsIsNone(self):
|
| 139 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 140 |
+
return o == 0
|
| 141 |
+
|
| 142 |
+
# DurationAnnotatorOptions
|
| 143 |
+
def SecondExpressions(self, j):
|
| 144 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 145 |
+
if o != 0:
|
| 146 |
+
a = self._tab.Vector(o)
|
| 147 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 148 |
+
return ""
|
| 149 |
+
|
| 150 |
+
# DurationAnnotatorOptions
|
| 151 |
+
def SecondExpressionsLength(self):
|
| 152 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 153 |
+
if o != 0:
|
| 154 |
+
return self._tab.VectorLen(o)
|
| 155 |
+
return 0
|
| 156 |
+
|
| 157 |
+
# DurationAnnotatorOptions
|
| 158 |
+
def SecondExpressionsIsNone(self):
|
| 159 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 160 |
+
return o == 0
|
| 161 |
+
|
| 162 |
+
# DurationAnnotatorOptions
|
| 163 |
+
def FillerExpressions(self, j):
|
| 164 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 165 |
+
if o != 0:
|
| 166 |
+
a = self._tab.Vector(o)
|
| 167 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 168 |
+
return ""
|
| 169 |
+
|
| 170 |
+
# DurationAnnotatorOptions
|
| 171 |
+
def FillerExpressionsLength(self):
|
| 172 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 173 |
+
if o != 0:
|
| 174 |
+
return self._tab.VectorLen(o)
|
| 175 |
+
return 0
|
| 176 |
+
|
| 177 |
+
# DurationAnnotatorOptions
|
| 178 |
+
def FillerExpressionsIsNone(self):
|
| 179 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 180 |
+
return o == 0
|
| 181 |
+
|
| 182 |
+
# DurationAnnotatorOptions
|
| 183 |
+
def HalfExpressions(self, j):
|
| 184 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 185 |
+
if o != 0:
|
| 186 |
+
a = self._tab.Vector(o)
|
| 187 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 188 |
+
return ""
|
| 189 |
+
|
| 190 |
+
# DurationAnnotatorOptions
|
| 191 |
+
def HalfExpressionsLength(self):
|
| 192 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 193 |
+
if o != 0:
|
| 194 |
+
return self._tab.VectorLen(o)
|
| 195 |
+
return 0
|
| 196 |
+
|
| 197 |
+
# DurationAnnotatorOptions
|
| 198 |
+
def HalfExpressionsIsNone(self):
|
| 199 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 200 |
+
return o == 0
|
| 201 |
+
|
| 202 |
+
# DurationAnnotatorOptions
|
| 203 |
+
def SubTokenSeparatorCodepoints(self, j):
|
| 204 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 205 |
+
if o != 0:
|
| 206 |
+
a = self._tab.Vector(o)
|
| 207 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 208 |
+
return 0
|
| 209 |
+
|
| 210 |
+
# DurationAnnotatorOptions
|
| 211 |
+
def SubTokenSeparatorCodepointsAsNumpy(self):
|
| 212 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 213 |
+
if o != 0:
|
| 214 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 215 |
+
return 0
|
| 216 |
+
|
| 217 |
+
# DurationAnnotatorOptions
|
| 218 |
+
def SubTokenSeparatorCodepointsLength(self):
|
| 219 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 220 |
+
if o != 0:
|
| 221 |
+
return self._tab.VectorLen(o)
|
| 222 |
+
return 0
|
| 223 |
+
|
| 224 |
+
# DurationAnnotatorOptions
|
| 225 |
+
def SubTokenSeparatorCodepointsIsNone(self):
|
| 226 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 227 |
+
return o == 0
|
| 228 |
+
|
| 229 |
+
# DurationAnnotatorOptions
|
| 230 |
+
def RequireQuantity(self):
|
| 231 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
|
| 232 |
+
if o != 0:
|
| 233 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 234 |
+
return False
|
| 235 |
+
|
| 236 |
+
# DurationAnnotatorOptions
|
| 237 |
+
def EnableDanglingQuantityInterpretation(self):
|
| 238 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
|
| 239 |
+
if o != 0:
|
| 240 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 241 |
+
return True
|
| 242 |
+
|
| 243 |
+
def DurationAnnotatorOptionsStart(builder): builder.StartObject(15)
|
| 244 |
+
def DurationAnnotatorOptionsAddEnabled(builder, enabled): builder.PrependBoolSlot(0, enabled, 0)
|
| 245 |
+
def DurationAnnotatorOptionsAddScore(builder, score): builder.PrependFloat32Slot(1, score, 1.0)
|
| 246 |
+
def DurationAnnotatorOptionsAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(2, priorityScore, 0.0)
|
| 247 |
+
def DurationAnnotatorOptionsAddEnabledModes(builder, enabledModes): builder.PrependInt32Slot(3, enabledModes, 7)
|
| 248 |
+
def DurationAnnotatorOptionsAddEnabledAnnotationUsecases(builder, enabledAnnotationUsecases): builder.PrependUint32Slot(4, enabledAnnotationUsecases, 4294967295)
|
| 249 |
+
def DurationAnnotatorOptionsAddWeekExpressions(builder, weekExpressions): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(weekExpressions), 0)
|
| 250 |
+
def DurationAnnotatorOptionsStartWeekExpressionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 251 |
+
def DurationAnnotatorOptionsAddDayExpressions(builder, dayExpressions): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(dayExpressions), 0)
|
| 252 |
+
def DurationAnnotatorOptionsStartDayExpressionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 253 |
+
def DurationAnnotatorOptionsAddHourExpressions(builder, hourExpressions): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(hourExpressions), 0)
|
| 254 |
+
def DurationAnnotatorOptionsStartHourExpressionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 255 |
+
def DurationAnnotatorOptionsAddMinuteExpressions(builder, minuteExpressions): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(minuteExpressions), 0)
|
| 256 |
+
def DurationAnnotatorOptionsStartMinuteExpressionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 257 |
+
def DurationAnnotatorOptionsAddSecondExpressions(builder, secondExpressions): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(secondExpressions), 0)
|
| 258 |
+
def DurationAnnotatorOptionsStartSecondExpressionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 259 |
+
def DurationAnnotatorOptionsAddFillerExpressions(builder, fillerExpressions): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(fillerExpressions), 0)
|
| 260 |
+
def DurationAnnotatorOptionsStartFillerExpressionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 261 |
+
def DurationAnnotatorOptionsAddHalfExpressions(builder, halfExpressions): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(halfExpressions), 0)
|
| 262 |
+
def DurationAnnotatorOptionsStartHalfExpressionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 263 |
+
def DurationAnnotatorOptionsAddSubTokenSeparatorCodepoints(builder, subTokenSeparatorCodepoints): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(subTokenSeparatorCodepoints), 0)
|
| 264 |
+
def DurationAnnotatorOptionsStartSubTokenSeparatorCodepointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 265 |
+
def DurationAnnotatorOptionsAddRequireQuantity(builder, requireQuantity): builder.PrependBoolSlot(13, requireQuantity, 0)
|
| 266 |
+
def DurationAnnotatorOptionsAddEnableDanglingQuantityInterpretation(builder, enableDanglingQuantityInterpretation): builder.PrependBoolSlot(14, enableDanglingQuantityInterpretation, 1)
|
| 267 |
+
def DurationAnnotatorOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/FeatureProcessorOptions.py
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class FeatureProcessorOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsFeatureProcessorOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = FeatureProcessorOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def FeatureProcessorOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# FeatureProcessorOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# FeatureProcessorOptions
|
| 28 |
+
def NumBuckets(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 32 |
+
return -1
|
| 33 |
+
|
| 34 |
+
# FeatureProcessorOptions
|
| 35 |
+
def EmbeddingSize(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return -1
|
| 40 |
+
|
| 41 |
+
# FeatureProcessorOptions
|
| 42 |
+
def EmbeddingQuantizationBits(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 46 |
+
return 8
|
| 47 |
+
|
| 48 |
+
# FeatureProcessorOptions
|
| 49 |
+
def ContextSize(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 53 |
+
return -1
|
| 54 |
+
|
| 55 |
+
# FeatureProcessorOptions
|
| 56 |
+
def MaxSelectionSpan(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 58 |
+
if o != 0:
|
| 59 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 60 |
+
return -1
|
| 61 |
+
|
| 62 |
+
# FeatureProcessorOptions
|
| 63 |
+
def ChargramOrders(self, j):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 65 |
+
if o != 0:
|
| 66 |
+
a = self._tab.Vector(o)
|
| 67 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 68 |
+
return 0
|
| 69 |
+
|
| 70 |
+
# FeatureProcessorOptions
|
| 71 |
+
def ChargramOrdersAsNumpy(self):
|
| 72 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 73 |
+
if o != 0:
|
| 74 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 75 |
+
return 0
|
| 76 |
+
|
| 77 |
+
# FeatureProcessorOptions
|
| 78 |
+
def ChargramOrdersLength(self):
|
| 79 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 80 |
+
if o != 0:
|
| 81 |
+
return self._tab.VectorLen(o)
|
| 82 |
+
return 0
|
| 83 |
+
|
| 84 |
+
# FeatureProcessorOptions
|
| 85 |
+
def ChargramOrdersIsNone(self):
|
| 86 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 87 |
+
return o == 0
|
| 88 |
+
|
| 89 |
+
# FeatureProcessorOptions
|
| 90 |
+
def MaxWordLength(self):
|
| 91 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 92 |
+
if o != 0:
|
| 93 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 94 |
+
return 20
|
| 95 |
+
|
| 96 |
+
# FeatureProcessorOptions
|
| 97 |
+
def UnicodeAwareFeatures(self):
|
| 98 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 99 |
+
if o != 0:
|
| 100 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 101 |
+
return False
|
| 102 |
+
|
| 103 |
+
# FeatureProcessorOptions
|
| 104 |
+
def ExtractCaseFeature(self):
|
| 105 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 106 |
+
if o != 0:
|
| 107 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 108 |
+
return False
|
| 109 |
+
|
| 110 |
+
# FeatureProcessorOptions
|
| 111 |
+
def ExtractSelectionMaskFeature(self):
|
| 112 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 113 |
+
if o != 0:
|
| 114 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 115 |
+
return False
|
| 116 |
+
|
| 117 |
+
# FeatureProcessorOptions
|
| 118 |
+
def RegexpFeature(self, j):
|
| 119 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 120 |
+
if o != 0:
|
| 121 |
+
a = self._tab.Vector(o)
|
| 122 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 123 |
+
return ""
|
| 124 |
+
|
| 125 |
+
# FeatureProcessorOptions
|
| 126 |
+
def RegexpFeatureLength(self):
|
| 127 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 128 |
+
if o != 0:
|
| 129 |
+
return self._tab.VectorLen(o)
|
| 130 |
+
return 0
|
| 131 |
+
|
| 132 |
+
# FeatureProcessorOptions
|
| 133 |
+
def RegexpFeatureIsNone(self):
|
| 134 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 135 |
+
return o == 0
|
| 136 |
+
|
| 137 |
+
# FeatureProcessorOptions
|
| 138 |
+
def RemapDigits(self):
|
| 139 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 140 |
+
if o != 0:
|
| 141 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 142 |
+
return False
|
| 143 |
+
|
| 144 |
+
# FeatureProcessorOptions
|
| 145 |
+
def LowercaseTokens(self):
|
| 146 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 147 |
+
if o != 0:
|
| 148 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 149 |
+
return False
|
| 150 |
+
|
| 151 |
+
# FeatureProcessorOptions
|
| 152 |
+
def SelectionReducedOutputSpace(self):
|
| 153 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
|
| 154 |
+
if o != 0:
|
| 155 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 156 |
+
return True
|
| 157 |
+
|
| 158 |
+
# FeatureProcessorOptions
|
| 159 |
+
def Collections(self, j):
|
| 160 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
|
| 161 |
+
if o != 0:
|
| 162 |
+
a = self._tab.Vector(o)
|
| 163 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 164 |
+
return ""
|
| 165 |
+
|
| 166 |
+
# FeatureProcessorOptions
|
| 167 |
+
def CollectionsLength(self):
|
| 168 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
|
| 169 |
+
if o != 0:
|
| 170 |
+
return self._tab.VectorLen(o)
|
| 171 |
+
return 0
|
| 172 |
+
|
| 173 |
+
# FeatureProcessorOptions
|
| 174 |
+
def CollectionsIsNone(self):
|
| 175 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
|
| 176 |
+
return o == 0
|
| 177 |
+
|
| 178 |
+
# FeatureProcessorOptions
|
| 179 |
+
def DefaultCollection(self):
|
| 180 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
|
| 181 |
+
if o != 0:
|
| 182 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 183 |
+
return -1
|
| 184 |
+
|
| 185 |
+
# FeatureProcessorOptions
|
| 186 |
+
def OnlyUseLineWithClick(self):
|
| 187 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
|
| 188 |
+
if o != 0:
|
| 189 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 190 |
+
return False
|
| 191 |
+
|
| 192 |
+
# FeatureProcessorOptions
|
| 193 |
+
def SplitTokensOnSelectionBoundaries(self):
|
| 194 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
|
| 195 |
+
if o != 0:
|
| 196 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 197 |
+
return False
|
| 198 |
+
|
| 199 |
+
# FeatureProcessorOptions
|
| 200 |
+
def TokenizationCodepointConfig(self, j):
|
| 201 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
|
| 202 |
+
if o != 0:
|
| 203 |
+
x = self._tab.Vector(o)
|
| 204 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 205 |
+
x = self._tab.Indirect(x)
|
| 206 |
+
from libtextclassifier3.TokenizationCodepointRange import TokenizationCodepointRange
|
| 207 |
+
obj = TokenizationCodepointRange()
|
| 208 |
+
obj.Init(self._tab.Bytes, x)
|
| 209 |
+
return obj
|
| 210 |
+
return None
|
| 211 |
+
|
| 212 |
+
# FeatureProcessorOptions
|
| 213 |
+
def TokenizationCodepointConfigLength(self):
|
| 214 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
|
| 215 |
+
if o != 0:
|
| 216 |
+
return self._tab.VectorLen(o)
|
| 217 |
+
return 0
|
| 218 |
+
|
| 219 |
+
# FeatureProcessorOptions
|
| 220 |
+
def TokenizationCodepointConfigIsNone(self):
|
| 221 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
|
| 222 |
+
return o == 0
|
| 223 |
+
|
| 224 |
+
# FeatureProcessorOptions
|
| 225 |
+
def CenterTokenSelectionMethod(self):
|
| 226 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
|
| 227 |
+
if o != 0:
|
| 228 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 229 |
+
return 0
|
| 230 |
+
|
| 231 |
+
# FeatureProcessorOptions
|
| 232 |
+
def SnapLabelSpanBoundariesToContainingTokens(self):
|
| 233 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44))
|
| 234 |
+
if o != 0:
|
| 235 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 236 |
+
return False
|
| 237 |
+
|
| 238 |
+
# FeatureProcessorOptions
|
| 239 |
+
def SupportedCodepointRanges(self, j):
|
| 240 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
|
| 241 |
+
if o != 0:
|
| 242 |
+
x = self._tab.Vector(o)
|
| 243 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 244 |
+
x = self._tab.Indirect(x)
|
| 245 |
+
from libtextclassifier3.CodepointRange import CodepointRange
|
| 246 |
+
obj = CodepointRange()
|
| 247 |
+
obj.Init(self._tab.Bytes, x)
|
| 248 |
+
return obj
|
| 249 |
+
return None
|
| 250 |
+
|
| 251 |
+
# FeatureProcessorOptions
|
| 252 |
+
def SupportedCodepointRangesLength(self):
|
| 253 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
|
| 254 |
+
if o != 0:
|
| 255 |
+
return self._tab.VectorLen(o)
|
| 256 |
+
return 0
|
| 257 |
+
|
| 258 |
+
# FeatureProcessorOptions
|
| 259 |
+
def SupportedCodepointRangesIsNone(self):
|
| 260 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
|
| 261 |
+
return o == 0
|
| 262 |
+
|
| 263 |
+
# FeatureProcessorOptions
|
| 264 |
+
def InternalTokenizerCodepointRanges(self, j):
|
| 265 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
|
| 266 |
+
if o != 0:
|
| 267 |
+
x = self._tab.Vector(o)
|
| 268 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 269 |
+
x = self._tab.Indirect(x)
|
| 270 |
+
from libtextclassifier3.CodepointRange import CodepointRange
|
| 271 |
+
obj = CodepointRange()
|
| 272 |
+
obj.Init(self._tab.Bytes, x)
|
| 273 |
+
return obj
|
| 274 |
+
return None
|
| 275 |
+
|
| 276 |
+
# FeatureProcessorOptions
|
| 277 |
+
def InternalTokenizerCodepointRangesLength(self):
|
| 278 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
|
| 279 |
+
if o != 0:
|
| 280 |
+
return self._tab.VectorLen(o)
|
| 281 |
+
return 0
|
| 282 |
+
|
| 283 |
+
# FeatureProcessorOptions
|
| 284 |
+
def InternalTokenizerCodepointRangesIsNone(self):
|
| 285 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
|
| 286 |
+
return o == 0
|
| 287 |
+
|
| 288 |
+
# FeatureProcessorOptions
|
| 289 |
+
def MinSupportedCodepointRatio(self):
|
| 290 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50))
|
| 291 |
+
if o != 0:
|
| 292 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 293 |
+
return 0.0
|
| 294 |
+
|
| 295 |
+
# FeatureProcessorOptions
|
| 296 |
+
def FeatureVersion(self):
|
| 297 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52))
|
| 298 |
+
if o != 0:
|
| 299 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 300 |
+
return 0
|
| 301 |
+
|
| 302 |
+
# FeatureProcessorOptions
|
| 303 |
+
def TokenizationType(self):
|
| 304 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(54))
|
| 305 |
+
if o != 0:
|
| 306 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 307 |
+
return 1
|
| 308 |
+
|
| 309 |
+
# FeatureProcessorOptions
|
| 310 |
+
def IcuPreserveWhitespaceTokens(self):
|
| 311 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(56))
|
| 312 |
+
if o != 0:
|
| 313 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 314 |
+
return False
|
| 315 |
+
|
| 316 |
+
# FeatureProcessorOptions
|
| 317 |
+
def IgnoredSpanBoundaryCodepoints(self, j):
|
| 318 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58))
|
| 319 |
+
if o != 0:
|
| 320 |
+
a = self._tab.Vector(o)
|
| 321 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 322 |
+
return 0
|
| 323 |
+
|
| 324 |
+
# FeatureProcessorOptions
|
| 325 |
+
def IgnoredSpanBoundaryCodepointsAsNumpy(self):
|
| 326 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58))
|
| 327 |
+
if o != 0:
|
| 328 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 329 |
+
return 0
|
| 330 |
+
|
| 331 |
+
# FeatureProcessorOptions
|
| 332 |
+
def IgnoredSpanBoundaryCodepointsLength(self):
|
| 333 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58))
|
| 334 |
+
if o != 0:
|
| 335 |
+
return self._tab.VectorLen(o)
|
| 336 |
+
return 0
|
| 337 |
+
|
| 338 |
+
# FeatureProcessorOptions
|
| 339 |
+
def IgnoredSpanBoundaryCodepointsIsNone(self):
|
| 340 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58))
|
| 341 |
+
return o == 0
|
| 342 |
+
|
| 343 |
+
# FeatureProcessorOptions
|
| 344 |
+
def BoundsSensitiveFeatures(self):
|
| 345 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60))
|
| 346 |
+
if o != 0:
|
| 347 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 348 |
+
from libtextclassifier3.FeatureProcessorOptions_.BoundsSensitiveFeatures import BoundsSensitiveFeatures
|
| 349 |
+
obj = BoundsSensitiveFeatures()
|
| 350 |
+
obj.Init(self._tab.Bytes, x)
|
| 351 |
+
return obj
|
| 352 |
+
return None
|
| 353 |
+
|
| 354 |
+
# FeatureProcessorOptions
|
| 355 |
+
def AllowedChargrams(self, j):
|
| 356 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62))
|
| 357 |
+
if o != 0:
|
| 358 |
+
a = self._tab.Vector(o)
|
| 359 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 360 |
+
return ""
|
| 361 |
+
|
| 362 |
+
# FeatureProcessorOptions
|
| 363 |
+
def AllowedChargramsLength(self):
|
| 364 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62))
|
| 365 |
+
if o != 0:
|
| 366 |
+
return self._tab.VectorLen(o)
|
| 367 |
+
return 0
|
| 368 |
+
|
| 369 |
+
# FeatureProcessorOptions
|
| 370 |
+
def AllowedChargramsIsNone(self):
|
| 371 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62))
|
| 372 |
+
return o == 0
|
| 373 |
+
|
| 374 |
+
# FeatureProcessorOptions
|
| 375 |
+
def TokenizeOnScriptChange(self):
|
| 376 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64))
|
| 377 |
+
if o != 0:
|
| 378 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 379 |
+
return False
|
| 380 |
+
|
| 381 |
+
# FeatureProcessorOptions
|
| 382 |
+
def UsePipeCharacterForNewline(self):
|
| 383 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(66))
|
| 384 |
+
if o != 0:
|
| 385 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 386 |
+
return True
|
| 387 |
+
|
| 388 |
+
def FeatureProcessorOptionsStart(builder): builder.StartObject(32)
|
| 389 |
+
def FeatureProcessorOptionsAddNumBuckets(builder, numBuckets): builder.PrependInt32Slot(0, numBuckets, -1)
|
| 390 |
+
def FeatureProcessorOptionsAddEmbeddingSize(builder, embeddingSize): builder.PrependInt32Slot(1, embeddingSize, -1)
|
| 391 |
+
def FeatureProcessorOptionsAddEmbeddingQuantizationBits(builder, embeddingQuantizationBits): builder.PrependInt32Slot(2, embeddingQuantizationBits, 8)
|
| 392 |
+
def FeatureProcessorOptionsAddContextSize(builder, contextSize): builder.PrependInt32Slot(3, contextSize, -1)
|
| 393 |
+
def FeatureProcessorOptionsAddMaxSelectionSpan(builder, maxSelectionSpan): builder.PrependInt32Slot(4, maxSelectionSpan, -1)
|
| 394 |
+
def FeatureProcessorOptionsAddChargramOrders(builder, chargramOrders): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(chargramOrders), 0)
|
| 395 |
+
def FeatureProcessorOptionsStartChargramOrdersVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 396 |
+
def FeatureProcessorOptionsAddMaxWordLength(builder, maxWordLength): builder.PrependInt32Slot(6, maxWordLength, 20)
|
| 397 |
+
def FeatureProcessorOptionsAddUnicodeAwareFeatures(builder, unicodeAwareFeatures): builder.PrependBoolSlot(7, unicodeAwareFeatures, 0)
|
| 398 |
+
def FeatureProcessorOptionsAddExtractCaseFeature(builder, extractCaseFeature): builder.PrependBoolSlot(8, extractCaseFeature, 0)
|
| 399 |
+
def FeatureProcessorOptionsAddExtractSelectionMaskFeature(builder, extractSelectionMaskFeature): builder.PrependBoolSlot(9, extractSelectionMaskFeature, 0)
|
| 400 |
+
def FeatureProcessorOptionsAddRegexpFeature(builder, regexpFeature): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(regexpFeature), 0)
|
| 401 |
+
def FeatureProcessorOptionsStartRegexpFeatureVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 402 |
+
def FeatureProcessorOptionsAddRemapDigits(builder, remapDigits): builder.PrependBoolSlot(11, remapDigits, 0)
|
| 403 |
+
def FeatureProcessorOptionsAddLowercaseTokens(builder, lowercaseTokens): builder.PrependBoolSlot(12, lowercaseTokens, 0)
|
| 404 |
+
def FeatureProcessorOptionsAddSelectionReducedOutputSpace(builder, selectionReducedOutputSpace): builder.PrependBoolSlot(13, selectionReducedOutputSpace, 1)
|
| 405 |
+
def FeatureProcessorOptionsAddCollections(builder, collections): builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(collections), 0)
|
| 406 |
+
def FeatureProcessorOptionsStartCollectionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 407 |
+
def FeatureProcessorOptionsAddDefaultCollection(builder, defaultCollection): builder.PrependInt32Slot(15, defaultCollection, -1)
|
| 408 |
+
def FeatureProcessorOptionsAddOnlyUseLineWithClick(builder, onlyUseLineWithClick): builder.PrependBoolSlot(16, onlyUseLineWithClick, 0)
|
| 409 |
+
def FeatureProcessorOptionsAddSplitTokensOnSelectionBoundaries(builder, splitTokensOnSelectionBoundaries): builder.PrependBoolSlot(17, splitTokensOnSelectionBoundaries, 0)
|
| 410 |
+
def FeatureProcessorOptionsAddTokenizationCodepointConfig(builder, tokenizationCodepointConfig): builder.PrependUOffsetTRelativeSlot(18, flatbuffers.number_types.UOffsetTFlags.py_type(tokenizationCodepointConfig), 0)
|
| 411 |
+
def FeatureProcessorOptionsStartTokenizationCodepointConfigVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 412 |
+
def FeatureProcessorOptionsAddCenterTokenSelectionMethod(builder, centerTokenSelectionMethod): builder.PrependInt32Slot(19, centerTokenSelectionMethod, 0)
|
| 413 |
+
def FeatureProcessorOptionsAddSnapLabelSpanBoundariesToContainingTokens(builder, snapLabelSpanBoundariesToContainingTokens): builder.PrependBoolSlot(20, snapLabelSpanBoundariesToContainingTokens, 0)
|
| 414 |
+
def FeatureProcessorOptionsAddSupportedCodepointRanges(builder, supportedCodepointRanges): builder.PrependUOffsetTRelativeSlot(21, flatbuffers.number_types.UOffsetTFlags.py_type(supportedCodepointRanges), 0)
|
| 415 |
+
def FeatureProcessorOptionsStartSupportedCodepointRangesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 416 |
+
def FeatureProcessorOptionsAddInternalTokenizerCodepointRanges(builder, internalTokenizerCodepointRanges): builder.PrependUOffsetTRelativeSlot(22, flatbuffers.number_types.UOffsetTFlags.py_type(internalTokenizerCodepointRanges), 0)
|
| 417 |
+
def FeatureProcessorOptionsStartInternalTokenizerCodepointRangesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 418 |
+
def FeatureProcessorOptionsAddMinSupportedCodepointRatio(builder, minSupportedCodepointRatio): builder.PrependFloat32Slot(23, minSupportedCodepointRatio, 0.0)
|
| 419 |
+
def FeatureProcessorOptionsAddFeatureVersion(builder, featureVersion): builder.PrependInt32Slot(24, featureVersion, 0)
|
| 420 |
+
def FeatureProcessorOptionsAddTokenizationType(builder, tokenizationType): builder.PrependInt32Slot(25, tokenizationType, 1)
|
| 421 |
+
def FeatureProcessorOptionsAddIcuPreserveWhitespaceTokens(builder, icuPreserveWhitespaceTokens): builder.PrependBoolSlot(26, icuPreserveWhitespaceTokens, 0)
|
| 422 |
+
def FeatureProcessorOptionsAddIgnoredSpanBoundaryCodepoints(builder, ignoredSpanBoundaryCodepoints): builder.PrependUOffsetTRelativeSlot(27, flatbuffers.number_types.UOffsetTFlags.py_type(ignoredSpanBoundaryCodepoints), 0)
|
| 423 |
+
def FeatureProcessorOptionsStartIgnoredSpanBoundaryCodepointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 424 |
+
def FeatureProcessorOptionsAddBoundsSensitiveFeatures(builder, boundsSensitiveFeatures): builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(boundsSensitiveFeatures), 0)
|
| 425 |
+
def FeatureProcessorOptionsAddAllowedChargrams(builder, allowedChargrams): builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(allowedChargrams), 0)
|
| 426 |
+
def FeatureProcessorOptionsStartAllowedChargramsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 427 |
+
def FeatureProcessorOptionsAddTokenizeOnScriptChange(builder, tokenizeOnScriptChange): builder.PrependBoolSlot(30, tokenizeOnScriptChange, 0)
|
| 428 |
+
def FeatureProcessorOptionsAddUsePipeCharacterForNewline(builder, usePipeCharacterForNewline): builder.PrependBoolSlot(31, usePipeCharacterForNewline, 1)
|
| 429 |
+
def FeatureProcessorOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/FeatureProcessorOptions_/BoundsSensitiveFeatures.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: FeatureProcessorOptions_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class BoundsSensitiveFeatures(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsBoundsSensitiveFeatures(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = BoundsSensitiveFeatures()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def BoundsSensitiveFeaturesBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# BoundsSensitiveFeatures
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# BoundsSensitiveFeatures
|
| 28 |
+
def Enabled(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# BoundsSensitiveFeatures
|
| 35 |
+
def NumTokensBefore(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return 0
|
| 40 |
+
|
| 41 |
+
# BoundsSensitiveFeatures
|
| 42 |
+
def NumTokensInsideLeft(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0
|
| 47 |
+
|
| 48 |
+
# BoundsSensitiveFeatures
|
| 49 |
+
def NumTokensInsideRight(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 53 |
+
return 0
|
| 54 |
+
|
| 55 |
+
# BoundsSensitiveFeatures
|
| 56 |
+
def NumTokensAfter(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 58 |
+
if o != 0:
|
| 59 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 60 |
+
return 0
|
| 61 |
+
|
| 62 |
+
# BoundsSensitiveFeatures
|
| 63 |
+
def IncludeInsideBag(self):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 65 |
+
if o != 0:
|
| 66 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 67 |
+
return False
|
| 68 |
+
|
| 69 |
+
# BoundsSensitiveFeatures
|
| 70 |
+
def IncludeInsideLength(self):
|
| 71 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 72 |
+
if o != 0:
|
| 73 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 74 |
+
return False
|
| 75 |
+
|
| 76 |
+
# BoundsSensitiveFeatures
|
| 77 |
+
def ScoreSingleTokenSpansAsZero(self):
|
| 78 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 79 |
+
if o != 0:
|
| 80 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 81 |
+
return False
|
| 82 |
+
|
| 83 |
+
def BoundsSensitiveFeaturesStart(builder): builder.StartObject(8)
|
| 84 |
+
def BoundsSensitiveFeaturesAddEnabled(builder, enabled): builder.PrependBoolSlot(0, enabled, 0)
|
| 85 |
+
def BoundsSensitiveFeaturesAddNumTokensBefore(builder, numTokensBefore): builder.PrependInt32Slot(1, numTokensBefore, 0)
|
| 86 |
+
def BoundsSensitiveFeaturesAddNumTokensInsideLeft(builder, numTokensInsideLeft): builder.PrependInt32Slot(2, numTokensInsideLeft, 0)
|
| 87 |
+
def BoundsSensitiveFeaturesAddNumTokensInsideRight(builder, numTokensInsideRight): builder.PrependInt32Slot(3, numTokensInsideRight, 0)
|
| 88 |
+
def BoundsSensitiveFeaturesAddNumTokensAfter(builder, numTokensAfter): builder.PrependInt32Slot(4, numTokensAfter, 0)
|
| 89 |
+
def BoundsSensitiveFeaturesAddIncludeInsideBag(builder, includeInsideBag): builder.PrependBoolSlot(5, includeInsideBag, 0)
|
| 90 |
+
def BoundsSensitiveFeaturesAddIncludeInsideLength(builder, includeInsideLength): builder.PrependBoolSlot(6, includeInsideLength, 0)
|
| 91 |
+
def BoundsSensitiveFeaturesAddScoreSingleTokenSpansAsZero(builder, scoreSingleTokenSpansAsZero): builder.PrependBoolSlot(7, scoreSingleTokenSpansAsZero, 0)
|
| 92 |
+
def BoundsSensitiveFeaturesEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/FeatureProcessorOptions_/CenterTokenSelectionMethod.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: FeatureProcessorOptions_
|
| 4 |
+
|
| 5 |
+
class CenterTokenSelectionMethod(object):
|
| 6 |
+
DEFAULT_CENTER_TOKEN_METHOD = 0
|
| 7 |
+
CENTER_TOKEN_FROM_CLICK = 1
|
| 8 |
+
CENTER_TOKEN_MIDDLE_OF_SELECTION = 2
|
| 9 |
+
|
19/libtextclassifier3/FeatureProcessorOptions_/__init__.py
ADDED
|
File without changes
|
19/libtextclassifier3/GrammarModel.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class GrammarModel(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsGrammarModel(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = GrammarModel()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def GrammarModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# GrammarModel
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# GrammarModel
|
| 28 |
+
def Rules(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 32 |
+
from libtextclassifier3.grammar.RulesSet import RulesSet
|
| 33 |
+
obj = RulesSet()
|
| 34 |
+
obj.Init(self._tab.Bytes, x)
|
| 35 |
+
return obj
|
| 36 |
+
return None
|
| 37 |
+
|
| 38 |
+
# GrammarModel
|
| 39 |
+
def RuleClassificationResult(self, j):
|
| 40 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 41 |
+
if o != 0:
|
| 42 |
+
x = self._tab.Vector(o)
|
| 43 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 44 |
+
x = self._tab.Indirect(x)
|
| 45 |
+
from libtextclassifier3.GrammarModel_.RuleClassificationResult import RuleClassificationResult
|
| 46 |
+
obj = RuleClassificationResult()
|
| 47 |
+
obj.Init(self._tab.Bytes, x)
|
| 48 |
+
return obj
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
# GrammarModel
|
| 52 |
+
def RuleClassificationResultLength(self):
|
| 53 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 54 |
+
if o != 0:
|
| 55 |
+
return self._tab.VectorLen(o)
|
| 56 |
+
return 0
|
| 57 |
+
|
| 58 |
+
# GrammarModel
|
| 59 |
+
def RuleClassificationResultIsNone(self):
|
| 60 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 61 |
+
return o == 0
|
| 62 |
+
|
| 63 |
+
# GrammarModel
|
| 64 |
+
def ContextLeftNumTokens(self):
|
| 65 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 66 |
+
if o != 0:
|
| 67 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 68 |
+
return 0
|
| 69 |
+
|
| 70 |
+
# GrammarModel
|
| 71 |
+
def ContextRightNumTokens(self):
|
| 72 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 73 |
+
if o != 0:
|
| 74 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 75 |
+
return 0
|
| 76 |
+
|
| 77 |
+
# GrammarModel
|
| 78 |
+
def TokenizerOptions(self):
|
| 79 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 80 |
+
if o != 0:
|
| 81 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 82 |
+
from libtextclassifier3.GrammarTokenizerOptions import GrammarTokenizerOptions
|
| 83 |
+
obj = GrammarTokenizerOptions()
|
| 84 |
+
obj.Init(self._tab.Bytes, x)
|
| 85 |
+
return obj
|
| 86 |
+
return None
|
| 87 |
+
|
| 88 |
+
def GrammarModelStart(builder): builder.StartObject(5)
|
| 89 |
+
def GrammarModelAddRules(builder, rules): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(rules), 0)
|
| 90 |
+
def GrammarModelAddRuleClassificationResult(builder, ruleClassificationResult): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(ruleClassificationResult), 0)
|
| 91 |
+
def GrammarModelStartRuleClassificationResultVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 92 |
+
def GrammarModelAddContextLeftNumTokens(builder, contextLeftNumTokens): builder.PrependInt32Slot(2, contextLeftNumTokens, 0)
|
| 93 |
+
def GrammarModelAddContextRightNumTokens(builder, contextRightNumTokens): builder.PrependInt32Slot(3, contextRightNumTokens, 0)
|
| 94 |
+
def GrammarModelAddTokenizerOptions(builder, tokenizerOptions): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(tokenizerOptions), 0)
|
| 95 |
+
def GrammarModelEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/GrammarModel_/RuleClassificationResult.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: GrammarModel_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class RuleClassificationResult(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsRuleClassificationResult(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = RuleClassificationResult()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def RuleClassificationResultBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# RuleClassificationResult
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# RuleClassificationResult
|
| 28 |
+
def CollectionName(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# RuleClassificationResult
|
| 35 |
+
def TargetClassificationScore(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 39 |
+
return 1.0
|
| 40 |
+
|
| 41 |
+
# RuleClassificationResult
|
| 42 |
+
def PriorityScore(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0.0
|
| 47 |
+
|
| 48 |
+
# RuleClassificationResult
|
| 49 |
+
def CapturingGroup(self, j):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
x = self._tab.Vector(o)
|
| 53 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 54 |
+
x = self._tab.Indirect(x)
|
| 55 |
+
from libtextclassifier3.CapturingGroup import CapturingGroup
|
| 56 |
+
obj = CapturingGroup()
|
| 57 |
+
obj.Init(self._tab.Bytes, x)
|
| 58 |
+
return obj
|
| 59 |
+
return None
|
| 60 |
+
|
| 61 |
+
# RuleClassificationResult
|
| 62 |
+
def CapturingGroupLength(self):
|
| 63 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 64 |
+
if o != 0:
|
| 65 |
+
return self._tab.VectorLen(o)
|
| 66 |
+
return 0
|
| 67 |
+
|
| 68 |
+
# RuleClassificationResult
|
| 69 |
+
def CapturingGroupIsNone(self):
|
| 70 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 71 |
+
return o == 0
|
| 72 |
+
|
| 73 |
+
# RuleClassificationResult
|
| 74 |
+
def SerializedEntityData(self):
|
| 75 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 76 |
+
if o != 0:
|
| 77 |
+
return self._tab.String(o + self._tab.Pos)
|
| 78 |
+
return None
|
| 79 |
+
|
| 80 |
+
# RuleClassificationResult
|
| 81 |
+
def EnabledModes(self):
|
| 82 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 83 |
+
if o != 0:
|
| 84 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 85 |
+
return 7
|
| 86 |
+
|
| 87 |
+
# RuleClassificationResult
|
| 88 |
+
def EntityData(self):
|
| 89 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 90 |
+
if o != 0:
|
| 91 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 92 |
+
from libtextclassifier3.EntityData import EntityData
|
| 93 |
+
obj = EntityData()
|
| 94 |
+
obj.Init(self._tab.Bytes, x)
|
| 95 |
+
return obj
|
| 96 |
+
return None
|
| 97 |
+
|
| 98 |
+
def RuleClassificationResultStart(builder): builder.StartObject(7)
|
| 99 |
+
def RuleClassificationResultAddCollectionName(builder, collectionName): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(collectionName), 0)
|
| 100 |
+
def RuleClassificationResultAddTargetClassificationScore(builder, targetClassificationScore): builder.PrependFloat32Slot(1, targetClassificationScore, 1.0)
|
| 101 |
+
def RuleClassificationResultAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(2, priorityScore, 0.0)
|
| 102 |
+
def RuleClassificationResultAddCapturingGroup(builder, capturingGroup): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(capturingGroup), 0)
|
| 103 |
+
def RuleClassificationResultStartCapturingGroupVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 104 |
+
def RuleClassificationResultAddSerializedEntityData(builder, serializedEntityData): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(serializedEntityData), 0)
|
| 105 |
+
def RuleClassificationResultAddEnabledModes(builder, enabledModes): builder.PrependInt32Slot(5, enabledModes, 7)
|
| 106 |
+
def RuleClassificationResultAddEntityData(builder, entityData): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(entityData), 0)
|
| 107 |
+
def RuleClassificationResultEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/GrammarTokenizerOptions.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class GrammarTokenizerOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsGrammarTokenizerOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = GrammarTokenizerOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def GrammarTokenizerOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# GrammarTokenizerOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# GrammarTokenizerOptions
|
| 28 |
+
def TokenizationType(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 32 |
+
return 2
|
| 33 |
+
|
| 34 |
+
# GrammarTokenizerOptions
|
| 35 |
+
def IcuPreserveWhitespaceTokens(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 39 |
+
return False
|
| 40 |
+
|
| 41 |
+
# GrammarTokenizerOptions
|
| 42 |
+
def TokenizationCodepointConfig(self, j):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
x = self._tab.Vector(o)
|
| 46 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 47 |
+
x = self._tab.Indirect(x)
|
| 48 |
+
from libtextclassifier3.TokenizationCodepointRange import TokenizationCodepointRange
|
| 49 |
+
obj = TokenizationCodepointRange()
|
| 50 |
+
obj.Init(self._tab.Bytes, x)
|
| 51 |
+
return obj
|
| 52 |
+
return None
|
| 53 |
+
|
| 54 |
+
# GrammarTokenizerOptions
|
| 55 |
+
def TokenizationCodepointConfigLength(self):
|
| 56 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 57 |
+
if o != 0:
|
| 58 |
+
return self._tab.VectorLen(o)
|
| 59 |
+
return 0
|
| 60 |
+
|
| 61 |
+
# GrammarTokenizerOptions
|
| 62 |
+
def TokenizationCodepointConfigIsNone(self):
|
| 63 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 64 |
+
return o == 0
|
| 65 |
+
|
| 66 |
+
# GrammarTokenizerOptions
|
| 67 |
+
def InternalTokenizerCodepointRanges(self, j):
|
| 68 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 69 |
+
if o != 0:
|
| 70 |
+
x = self._tab.Vector(o)
|
| 71 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 72 |
+
x = self._tab.Indirect(x)
|
| 73 |
+
from libtextclassifier3.CodepointRange import CodepointRange
|
| 74 |
+
obj = CodepointRange()
|
| 75 |
+
obj.Init(self._tab.Bytes, x)
|
| 76 |
+
return obj
|
| 77 |
+
return None
|
| 78 |
+
|
| 79 |
+
# GrammarTokenizerOptions
|
| 80 |
+
def InternalTokenizerCodepointRangesLength(self):
|
| 81 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 82 |
+
if o != 0:
|
| 83 |
+
return self._tab.VectorLen(o)
|
| 84 |
+
return 0
|
| 85 |
+
|
| 86 |
+
# GrammarTokenizerOptions
|
| 87 |
+
def InternalTokenizerCodepointRangesIsNone(self):
|
| 88 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 89 |
+
return o == 0
|
| 90 |
+
|
| 91 |
+
# GrammarTokenizerOptions
|
| 92 |
+
def TokenizeOnScriptChange(self):
|
| 93 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 94 |
+
if o != 0:
|
| 95 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 96 |
+
return False
|
| 97 |
+
|
| 98 |
+
def GrammarTokenizerOptionsStart(builder): builder.StartObject(5)
|
| 99 |
+
def GrammarTokenizerOptionsAddTokenizationType(builder, tokenizationType): builder.PrependInt32Slot(0, tokenizationType, 2)
|
| 100 |
+
def GrammarTokenizerOptionsAddIcuPreserveWhitespaceTokens(builder, icuPreserveWhitespaceTokens): builder.PrependBoolSlot(1, icuPreserveWhitespaceTokens, 0)
|
| 101 |
+
def GrammarTokenizerOptionsAddTokenizationCodepointConfig(builder, tokenizationCodepointConfig): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(tokenizationCodepointConfig), 0)
|
| 102 |
+
def GrammarTokenizerOptionsStartTokenizationCodepointConfigVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 103 |
+
def GrammarTokenizerOptionsAddInternalTokenizerCodepointRanges(builder, internalTokenizerCodepointRanges): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(internalTokenizerCodepointRanges), 0)
|
| 104 |
+
def GrammarTokenizerOptionsStartInternalTokenizerCodepointRangesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 105 |
+
def GrammarTokenizerOptionsAddTokenizeOnScriptChange(builder, tokenizeOnScriptChange): builder.PrependBoolSlot(4, tokenizeOnScriptChange, 0)
|
| 106 |
+
def GrammarTokenizerOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/ModeFlag.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
class ModeFlag(object):
|
| 6 |
+
NONE = 0
|
| 7 |
+
ANNOTATION = 1
|
| 8 |
+
CLASSIFICATION = 2
|
| 9 |
+
ANNOTATION_AND_CLASSIFICATION = 3
|
| 10 |
+
SELECTION = 4
|
| 11 |
+
ANNOTATION_AND_SELECTION = 5
|
| 12 |
+
CLASSIFICATION_AND_SELECTION = 6
|
| 13 |
+
ALL = 7
|
| 14 |
+
|
19/libtextclassifier3/Model.py
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class Model(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsModel(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = Model()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def ModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# Model
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# Model
|
| 28 |
+
def Locales(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# Model
|
| 35 |
+
def Version(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return 0
|
| 40 |
+
|
| 41 |
+
# Model
|
| 42 |
+
def Name(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.String(o + self._tab.Pos)
|
| 46 |
+
return None
|
| 47 |
+
|
| 48 |
+
# Model
|
| 49 |
+
def SelectionFeatureOptions(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 53 |
+
from libtextclassifier3.FeatureProcessorOptions import FeatureProcessorOptions
|
| 54 |
+
obj = FeatureProcessorOptions()
|
| 55 |
+
obj.Init(self._tab.Bytes, x)
|
| 56 |
+
return obj
|
| 57 |
+
return None
|
| 58 |
+
|
| 59 |
+
# Model
|
| 60 |
+
def ClassificationFeatureOptions(self):
|
| 61 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 62 |
+
if o != 0:
|
| 63 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 64 |
+
from libtextclassifier3.FeatureProcessorOptions import FeatureProcessorOptions
|
| 65 |
+
obj = FeatureProcessorOptions()
|
| 66 |
+
obj.Init(self._tab.Bytes, x)
|
| 67 |
+
return obj
|
| 68 |
+
return None
|
| 69 |
+
|
| 70 |
+
# Model
|
| 71 |
+
def SelectionModel(self, j):
|
| 72 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 73 |
+
if o != 0:
|
| 74 |
+
a = self._tab.Vector(o)
|
| 75 |
+
return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
| 76 |
+
return 0
|
| 77 |
+
|
| 78 |
+
# Model
|
| 79 |
+
def SelectionModelAsNumpy(self):
|
| 80 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 81 |
+
if o != 0:
|
| 82 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
|
| 83 |
+
return 0
|
| 84 |
+
|
| 85 |
+
# Model
|
| 86 |
+
def SelectionModelLength(self):
|
| 87 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 88 |
+
if o != 0:
|
| 89 |
+
return self._tab.VectorLen(o)
|
| 90 |
+
return 0
|
| 91 |
+
|
| 92 |
+
# Model
|
| 93 |
+
def SelectionModelIsNone(self):
|
| 94 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 95 |
+
return o == 0
|
| 96 |
+
|
| 97 |
+
# Model
|
| 98 |
+
def ClassificationModel(self, j):
|
| 99 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 100 |
+
if o != 0:
|
| 101 |
+
a = self._tab.Vector(o)
|
| 102 |
+
return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
| 103 |
+
return 0
|
| 104 |
+
|
| 105 |
+
# Model
|
| 106 |
+
def ClassificationModelAsNumpy(self):
|
| 107 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 108 |
+
if o != 0:
|
| 109 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
|
| 110 |
+
return 0
|
| 111 |
+
|
| 112 |
+
# Model
|
| 113 |
+
def ClassificationModelLength(self):
|
| 114 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 115 |
+
if o != 0:
|
| 116 |
+
return self._tab.VectorLen(o)
|
| 117 |
+
return 0
|
| 118 |
+
|
| 119 |
+
# Model
|
| 120 |
+
def ClassificationModelIsNone(self):
|
| 121 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 122 |
+
return o == 0
|
| 123 |
+
|
| 124 |
+
# Model
|
| 125 |
+
def EmbeddingModel(self, j):
|
| 126 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 127 |
+
if o != 0:
|
| 128 |
+
a = self._tab.Vector(o)
|
| 129 |
+
return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
| 130 |
+
return 0
|
| 131 |
+
|
| 132 |
+
# Model
|
| 133 |
+
def EmbeddingModelAsNumpy(self):
|
| 134 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 135 |
+
if o != 0:
|
| 136 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
|
| 137 |
+
return 0
|
| 138 |
+
|
| 139 |
+
# Model
|
| 140 |
+
def EmbeddingModelLength(self):
|
| 141 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 142 |
+
if o != 0:
|
| 143 |
+
return self._tab.VectorLen(o)
|
| 144 |
+
return 0
|
| 145 |
+
|
| 146 |
+
# Model
|
| 147 |
+
def EmbeddingModelIsNone(self):
|
| 148 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 149 |
+
return o == 0
|
| 150 |
+
|
| 151 |
+
# Model
|
| 152 |
+
def SelectionOptions(self):
|
| 153 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 154 |
+
if o != 0:
|
| 155 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 156 |
+
from libtextclassifier3.SelectionModelOptions import SelectionModelOptions
|
| 157 |
+
obj = SelectionModelOptions()
|
| 158 |
+
obj.Init(self._tab.Bytes, x)
|
| 159 |
+
return obj
|
| 160 |
+
return None
|
| 161 |
+
|
| 162 |
+
# Model
|
| 163 |
+
def ClassificationOptions(self):
|
| 164 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 165 |
+
if o != 0:
|
| 166 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 167 |
+
from libtextclassifier3.ClassificationModelOptions import ClassificationModelOptions
|
| 168 |
+
obj = ClassificationModelOptions()
|
| 169 |
+
obj.Init(self._tab.Bytes, x)
|
| 170 |
+
return obj
|
| 171 |
+
return None
|
| 172 |
+
|
| 173 |
+
# Model
|
| 174 |
+
def RegexModel(self):
|
| 175 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 176 |
+
if o != 0:
|
| 177 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 178 |
+
from libtextclassifier3.RegexModel import RegexModel
|
| 179 |
+
obj = RegexModel()
|
| 180 |
+
obj.Init(self._tab.Bytes, x)
|
| 181 |
+
return obj
|
| 182 |
+
return None
|
| 183 |
+
|
| 184 |
+
# Model
|
| 185 |
+
def DatetimeModel(self):
|
| 186 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 187 |
+
if o != 0:
|
| 188 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 189 |
+
from libtextclassifier3.DatetimeModel import DatetimeModel
|
| 190 |
+
obj = DatetimeModel()
|
| 191 |
+
obj.Init(self._tab.Bytes, x)
|
| 192 |
+
return obj
|
| 193 |
+
return None
|
| 194 |
+
|
| 195 |
+
# Model
|
| 196 |
+
def TriggeringOptions(self):
|
| 197 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 198 |
+
if o != 0:
|
| 199 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 200 |
+
from libtextclassifier3.ModelTriggeringOptions import ModelTriggeringOptions
|
| 201 |
+
obj = ModelTriggeringOptions()
|
| 202 |
+
obj.Init(self._tab.Bytes, x)
|
| 203 |
+
return obj
|
| 204 |
+
return None
|
| 205 |
+
|
| 206 |
+
# Model
|
| 207 |
+
def EnabledModes(self):
|
| 208 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
|
| 209 |
+
if o != 0:
|
| 210 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 211 |
+
return 7
|
| 212 |
+
|
| 213 |
+
# Model
|
| 214 |
+
def SnapWhitespaceSelections(self):
|
| 215 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
|
| 216 |
+
if o != 0:
|
| 217 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 218 |
+
return True
|
| 219 |
+
|
| 220 |
+
# Model
|
| 221 |
+
def OutputOptions(self):
|
| 222 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
|
| 223 |
+
if o != 0:
|
| 224 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 225 |
+
from libtextclassifier3.OutputOptions import OutputOptions
|
| 226 |
+
obj = OutputOptions()
|
| 227 |
+
obj.Init(self._tab.Bytes, x)
|
| 228 |
+
return obj
|
| 229 |
+
return None
|
| 230 |
+
|
| 231 |
+
# Model
|
| 232 |
+
def AndroidIntentOptions(self):
|
| 233 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
|
| 234 |
+
if o != 0:
|
| 235 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 236 |
+
from libtextclassifier3.AndroidIntentFactoryOptions import AndroidIntentFactoryOptions
|
| 237 |
+
obj = AndroidIntentFactoryOptions()
|
| 238 |
+
obj.Init(self._tab.Bytes, x)
|
| 239 |
+
return obj
|
| 240 |
+
return None
|
| 241 |
+
|
| 242 |
+
# Model
|
| 243 |
+
def IntentOptions(self):
|
| 244 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
|
| 245 |
+
if o != 0:
|
| 246 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 247 |
+
from libtextclassifier3.IntentFactoryModel import IntentFactoryModel
|
| 248 |
+
obj = IntentFactoryModel()
|
| 249 |
+
obj.Init(self._tab.Bytes, x)
|
| 250 |
+
return obj
|
| 251 |
+
return None
|
| 252 |
+
|
| 253 |
+
# Model
|
| 254 |
+
def Resources(self):
|
| 255 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
|
| 256 |
+
if o != 0:
|
| 257 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 258 |
+
from libtextclassifier3.ResourcePool import ResourcePool
|
| 259 |
+
obj = ResourcePool()
|
| 260 |
+
obj.Init(self._tab.Bytes, x)
|
| 261 |
+
return obj
|
| 262 |
+
return None
|
| 263 |
+
|
| 264 |
+
# Model
|
| 265 |
+
def EntityDataSchema(self, j):
|
| 266 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
|
| 267 |
+
if o != 0:
|
| 268 |
+
a = self._tab.Vector(o)
|
| 269 |
+
return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
| 270 |
+
return 0
|
| 271 |
+
|
| 272 |
+
# Model
|
| 273 |
+
def EntityDataSchemaAsNumpy(self):
|
| 274 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
|
| 275 |
+
if o != 0:
|
| 276 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
|
| 277 |
+
return 0
|
| 278 |
+
|
| 279 |
+
# Model
|
| 280 |
+
def EntityDataSchemaLength(self):
|
| 281 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
|
| 282 |
+
if o != 0:
|
| 283 |
+
return self._tab.VectorLen(o)
|
| 284 |
+
return 0
|
| 285 |
+
|
| 286 |
+
# Model
|
| 287 |
+
def EntityDataSchemaIsNone(self):
|
| 288 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
|
| 289 |
+
return o == 0
|
| 290 |
+
|
| 291 |
+
# Model
|
| 292 |
+
def NumberAnnotatorOptions(self):
|
| 293 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44))
|
| 294 |
+
if o != 0:
|
| 295 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 296 |
+
from libtextclassifier3.NumberAnnotatorOptions import NumberAnnotatorOptions
|
| 297 |
+
obj = NumberAnnotatorOptions()
|
| 298 |
+
obj.Init(self._tab.Bytes, x)
|
| 299 |
+
return obj
|
| 300 |
+
return None
|
| 301 |
+
|
| 302 |
+
# Model
|
| 303 |
+
def DurationAnnotatorOptions(self):
|
| 304 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
|
| 305 |
+
if o != 0:
|
| 306 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 307 |
+
from libtextclassifier3.DurationAnnotatorOptions import DurationAnnotatorOptions
|
| 308 |
+
obj = DurationAnnotatorOptions()
|
| 309 |
+
obj.Init(self._tab.Bytes, x)
|
| 310 |
+
return obj
|
| 311 |
+
return None
|
| 312 |
+
|
| 313 |
+
# Model
|
| 314 |
+
def TriggeringLocales(self):
|
| 315 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
|
| 316 |
+
if o != 0:
|
| 317 |
+
return self._tab.String(o + self._tab.Pos)
|
| 318 |
+
return None
|
| 319 |
+
|
| 320 |
+
# Model
|
| 321 |
+
def EmbeddingPruningMask(self):
|
| 322 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50))
|
| 323 |
+
if o != 0:
|
| 324 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 325 |
+
from libtextclassifier3.Model_.EmbeddingPruningMask import EmbeddingPruningMask
|
| 326 |
+
obj = EmbeddingPruningMask()
|
| 327 |
+
obj.Init(self._tab.Bytes, x)
|
| 328 |
+
return obj
|
| 329 |
+
return None
|
| 330 |
+
|
| 331 |
+
# Model
|
| 332 |
+
def ContactAnnotatorOptions(self):
|
| 333 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(54))
|
| 334 |
+
if o != 0:
|
| 335 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 336 |
+
from libtextclassifier3.ContactAnnotatorOptions import ContactAnnotatorOptions
|
| 337 |
+
obj = ContactAnnotatorOptions()
|
| 338 |
+
obj.Init(self._tab.Bytes, x)
|
| 339 |
+
return obj
|
| 340 |
+
return None
|
| 341 |
+
|
| 342 |
+
# Model
|
| 343 |
+
def MoneyParsingOptions(self):
|
| 344 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(56))
|
| 345 |
+
if o != 0:
|
| 346 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 347 |
+
from libtextclassifier3.MoneyParsingOptions import MoneyParsingOptions
|
| 348 |
+
obj = MoneyParsingOptions()
|
| 349 |
+
obj.Init(self._tab.Bytes, x)
|
| 350 |
+
return obj
|
| 351 |
+
return None
|
| 352 |
+
|
| 353 |
+
# Model
|
| 354 |
+
def TranslateAnnotatorOptions(self):
|
| 355 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58))
|
| 356 |
+
if o != 0:
|
| 357 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 358 |
+
from libtextclassifier3.TranslateAnnotatorOptions import TranslateAnnotatorOptions
|
| 359 |
+
obj = TranslateAnnotatorOptions()
|
| 360 |
+
obj.Init(self._tab.Bytes, x)
|
| 361 |
+
return obj
|
| 362 |
+
return None
|
| 363 |
+
|
| 364 |
+
# Model
|
| 365 |
+
def GrammarModel(self):
|
| 366 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60))
|
| 367 |
+
if o != 0:
|
| 368 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 369 |
+
from libtextclassifier3.GrammarModel import GrammarModel
|
| 370 |
+
obj = GrammarModel()
|
| 371 |
+
obj.Init(self._tab.Bytes, x)
|
| 372 |
+
return obj
|
| 373 |
+
return None
|
| 374 |
+
|
| 375 |
+
# Model
|
| 376 |
+
def ConflictResolutionOptions(self):
|
| 377 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62))
|
| 378 |
+
if o != 0:
|
| 379 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 380 |
+
from libtextclassifier3.Model_.ConflictResolutionOptions import ConflictResolutionOptions
|
| 381 |
+
obj = ConflictResolutionOptions()
|
| 382 |
+
obj.Init(self._tab.Bytes, x)
|
| 383 |
+
return obj
|
| 384 |
+
return None
|
| 385 |
+
|
| 386 |
+
# Model
|
| 387 |
+
def ExperimentalModel(self):
|
| 388 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64))
|
| 389 |
+
if o != 0:
|
| 390 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 391 |
+
from libtextclassifier3.ExperimentalModel import ExperimentalModel
|
| 392 |
+
obj = ExperimentalModel()
|
| 393 |
+
obj.Init(self._tab.Bytes, x)
|
| 394 |
+
return obj
|
| 395 |
+
return None
|
| 396 |
+
|
| 397 |
+
# Model
|
| 398 |
+
def PodNerModel(self):
|
| 399 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(66))
|
| 400 |
+
if o != 0:
|
| 401 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 402 |
+
from libtextclassifier3.PodNerModel import PodNerModel
|
| 403 |
+
obj = PodNerModel()
|
| 404 |
+
obj.Init(self._tab.Bytes, x)
|
| 405 |
+
return obj
|
| 406 |
+
return None
|
| 407 |
+
|
| 408 |
+
# Model
|
| 409 |
+
def VocabModel(self):
|
| 410 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(68))
|
| 411 |
+
if o != 0:
|
| 412 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 413 |
+
from libtextclassifier3.VocabModel import VocabModel
|
| 414 |
+
obj = VocabModel()
|
| 415 |
+
obj.Init(self._tab.Bytes, x)
|
| 416 |
+
return obj
|
| 417 |
+
return None
|
| 418 |
+
|
| 419 |
+
def ModelStart(builder): builder.StartObject(33)
|
| 420 |
+
def ModelAddLocales(builder, locales): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(locales), 0)
|
| 421 |
+
def ModelAddVersion(builder, version): builder.PrependInt32Slot(1, version, 0)
|
| 422 |
+
def ModelAddName(builder, name): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
|
| 423 |
+
def ModelAddSelectionFeatureOptions(builder, selectionFeatureOptions): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(selectionFeatureOptions), 0)
|
| 424 |
+
def ModelAddClassificationFeatureOptions(builder, classificationFeatureOptions): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(classificationFeatureOptions), 0)
|
| 425 |
+
def ModelAddSelectionModel(builder, selectionModel): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(selectionModel), 0)
|
| 426 |
+
def ModelStartSelectionModelVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
| 427 |
+
def ModelAddClassificationModel(builder, classificationModel): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(classificationModel), 0)
|
| 428 |
+
def ModelStartClassificationModelVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
| 429 |
+
def ModelAddEmbeddingModel(builder, embeddingModel): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(embeddingModel), 0)
|
| 430 |
+
def ModelStartEmbeddingModelVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
| 431 |
+
def ModelAddSelectionOptions(builder, selectionOptions): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(selectionOptions), 0)
|
| 432 |
+
def ModelAddClassificationOptions(builder, classificationOptions): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(classificationOptions), 0)
|
| 433 |
+
def ModelAddRegexModel(builder, regexModel): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(regexModel), 0)
|
| 434 |
+
def ModelAddDatetimeModel(builder, datetimeModel): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(datetimeModel), 0)
|
| 435 |
+
def ModelAddTriggeringOptions(builder, triggeringOptions): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(triggeringOptions), 0)
|
| 436 |
+
def ModelAddEnabledModes(builder, enabledModes): builder.PrependInt32Slot(13, enabledModes, 7)
|
| 437 |
+
def ModelAddSnapWhitespaceSelections(builder, snapWhitespaceSelections): builder.PrependBoolSlot(14, snapWhitespaceSelections, 1)
|
| 438 |
+
def ModelAddOutputOptions(builder, outputOptions): builder.PrependUOffsetTRelativeSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(outputOptions), 0)
|
| 439 |
+
def ModelAddAndroidIntentOptions(builder, androidIntentOptions): builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(androidIntentOptions), 0)
|
| 440 |
+
def ModelAddIntentOptions(builder, intentOptions): builder.PrependUOffsetTRelativeSlot(17, flatbuffers.number_types.UOffsetTFlags.py_type(intentOptions), 0)
|
| 441 |
+
def ModelAddResources(builder, resources): builder.PrependUOffsetTRelativeSlot(18, flatbuffers.number_types.UOffsetTFlags.py_type(resources), 0)
|
| 442 |
+
def ModelAddEntityDataSchema(builder, entityDataSchema): builder.PrependUOffsetTRelativeSlot(19, flatbuffers.number_types.UOffsetTFlags.py_type(entityDataSchema), 0)
|
| 443 |
+
def ModelStartEntityDataSchemaVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
| 444 |
+
def ModelAddNumberAnnotatorOptions(builder, numberAnnotatorOptions): builder.PrependUOffsetTRelativeSlot(20, flatbuffers.number_types.UOffsetTFlags.py_type(numberAnnotatorOptions), 0)
|
| 445 |
+
def ModelAddDurationAnnotatorOptions(builder, durationAnnotatorOptions): builder.PrependUOffsetTRelativeSlot(21, flatbuffers.number_types.UOffsetTFlags.py_type(durationAnnotatorOptions), 0)
|
| 446 |
+
def ModelAddTriggeringLocales(builder, triggeringLocales): builder.PrependUOffsetTRelativeSlot(22, flatbuffers.number_types.UOffsetTFlags.py_type(triggeringLocales), 0)
|
| 447 |
+
def ModelAddEmbeddingPruningMask(builder, embeddingPruningMask): builder.PrependUOffsetTRelativeSlot(23, flatbuffers.number_types.UOffsetTFlags.py_type(embeddingPruningMask), 0)
|
| 448 |
+
def ModelAddContactAnnotatorOptions(builder, contactAnnotatorOptions): builder.PrependUOffsetTRelativeSlot(25, flatbuffers.number_types.UOffsetTFlags.py_type(contactAnnotatorOptions), 0)
|
| 449 |
+
def ModelAddMoneyParsingOptions(builder, moneyParsingOptions): builder.PrependUOffsetTRelativeSlot(26, flatbuffers.number_types.UOffsetTFlags.py_type(moneyParsingOptions), 0)
|
| 450 |
+
def ModelAddTranslateAnnotatorOptions(builder, translateAnnotatorOptions): builder.PrependUOffsetTRelativeSlot(27, flatbuffers.number_types.UOffsetTFlags.py_type(translateAnnotatorOptions), 0)
|
| 451 |
+
def ModelAddGrammarModel(builder, grammarModel): builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(grammarModel), 0)
|
| 452 |
+
def ModelAddConflictResolutionOptions(builder, conflictResolutionOptions): builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(conflictResolutionOptions), 0)
|
| 453 |
+
def ModelAddExperimentalModel(builder, experimentalModel): builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(experimentalModel), 0)
|
| 454 |
+
def ModelAddPodNerModel(builder, podNerModel): builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(podNerModel), 0)
|
| 455 |
+
def ModelAddVocabModel(builder, vocabModel): builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vocabModel), 0)
|
| 456 |
+
def ModelEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/ModelTriggeringOptions.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class ModelTriggeringOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsModelTriggeringOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = ModelTriggeringOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def ModelTriggeringOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# ModelTriggeringOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# ModelTriggeringOptions
|
| 28 |
+
def MinAnnotateConfidence(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 32 |
+
return 0.0
|
| 33 |
+
|
| 34 |
+
# ModelTriggeringOptions
|
| 35 |
+
def EnabledModes(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return 7
|
| 40 |
+
|
| 41 |
+
# ModelTriggeringOptions
|
| 42 |
+
def DictionaryLocales(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.String(o + self._tab.Pos)
|
| 46 |
+
return None
|
| 47 |
+
|
| 48 |
+
# ModelTriggeringOptions
|
| 49 |
+
def Locales(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.String(o + self._tab.Pos)
|
| 53 |
+
return None
|
| 54 |
+
|
| 55 |
+
# ModelTriggeringOptions
|
| 56 |
+
def OtherCollectionPriorityScore(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 58 |
+
if o != 0:
|
| 59 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 60 |
+
return -1000.0
|
| 61 |
+
|
| 62 |
+
# ModelTriggeringOptions
|
| 63 |
+
def KnowledgePriorityScore(self):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 65 |
+
if o != 0:
|
| 66 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 67 |
+
return 0.0
|
| 68 |
+
|
| 69 |
+
# ModelTriggeringOptions
|
| 70 |
+
def CollectionToPriority(self, j):
|
| 71 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 72 |
+
if o != 0:
|
| 73 |
+
x = self._tab.Vector(o)
|
| 74 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 75 |
+
x = self._tab.Indirect(x)
|
| 76 |
+
from libtextclassifier3.ModelTriggeringOptions_.CollectionToPriorityEntry import CollectionToPriorityEntry
|
| 77 |
+
obj = CollectionToPriorityEntry()
|
| 78 |
+
obj.Init(self._tab.Bytes, x)
|
| 79 |
+
return obj
|
| 80 |
+
return None
|
| 81 |
+
|
| 82 |
+
# ModelTriggeringOptions
|
| 83 |
+
def CollectionToPriorityLength(self):
|
| 84 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 85 |
+
if o != 0:
|
| 86 |
+
return self._tab.VectorLen(o)
|
| 87 |
+
return 0
|
| 88 |
+
|
| 89 |
+
# ModelTriggeringOptions
|
| 90 |
+
def CollectionToPriorityIsNone(self):
|
| 91 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 92 |
+
return o == 0
|
| 93 |
+
|
| 94 |
+
def ModelTriggeringOptionsStart(builder): builder.StartObject(8)
|
| 95 |
+
def ModelTriggeringOptionsAddMinAnnotateConfidence(builder, minAnnotateConfidence): builder.PrependFloat32Slot(0, minAnnotateConfidence, 0.0)
|
| 96 |
+
def ModelTriggeringOptionsAddEnabledModes(builder, enabledModes): builder.PrependInt32Slot(1, enabledModes, 7)
|
| 97 |
+
def ModelTriggeringOptionsAddDictionaryLocales(builder, dictionaryLocales): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dictionaryLocales), 0)
|
| 98 |
+
def ModelTriggeringOptionsAddLocales(builder, locales): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(locales), 0)
|
| 99 |
+
def ModelTriggeringOptionsAddOtherCollectionPriorityScore(builder, otherCollectionPriorityScore): builder.PrependFloat32Slot(4, otherCollectionPriorityScore, -1000.0)
|
| 100 |
+
def ModelTriggeringOptionsAddKnowledgePriorityScore(builder, knowledgePriorityScore): builder.PrependFloat32Slot(5, knowledgePriorityScore, 0.0)
|
| 101 |
+
def ModelTriggeringOptionsAddCollectionToPriority(builder, collectionToPriority): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(collectionToPriority), 0)
|
| 102 |
+
def ModelTriggeringOptionsStartCollectionToPriorityVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 103 |
+
def ModelTriggeringOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/ModelTriggeringOptions_/CollectionToPriorityEntry.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: ModelTriggeringOptions_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class CollectionToPriorityEntry(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsCollectionToPriorityEntry(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = CollectionToPriorityEntry()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def CollectionToPriorityEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# CollectionToPriorityEntry
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# CollectionToPriorityEntry
|
| 28 |
+
def Key(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# CollectionToPriorityEntry
|
| 35 |
+
def Value(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 39 |
+
return 0.0
|
| 40 |
+
|
| 41 |
+
def CollectionToPriorityEntryStart(builder): builder.StartObject(2)
|
| 42 |
+
def CollectionToPriorityEntryAddKey(builder, key): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)
|
| 43 |
+
def CollectionToPriorityEntryAddValue(builder, value): builder.PrependFloat32Slot(1, value, 0.0)
|
| 44 |
+
def CollectionToPriorityEntryEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/Model_/ConflictResolutionOptions.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: Model_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class ConflictResolutionOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsConflictResolutionOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = ConflictResolutionOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def ConflictResolutionOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# ConflictResolutionOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# ConflictResolutionOptions
|
| 28 |
+
def PrioritizeLongestAnnotation(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# ConflictResolutionOptions
|
| 35 |
+
def DoConflictResolutionInRawMode(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 39 |
+
return True
|
| 40 |
+
|
| 41 |
+
def ConflictResolutionOptionsStart(builder): builder.StartObject(2)
|
| 42 |
+
def ConflictResolutionOptionsAddPrioritizeLongestAnnotation(builder, prioritizeLongestAnnotation): builder.PrependBoolSlot(0, prioritizeLongestAnnotation, 0)
|
| 43 |
+
def ConflictResolutionOptionsAddDoConflictResolutionInRawMode(builder, doConflictResolutionInRawMode): builder.PrependBoolSlot(1, doConflictResolutionInRawMode, 1)
|
| 44 |
+
def ConflictResolutionOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/Model_/EmbeddingPruningMask.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: Model_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class EmbeddingPruningMask(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsEmbeddingPruningMask(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = EmbeddingPruningMask()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def EmbeddingPruningMaskBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# EmbeddingPruningMask
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# EmbeddingPruningMask
|
| 28 |
+
def Enabled(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# EmbeddingPruningMask
|
| 35 |
+
def PruningMask(self, j):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
a = self._tab.Vector(o)
|
| 39 |
+
return self._tab.Get(flatbuffers.number_types.Uint64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
|
| 40 |
+
return 0
|
| 41 |
+
|
| 42 |
+
# EmbeddingPruningMask
|
| 43 |
+
def PruningMaskAsNumpy(self):
|
| 44 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 45 |
+
if o != 0:
|
| 46 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint64Flags, o)
|
| 47 |
+
return 0
|
| 48 |
+
|
| 49 |
+
# EmbeddingPruningMask
|
| 50 |
+
def PruningMaskLength(self):
|
| 51 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 52 |
+
if o != 0:
|
| 53 |
+
return self._tab.VectorLen(o)
|
| 54 |
+
return 0
|
| 55 |
+
|
| 56 |
+
# EmbeddingPruningMask
|
| 57 |
+
def PruningMaskIsNone(self):
|
| 58 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 59 |
+
return o == 0
|
| 60 |
+
|
| 61 |
+
# EmbeddingPruningMask
|
| 62 |
+
def FullNumBuckets(self):
|
| 63 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 64 |
+
if o != 0:
|
| 65 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 66 |
+
return 0
|
| 67 |
+
|
| 68 |
+
# EmbeddingPruningMask
|
| 69 |
+
def PrunedRowBucketId(self):
|
| 70 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 71 |
+
if o != 0:
|
| 72 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 73 |
+
return 0
|
| 74 |
+
|
| 75 |
+
def EmbeddingPruningMaskStart(builder): builder.StartObject(4)
|
| 76 |
+
def EmbeddingPruningMaskAddEnabled(builder, enabled): builder.PrependBoolSlot(0, enabled, 0)
|
| 77 |
+
def EmbeddingPruningMaskAddPruningMask(builder, pruningMask): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(pruningMask), 0)
|
| 78 |
+
def EmbeddingPruningMaskStartPruningMaskVector(builder, numElems): return builder.StartVector(8, numElems, 8)
|
| 79 |
+
def EmbeddingPruningMaskAddFullNumBuckets(builder, fullNumBuckets): builder.PrependInt32Slot(2, fullNumBuckets, 0)
|
| 80 |
+
def EmbeddingPruningMaskAddPrunedRowBucketId(builder, prunedRowBucketId): builder.PrependInt32Slot(3, prunedRowBucketId, 0)
|
| 81 |
+
def EmbeddingPruningMaskEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/Model_/__init__.py
ADDED
|
File without changes
|
19/libtextclassifier3/MoneyParsingOptions.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class MoneyParsingOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsMoneyParsingOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = MoneyParsingOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def MoneyParsingOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# MoneyParsingOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# MoneyParsingOptions
|
| 28 |
+
def Separators(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
a = self._tab.Vector(o)
|
| 32 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 33 |
+
return 0
|
| 34 |
+
|
| 35 |
+
# MoneyParsingOptions
|
| 36 |
+
def SeparatorsAsNumpy(self):
|
| 37 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 38 |
+
if o != 0:
|
| 39 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 40 |
+
return 0
|
| 41 |
+
|
| 42 |
+
# MoneyParsingOptions
|
| 43 |
+
def SeparatorsLength(self):
|
| 44 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 45 |
+
if o != 0:
|
| 46 |
+
return self._tab.VectorLen(o)
|
| 47 |
+
return 0
|
| 48 |
+
|
| 49 |
+
# MoneyParsingOptions
|
| 50 |
+
def SeparatorsIsNone(self):
|
| 51 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 52 |
+
return o == 0
|
| 53 |
+
|
| 54 |
+
# MoneyParsingOptions
|
| 55 |
+
def QuantitiesNameToExponent(self, j):
|
| 56 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 57 |
+
if o != 0:
|
| 58 |
+
x = self._tab.Vector(o)
|
| 59 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 60 |
+
x = self._tab.Indirect(x)
|
| 61 |
+
from libtextclassifier3.MoneyParsingOptions_.QuantitiesNameToExponentEntry import QuantitiesNameToExponentEntry
|
| 62 |
+
obj = QuantitiesNameToExponentEntry()
|
| 63 |
+
obj.Init(self._tab.Bytes, x)
|
| 64 |
+
return obj
|
| 65 |
+
return None
|
| 66 |
+
|
| 67 |
+
# MoneyParsingOptions
|
| 68 |
+
def QuantitiesNameToExponentLength(self):
|
| 69 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 70 |
+
if o != 0:
|
| 71 |
+
return self._tab.VectorLen(o)
|
| 72 |
+
return 0
|
| 73 |
+
|
| 74 |
+
# MoneyParsingOptions
|
| 75 |
+
def QuantitiesNameToExponentIsNone(self):
|
| 76 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 77 |
+
return o == 0
|
| 78 |
+
|
| 79 |
+
def MoneyParsingOptionsStart(builder): builder.StartObject(2)
|
| 80 |
+
def MoneyParsingOptionsAddSeparators(builder, separators): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(separators), 0)
|
| 81 |
+
def MoneyParsingOptionsStartSeparatorsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 82 |
+
def MoneyParsingOptionsAddQuantitiesNameToExponent(builder, quantitiesNameToExponent): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(quantitiesNameToExponent), 0)
|
| 83 |
+
def MoneyParsingOptionsStartQuantitiesNameToExponentVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 84 |
+
def MoneyParsingOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/MoneyParsingOptions_/QuantitiesNameToExponentEntry.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: MoneyParsingOptions_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class QuantitiesNameToExponentEntry(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsQuantitiesNameToExponentEntry(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = QuantitiesNameToExponentEntry()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def QuantitiesNameToExponentEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# QuantitiesNameToExponentEntry
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# QuantitiesNameToExponentEntry
|
| 28 |
+
def Key(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# QuantitiesNameToExponentEntry
|
| 35 |
+
def Value(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return 0
|
| 40 |
+
|
| 41 |
+
def QuantitiesNameToExponentEntryStart(builder): builder.StartObject(2)
|
| 42 |
+
def QuantitiesNameToExponentEntryAddKey(builder, key): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)
|
| 43 |
+
def QuantitiesNameToExponentEntryAddValue(builder, value): builder.PrependInt32Slot(1, value, 0)
|
| 44 |
+
def QuantitiesNameToExponentEntryEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/NumberAnnotatorOptions.py
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class NumberAnnotatorOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsNumberAnnotatorOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = NumberAnnotatorOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def NumberAnnotatorOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# NumberAnnotatorOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# NumberAnnotatorOptions
|
| 28 |
+
def Enabled(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# NumberAnnotatorOptions
|
| 35 |
+
def Score(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 39 |
+
return 1.0
|
| 40 |
+
|
| 41 |
+
# NumberAnnotatorOptions
|
| 42 |
+
def PriorityScore(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0.0
|
| 47 |
+
|
| 48 |
+
# NumberAnnotatorOptions
|
| 49 |
+
def EnabledModes(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 53 |
+
return 7
|
| 54 |
+
|
| 55 |
+
# NumberAnnotatorOptions
|
| 56 |
+
def EnabledAnnotationUsecases(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 58 |
+
if o != 0:
|
| 59 |
+
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
| 60 |
+
return 4294967295
|
| 61 |
+
|
| 62 |
+
# NumberAnnotatorOptions
|
| 63 |
+
def AllowedPrefixCodepoints(self, j):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 65 |
+
if o != 0:
|
| 66 |
+
a = self._tab.Vector(o)
|
| 67 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 68 |
+
return 0
|
| 69 |
+
|
| 70 |
+
# NumberAnnotatorOptions
|
| 71 |
+
def AllowedPrefixCodepointsAsNumpy(self):
|
| 72 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 73 |
+
if o != 0:
|
| 74 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 75 |
+
return 0
|
| 76 |
+
|
| 77 |
+
# NumberAnnotatorOptions
|
| 78 |
+
def AllowedPrefixCodepointsLength(self):
|
| 79 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 80 |
+
if o != 0:
|
| 81 |
+
return self._tab.VectorLen(o)
|
| 82 |
+
return 0
|
| 83 |
+
|
| 84 |
+
# NumberAnnotatorOptions
|
| 85 |
+
def AllowedPrefixCodepointsIsNone(self):
|
| 86 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 87 |
+
return o == 0
|
| 88 |
+
|
| 89 |
+
# NumberAnnotatorOptions
|
| 90 |
+
def AllowedSuffixCodepoints(self, j):
|
| 91 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 92 |
+
if o != 0:
|
| 93 |
+
a = self._tab.Vector(o)
|
| 94 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 95 |
+
return 0
|
| 96 |
+
|
| 97 |
+
# NumberAnnotatorOptions
|
| 98 |
+
def AllowedSuffixCodepointsAsNumpy(self):
|
| 99 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 100 |
+
if o != 0:
|
| 101 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 102 |
+
return 0
|
| 103 |
+
|
| 104 |
+
# NumberAnnotatorOptions
|
| 105 |
+
def AllowedSuffixCodepointsLength(self):
|
| 106 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 107 |
+
if o != 0:
|
| 108 |
+
return self._tab.VectorLen(o)
|
| 109 |
+
return 0
|
| 110 |
+
|
| 111 |
+
# NumberAnnotatorOptions
|
| 112 |
+
def AllowedSuffixCodepointsIsNone(self):
|
| 113 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 114 |
+
return o == 0
|
| 115 |
+
|
| 116 |
+
# NumberAnnotatorOptions
|
| 117 |
+
def IgnoredPrefixSpanBoundaryCodepoints(self, j):
|
| 118 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 119 |
+
if o != 0:
|
| 120 |
+
a = self._tab.Vector(o)
|
| 121 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 122 |
+
return 0
|
| 123 |
+
|
| 124 |
+
# NumberAnnotatorOptions
|
| 125 |
+
def IgnoredPrefixSpanBoundaryCodepointsAsNumpy(self):
|
| 126 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 127 |
+
if o != 0:
|
| 128 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 129 |
+
return 0
|
| 130 |
+
|
| 131 |
+
# NumberAnnotatorOptions
|
| 132 |
+
def IgnoredPrefixSpanBoundaryCodepointsLength(self):
|
| 133 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 134 |
+
if o != 0:
|
| 135 |
+
return self._tab.VectorLen(o)
|
| 136 |
+
return 0
|
| 137 |
+
|
| 138 |
+
# NumberAnnotatorOptions
|
| 139 |
+
def IgnoredPrefixSpanBoundaryCodepointsIsNone(self):
|
| 140 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 141 |
+
return o == 0
|
| 142 |
+
|
| 143 |
+
# NumberAnnotatorOptions
|
| 144 |
+
def IgnoredSuffixSpanBoundaryCodepoints(self, j):
|
| 145 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 146 |
+
if o != 0:
|
| 147 |
+
a = self._tab.Vector(o)
|
| 148 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 149 |
+
return 0
|
| 150 |
+
|
| 151 |
+
# NumberAnnotatorOptions
|
| 152 |
+
def IgnoredSuffixSpanBoundaryCodepointsAsNumpy(self):
|
| 153 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 154 |
+
if o != 0:
|
| 155 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 156 |
+
return 0
|
| 157 |
+
|
| 158 |
+
# NumberAnnotatorOptions
|
| 159 |
+
def IgnoredSuffixSpanBoundaryCodepointsLength(self):
|
| 160 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 161 |
+
if o != 0:
|
| 162 |
+
return self._tab.VectorLen(o)
|
| 163 |
+
return 0
|
| 164 |
+
|
| 165 |
+
# NumberAnnotatorOptions
|
| 166 |
+
def IgnoredSuffixSpanBoundaryCodepointsIsNone(self):
|
| 167 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 168 |
+
return o == 0
|
| 169 |
+
|
| 170 |
+
# NumberAnnotatorOptions
|
| 171 |
+
def EnablePercentage(self):
|
| 172 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 173 |
+
if o != 0:
|
| 174 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 175 |
+
return False
|
| 176 |
+
|
| 177 |
+
# NumberAnnotatorOptions
|
| 178 |
+
def PercentagePiecesString(self):
|
| 179 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 180 |
+
if o != 0:
|
| 181 |
+
return self._tab.String(o + self._tab.Pos)
|
| 182 |
+
return None
|
| 183 |
+
|
| 184 |
+
# NumberAnnotatorOptions
|
| 185 |
+
def PercentagePiecesOffsets(self, j):
|
| 186 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 187 |
+
if o != 0:
|
| 188 |
+
a = self._tab.Vector(o)
|
| 189 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 190 |
+
return 0
|
| 191 |
+
|
| 192 |
+
# NumberAnnotatorOptions
|
| 193 |
+
def PercentagePiecesOffsetsAsNumpy(self):
|
| 194 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 195 |
+
if o != 0:
|
| 196 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
| 197 |
+
return 0
|
| 198 |
+
|
| 199 |
+
# NumberAnnotatorOptions
|
| 200 |
+
def PercentagePiecesOffsetsLength(self):
|
| 201 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 202 |
+
if o != 0:
|
| 203 |
+
return self._tab.VectorLen(o)
|
| 204 |
+
return 0
|
| 205 |
+
|
| 206 |
+
# NumberAnnotatorOptions
|
| 207 |
+
def PercentagePiecesOffsetsIsNone(self):
|
| 208 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 209 |
+
return o == 0
|
| 210 |
+
|
| 211 |
+
# NumberAnnotatorOptions
|
| 212 |
+
def PercentagePriorityScore(self):
|
| 213 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 214 |
+
if o != 0:
|
| 215 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 216 |
+
return 1.0
|
| 217 |
+
|
| 218 |
+
# NumberAnnotatorOptions
|
| 219 |
+
def FloatNumberPriorityScore(self):
|
| 220 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
|
| 221 |
+
if o != 0:
|
| 222 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 223 |
+
return 0.0
|
| 224 |
+
|
| 225 |
+
# NumberAnnotatorOptions
|
| 226 |
+
def MaxNumberOfDigits(self):
|
| 227 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
|
| 228 |
+
if o != 0:
|
| 229 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 230 |
+
return 20
|
| 231 |
+
|
| 232 |
+
# NumberAnnotatorOptions
|
| 233 |
+
def PercentageAnnotationUsecases(self):
|
| 234 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
|
| 235 |
+
if o != 0:
|
| 236 |
+
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
| 237 |
+
return 2
|
| 238 |
+
|
| 239 |
+
def NumberAnnotatorOptionsStart(builder): builder.StartObject(16)
|
| 240 |
+
def NumberAnnotatorOptionsAddEnabled(builder, enabled): builder.PrependBoolSlot(0, enabled, 0)
|
| 241 |
+
def NumberAnnotatorOptionsAddScore(builder, score): builder.PrependFloat32Slot(1, score, 1.0)
|
| 242 |
+
def NumberAnnotatorOptionsAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(2, priorityScore, 0.0)
|
| 243 |
+
def NumberAnnotatorOptionsAddEnabledModes(builder, enabledModes): builder.PrependInt32Slot(3, enabledModes, 7)
|
| 244 |
+
def NumberAnnotatorOptionsAddEnabledAnnotationUsecases(builder, enabledAnnotationUsecases): builder.PrependUint32Slot(4, enabledAnnotationUsecases, 4294967295)
|
| 245 |
+
def NumberAnnotatorOptionsAddAllowedPrefixCodepoints(builder, allowedPrefixCodepoints): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(allowedPrefixCodepoints), 0)
|
| 246 |
+
def NumberAnnotatorOptionsStartAllowedPrefixCodepointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 247 |
+
def NumberAnnotatorOptionsAddAllowedSuffixCodepoints(builder, allowedSuffixCodepoints): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(allowedSuffixCodepoints), 0)
|
| 248 |
+
def NumberAnnotatorOptionsStartAllowedSuffixCodepointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 249 |
+
def NumberAnnotatorOptionsAddIgnoredPrefixSpanBoundaryCodepoints(builder, ignoredPrefixSpanBoundaryCodepoints): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(ignoredPrefixSpanBoundaryCodepoints), 0)
|
| 250 |
+
def NumberAnnotatorOptionsStartIgnoredPrefixSpanBoundaryCodepointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 251 |
+
def NumberAnnotatorOptionsAddIgnoredSuffixSpanBoundaryCodepoints(builder, ignoredSuffixSpanBoundaryCodepoints): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(ignoredSuffixSpanBoundaryCodepoints), 0)
|
| 252 |
+
def NumberAnnotatorOptionsStartIgnoredSuffixSpanBoundaryCodepointsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 253 |
+
def NumberAnnotatorOptionsAddEnablePercentage(builder, enablePercentage): builder.PrependBoolSlot(9, enablePercentage, 0)
|
| 254 |
+
def NumberAnnotatorOptionsAddPercentagePiecesString(builder, percentagePiecesString): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(percentagePiecesString), 0)
|
| 255 |
+
def NumberAnnotatorOptionsAddPercentagePiecesOffsets(builder, percentagePiecesOffsets): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(percentagePiecesOffsets), 0)
|
| 256 |
+
def NumberAnnotatorOptionsStartPercentagePiecesOffsetsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 257 |
+
def NumberAnnotatorOptionsAddPercentagePriorityScore(builder, percentagePriorityScore): builder.PrependFloat32Slot(12, percentagePriorityScore, 1.0)
|
| 258 |
+
def NumberAnnotatorOptionsAddFloatNumberPriorityScore(builder, floatNumberPriorityScore): builder.PrependFloat32Slot(13, floatNumberPriorityScore, 0.0)
|
| 259 |
+
def NumberAnnotatorOptionsAddMaxNumberOfDigits(builder, maxNumberOfDigits): builder.PrependInt32Slot(14, maxNumberOfDigits, 20)
|
| 260 |
+
def NumberAnnotatorOptionsAddPercentageAnnotationUsecases(builder, percentageAnnotationUsecases): builder.PrependUint32Slot(15, percentageAnnotationUsecases, 2)
|
| 261 |
+
def NumberAnnotatorOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/OutputOptions.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class OutputOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsOutputOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = OutputOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def OutputOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# OutputOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# OutputOptions
|
| 28 |
+
def FilteredCollectionsAnnotation(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
a = self._tab.Vector(o)
|
| 32 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 33 |
+
return ""
|
| 34 |
+
|
| 35 |
+
# OutputOptions
|
| 36 |
+
def FilteredCollectionsAnnotationLength(self):
|
| 37 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 38 |
+
if o != 0:
|
| 39 |
+
return self._tab.VectorLen(o)
|
| 40 |
+
return 0
|
| 41 |
+
|
| 42 |
+
# OutputOptions
|
| 43 |
+
def FilteredCollectionsAnnotationIsNone(self):
|
| 44 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 45 |
+
return o == 0
|
| 46 |
+
|
| 47 |
+
# OutputOptions
|
| 48 |
+
def FilteredCollectionsClassification(self, j):
|
| 49 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 50 |
+
if o != 0:
|
| 51 |
+
a = self._tab.Vector(o)
|
| 52 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 53 |
+
return ""
|
| 54 |
+
|
| 55 |
+
# OutputOptions
|
| 56 |
+
def FilteredCollectionsClassificationLength(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 58 |
+
if o != 0:
|
| 59 |
+
return self._tab.VectorLen(o)
|
| 60 |
+
return 0
|
| 61 |
+
|
| 62 |
+
# OutputOptions
|
| 63 |
+
def FilteredCollectionsClassificationIsNone(self):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 65 |
+
return o == 0
|
| 66 |
+
|
| 67 |
+
# OutputOptions
|
| 68 |
+
def FilteredCollectionsSelection(self, j):
|
| 69 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 70 |
+
if o != 0:
|
| 71 |
+
a = self._tab.Vector(o)
|
| 72 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 73 |
+
return ""
|
| 74 |
+
|
| 75 |
+
# OutputOptions
|
| 76 |
+
def FilteredCollectionsSelectionLength(self):
|
| 77 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 78 |
+
if o != 0:
|
| 79 |
+
return self._tab.VectorLen(o)
|
| 80 |
+
return 0
|
| 81 |
+
|
| 82 |
+
# OutputOptions
|
| 83 |
+
def FilteredCollectionsSelectionIsNone(self):
|
| 84 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 85 |
+
return o == 0
|
| 86 |
+
|
| 87 |
+
def OutputOptionsStart(builder): builder.StartObject(3)
|
| 88 |
+
def OutputOptionsAddFilteredCollectionsAnnotation(builder, filteredCollectionsAnnotation): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(filteredCollectionsAnnotation), 0)
|
| 89 |
+
def OutputOptionsStartFilteredCollectionsAnnotationVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 90 |
+
def OutputOptionsAddFilteredCollectionsClassification(builder, filteredCollectionsClassification): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(filteredCollectionsClassification), 0)
|
| 91 |
+
def OutputOptionsStartFilteredCollectionsClassificationVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 92 |
+
def OutputOptionsAddFilteredCollectionsSelection(builder, filteredCollectionsSelection): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(filteredCollectionsSelection), 0)
|
| 93 |
+
def OutputOptionsStartFilteredCollectionsSelectionVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 94 |
+
def OutputOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/PodNerModel.py
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class PodNerModel(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsPodNerModel(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = PodNerModel()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def PodNerModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# PodNerModel
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# PodNerModel
|
| 28 |
+
def TfliteModel(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
a = self._tab.Vector(o)
|
| 32 |
+
return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
| 33 |
+
return 0
|
| 34 |
+
|
| 35 |
+
# PodNerModel
|
| 36 |
+
def TfliteModelAsNumpy(self):
|
| 37 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 38 |
+
if o != 0:
|
| 39 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
|
| 40 |
+
return 0
|
| 41 |
+
|
| 42 |
+
# PodNerModel
|
| 43 |
+
def TfliteModelLength(self):
|
| 44 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 45 |
+
if o != 0:
|
| 46 |
+
return self._tab.VectorLen(o)
|
| 47 |
+
return 0
|
| 48 |
+
|
| 49 |
+
# PodNerModel
|
| 50 |
+
def TfliteModelIsNone(self):
|
| 51 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 52 |
+
return o == 0
|
| 53 |
+
|
| 54 |
+
# PodNerModel
|
| 55 |
+
def WordPieceVocab(self, j):
|
| 56 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 57 |
+
if o != 0:
|
| 58 |
+
a = self._tab.Vector(o)
|
| 59 |
+
return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
| 60 |
+
return 0
|
| 61 |
+
|
| 62 |
+
# PodNerModel
|
| 63 |
+
def WordPieceVocabAsNumpy(self):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 65 |
+
if o != 0:
|
| 66 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
|
| 67 |
+
return 0
|
| 68 |
+
|
| 69 |
+
# PodNerModel
|
| 70 |
+
def WordPieceVocabLength(self):
|
| 71 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 72 |
+
if o != 0:
|
| 73 |
+
return self._tab.VectorLen(o)
|
| 74 |
+
return 0
|
| 75 |
+
|
| 76 |
+
# PodNerModel
|
| 77 |
+
def WordPieceVocabIsNone(self):
|
| 78 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 79 |
+
return o == 0
|
| 80 |
+
|
| 81 |
+
# PodNerModel
|
| 82 |
+
def LowercaseInput(self):
|
| 83 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 84 |
+
if o != 0:
|
| 85 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 86 |
+
return True
|
| 87 |
+
|
| 88 |
+
# PodNerModel
|
| 89 |
+
def LogitsIndexInOutputTensor(self):
|
| 90 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 91 |
+
if o != 0:
|
| 92 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 93 |
+
return 0
|
| 94 |
+
|
| 95 |
+
# PodNerModel
|
| 96 |
+
def AppendFinalPeriod(self):
|
| 97 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 98 |
+
if o != 0:
|
| 99 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 100 |
+
return False
|
| 101 |
+
|
| 102 |
+
# PodNerModel
|
| 103 |
+
def PriorityScore(self):
|
| 104 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 105 |
+
if o != 0:
|
| 106 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 107 |
+
return 0.0
|
| 108 |
+
|
| 109 |
+
# PodNerModel
|
| 110 |
+
def MaxNumWordpieces(self):
|
| 111 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 112 |
+
if o != 0:
|
| 113 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 114 |
+
return 128
|
| 115 |
+
|
| 116 |
+
# PodNerModel
|
| 117 |
+
def SlidingWindowNumWordpiecesOverlap(self):
|
| 118 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 119 |
+
if o != 0:
|
| 120 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 121 |
+
return 20
|
| 122 |
+
|
| 123 |
+
# PodNerModel
|
| 124 |
+
def Labels(self, j):
|
| 125 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 126 |
+
if o != 0:
|
| 127 |
+
x = self._tab.Vector(o)
|
| 128 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 129 |
+
x = self._tab.Indirect(x)
|
| 130 |
+
from libtextclassifier3.PodNerModel_.Label import Label
|
| 131 |
+
obj = Label()
|
| 132 |
+
obj.Init(self._tab.Bytes, x)
|
| 133 |
+
return obj
|
| 134 |
+
return None
|
| 135 |
+
|
| 136 |
+
# PodNerModel
|
| 137 |
+
def LabelsLength(self):
|
| 138 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 139 |
+
if o != 0:
|
| 140 |
+
return self._tab.VectorLen(o)
|
| 141 |
+
return 0
|
| 142 |
+
|
| 143 |
+
# PodNerModel
|
| 144 |
+
def LabelsIsNone(self):
|
| 145 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 146 |
+
return o == 0
|
| 147 |
+
|
| 148 |
+
# PodNerModel
|
| 149 |
+
def MaxRatioUnknownWordpieces(self):
|
| 150 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 151 |
+
if o != 0:
|
| 152 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 153 |
+
return 0.1
|
| 154 |
+
|
| 155 |
+
# PodNerModel
|
| 156 |
+
def Collections(self, j):
|
| 157 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 158 |
+
if o != 0:
|
| 159 |
+
x = self._tab.Vector(o)
|
| 160 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 161 |
+
x = self._tab.Indirect(x)
|
| 162 |
+
from libtextclassifier3.PodNerModel_.Collection import Collection
|
| 163 |
+
obj = Collection()
|
| 164 |
+
obj.Init(self._tab.Bytes, x)
|
| 165 |
+
return obj
|
| 166 |
+
return None
|
| 167 |
+
|
| 168 |
+
# PodNerModel
|
| 169 |
+
def CollectionsLength(self):
|
| 170 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 171 |
+
if o != 0:
|
| 172 |
+
return self._tab.VectorLen(o)
|
| 173 |
+
return 0
|
| 174 |
+
|
| 175 |
+
# PodNerModel
|
| 176 |
+
def CollectionsIsNone(self):
|
| 177 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
| 178 |
+
return o == 0
|
| 179 |
+
|
| 180 |
+
# PodNerModel
|
| 181 |
+
def MinNumberOfTokens(self):
|
| 182 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
| 183 |
+
if o != 0:
|
| 184 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 185 |
+
return 1
|
| 186 |
+
|
| 187 |
+
# PodNerModel
|
| 188 |
+
def MinNumberOfWordpieces(self):
|
| 189 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
|
| 190 |
+
if o != 0:
|
| 191 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 192 |
+
return 1
|
| 193 |
+
|
| 194 |
+
def PodNerModelStart(builder): builder.StartObject(14)
|
| 195 |
+
def PodNerModelAddTfliteModel(builder, tfliteModel): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(tfliteModel), 0)
|
| 196 |
+
def PodNerModelStartTfliteModelVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
| 197 |
+
def PodNerModelAddWordPieceVocab(builder, wordPieceVocab): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(wordPieceVocab), 0)
|
| 198 |
+
def PodNerModelStartWordPieceVocabVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
| 199 |
+
def PodNerModelAddLowercaseInput(builder, lowercaseInput): builder.PrependBoolSlot(2, lowercaseInput, 1)
|
| 200 |
+
def PodNerModelAddLogitsIndexInOutputTensor(builder, logitsIndexInOutputTensor): builder.PrependInt32Slot(3, logitsIndexInOutputTensor, 0)
|
| 201 |
+
def PodNerModelAddAppendFinalPeriod(builder, appendFinalPeriod): builder.PrependBoolSlot(4, appendFinalPeriod, 0)
|
| 202 |
+
def PodNerModelAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(5, priorityScore, 0.0)
|
| 203 |
+
def PodNerModelAddMaxNumWordpieces(builder, maxNumWordpieces): builder.PrependInt32Slot(6, maxNumWordpieces, 128)
|
| 204 |
+
def PodNerModelAddSlidingWindowNumWordpiecesOverlap(builder, slidingWindowNumWordpiecesOverlap): builder.PrependInt32Slot(7, slidingWindowNumWordpiecesOverlap, 20)
|
| 205 |
+
def PodNerModelAddLabels(builder, labels): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(labels), 0)
|
| 206 |
+
def PodNerModelStartLabelsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 207 |
+
def PodNerModelAddMaxRatioUnknownWordpieces(builder, maxRatioUnknownWordpieces): builder.PrependFloat32Slot(10, maxRatioUnknownWordpieces, 0.1)
|
| 208 |
+
def PodNerModelAddCollections(builder, collections): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(collections), 0)
|
| 209 |
+
def PodNerModelStartCollectionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 210 |
+
def PodNerModelAddMinNumberOfTokens(builder, minNumberOfTokens): builder.PrependInt32Slot(12, minNumberOfTokens, 1)
|
| 211 |
+
def PodNerModelAddMinNumberOfWordpieces(builder, minNumberOfWordpieces): builder.PrependInt32Slot(13, minNumberOfWordpieces, 1)
|
| 212 |
+
def PodNerModelEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/PodNerModel_/Collection.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: PodNerModel_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class Collection(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsCollection(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = Collection()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def CollectionBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# Collection
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# Collection
|
| 28 |
+
def Name(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# Collection
|
| 35 |
+
def SingleTokenPriorityScore(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 39 |
+
return 0.0
|
| 40 |
+
|
| 41 |
+
# Collection
|
| 42 |
+
def MultiTokenPriorityScore(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0.0
|
| 47 |
+
|
| 48 |
+
def CollectionStart(builder): builder.StartObject(3)
|
| 49 |
+
def CollectionAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
|
| 50 |
+
def CollectionAddSingleTokenPriorityScore(builder, singleTokenPriorityScore): builder.PrependFloat32Slot(1, singleTokenPriorityScore, 0.0)
|
| 51 |
+
def CollectionAddMultiTokenPriorityScore(builder, multiTokenPriorityScore): builder.PrependFloat32Slot(2, multiTokenPriorityScore, 0.0)
|
| 52 |
+
def CollectionEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/PodNerModel_/Label.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: PodNerModel_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class Label(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsLabel(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = Label()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def LabelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# Label
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# Label
|
| 28 |
+
def BoiseType(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 32 |
+
return 0
|
| 33 |
+
|
| 34 |
+
# Label
|
| 35 |
+
def MentionType(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return 0
|
| 40 |
+
|
| 41 |
+
# Label
|
| 42 |
+
def CollectionId(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0
|
| 47 |
+
|
| 48 |
+
def LabelStart(builder): builder.StartObject(3)
|
| 49 |
+
def LabelAddBoiseType(builder, boiseType): builder.PrependInt32Slot(0, boiseType, 0)
|
| 50 |
+
def LabelAddMentionType(builder, mentionType): builder.PrependInt32Slot(1, mentionType, 0)
|
| 51 |
+
def LabelAddCollectionId(builder, collectionId): builder.PrependInt32Slot(2, collectionId, 0)
|
| 52 |
+
def LabelEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/PodNerModel_/Label_/BoiseType.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: Label_
|
| 4 |
+
|
| 5 |
+
class BoiseType(object):
|
| 6 |
+
NONE = 0
|
| 7 |
+
BEGIN = 1
|
| 8 |
+
O = 2
|
| 9 |
+
INTERMEDIATE = 3
|
| 10 |
+
SINGLE = 4
|
| 11 |
+
END = 5
|
| 12 |
+
|
19/libtextclassifier3/PodNerModel_/Label_/MentionType.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: Label_
|
| 4 |
+
|
| 5 |
+
class MentionType(object):
|
| 6 |
+
UNDEFINED = 0
|
| 7 |
+
NAM = 1
|
| 8 |
+
NOM = 2
|
| 9 |
+
|
19/libtextclassifier3/PodNerModel_/Label_/__init__.py
ADDED
|
File without changes
|
19/libtextclassifier3/PodNerModel_/__init__.py
ADDED
|
File without changes
|
19/libtextclassifier3/RegexModel.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class RegexModel(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsRegexModel(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = RegexModel()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def RegexModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# RegexModel
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# RegexModel
|
| 28 |
+
def Patterns(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
x = self._tab.Vector(o)
|
| 32 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 33 |
+
x = self._tab.Indirect(x)
|
| 34 |
+
from libtextclassifier3.RegexModel_.Pattern import Pattern
|
| 35 |
+
obj = Pattern()
|
| 36 |
+
obj.Init(self._tab.Bytes, x)
|
| 37 |
+
return obj
|
| 38 |
+
return None
|
| 39 |
+
|
| 40 |
+
# RegexModel
|
| 41 |
+
def PatternsLength(self):
|
| 42 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 43 |
+
if o != 0:
|
| 44 |
+
return self._tab.VectorLen(o)
|
| 45 |
+
return 0
|
| 46 |
+
|
| 47 |
+
# RegexModel
|
| 48 |
+
def PatternsIsNone(self):
|
| 49 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 50 |
+
return o == 0
|
| 51 |
+
|
| 52 |
+
# RegexModel
|
| 53 |
+
def LazyRegexCompilation(self):
|
| 54 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 55 |
+
if o != 0:
|
| 56 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 57 |
+
return True
|
| 58 |
+
|
| 59 |
+
# RegexModel
|
| 60 |
+
def LuaVerifier(self, j):
|
| 61 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 62 |
+
if o != 0:
|
| 63 |
+
a = self._tab.Vector(o)
|
| 64 |
+
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
| 65 |
+
return ""
|
| 66 |
+
|
| 67 |
+
# RegexModel
|
| 68 |
+
def LuaVerifierLength(self):
|
| 69 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 70 |
+
if o != 0:
|
| 71 |
+
return self._tab.VectorLen(o)
|
| 72 |
+
return 0
|
| 73 |
+
|
| 74 |
+
# RegexModel
|
| 75 |
+
def LuaVerifierIsNone(self):
|
| 76 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 77 |
+
return o == 0
|
| 78 |
+
|
| 79 |
+
def RegexModelStart(builder): builder.StartObject(3)
|
| 80 |
+
def RegexModelAddPatterns(builder, patterns): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(patterns), 0)
|
| 81 |
+
def RegexModelStartPatternsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 82 |
+
def RegexModelAddLazyRegexCompilation(builder, lazyRegexCompilation): builder.PrependBoolSlot(1, lazyRegexCompilation, 1)
|
| 83 |
+
def RegexModelAddLuaVerifier(builder, luaVerifier): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(luaVerifier), 0)
|
| 84 |
+
def RegexModelStartLuaVerifierVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 85 |
+
def RegexModelEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/RegexModel_/Pattern.py
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: RegexModel_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class Pattern(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsPattern(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = Pattern()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def PatternBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# Pattern
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# Pattern
|
| 28 |
+
def CollectionName(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.String(o + self._tab.Pos)
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
# Pattern
|
| 35 |
+
def Pattern(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.String(o + self._tab.Pos)
|
| 39 |
+
return None
|
| 40 |
+
|
| 41 |
+
# Pattern
|
| 42 |
+
def EnabledModes(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 46 |
+
return 7
|
| 47 |
+
|
| 48 |
+
# Pattern
|
| 49 |
+
def TargetClassificationScore(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 53 |
+
return 1.0
|
| 54 |
+
|
| 55 |
+
# Pattern
|
| 56 |
+
def PriorityScore(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 58 |
+
if o != 0:
|
| 59 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 60 |
+
return 0.0
|
| 61 |
+
|
| 62 |
+
# Pattern
|
| 63 |
+
def UseApproximateMatching(self):
|
| 64 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 65 |
+
if o != 0:
|
| 66 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 67 |
+
return False
|
| 68 |
+
|
| 69 |
+
# Pattern
|
| 70 |
+
def CompressedPattern(self):
|
| 71 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
| 72 |
+
if o != 0:
|
| 73 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 74 |
+
from libtextclassifier3.CompressedBuffer import CompressedBuffer
|
| 75 |
+
obj = CompressedBuffer()
|
| 76 |
+
obj.Init(self._tab.Bytes, x)
|
| 77 |
+
return obj
|
| 78 |
+
return None
|
| 79 |
+
|
| 80 |
+
# Pattern
|
| 81 |
+
def VerificationOptions(self):
|
| 82 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
| 83 |
+
if o != 0:
|
| 84 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 85 |
+
from libtextclassifier3.VerificationOptions import VerificationOptions
|
| 86 |
+
obj = VerificationOptions()
|
| 87 |
+
obj.Init(self._tab.Bytes, x)
|
| 88 |
+
return obj
|
| 89 |
+
return None
|
| 90 |
+
|
| 91 |
+
# Pattern
|
| 92 |
+
def CapturingGroup(self, j):
|
| 93 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 94 |
+
if o != 0:
|
| 95 |
+
x = self._tab.Vector(o)
|
| 96 |
+
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
| 97 |
+
x = self._tab.Indirect(x)
|
| 98 |
+
from libtextclassifier3.CapturingGroup import CapturingGroup
|
| 99 |
+
obj = CapturingGroup()
|
| 100 |
+
obj.Init(self._tab.Bytes, x)
|
| 101 |
+
return obj
|
| 102 |
+
return None
|
| 103 |
+
|
| 104 |
+
# Pattern
|
| 105 |
+
def CapturingGroupLength(self):
|
| 106 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 107 |
+
if o != 0:
|
| 108 |
+
return self._tab.VectorLen(o)
|
| 109 |
+
return 0
|
| 110 |
+
|
| 111 |
+
# Pattern
|
| 112 |
+
def CapturingGroupIsNone(self):
|
| 113 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
| 114 |
+
return o == 0
|
| 115 |
+
|
| 116 |
+
# Pattern
|
| 117 |
+
def SerializedEntityData(self):
|
| 118 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
| 119 |
+
if o != 0:
|
| 120 |
+
return self._tab.String(o + self._tab.Pos)
|
| 121 |
+
return None
|
| 122 |
+
|
| 123 |
+
# Pattern
|
| 124 |
+
def EntityData(self):
|
| 125 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
| 126 |
+
if o != 0:
|
| 127 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 128 |
+
from libtextclassifier3.EntityData import EntityData
|
| 129 |
+
obj = EntityData()
|
| 130 |
+
obj.Init(self._tab.Bytes, x)
|
| 131 |
+
return obj
|
| 132 |
+
return None
|
| 133 |
+
|
| 134 |
+
def PatternStart(builder): builder.StartObject(11)
|
| 135 |
+
def PatternAddCollectionName(builder, collectionName): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(collectionName), 0)
|
| 136 |
+
def PatternAddPattern(builder, pattern): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(pattern), 0)
|
| 137 |
+
def PatternAddEnabledModes(builder, enabledModes): builder.PrependInt32Slot(2, enabledModes, 7)
|
| 138 |
+
def PatternAddTargetClassificationScore(builder, targetClassificationScore): builder.PrependFloat32Slot(3, targetClassificationScore, 1.0)
|
| 139 |
+
def PatternAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(4, priorityScore, 0.0)
|
| 140 |
+
def PatternAddUseApproximateMatching(builder, useApproximateMatching): builder.PrependBoolSlot(5, useApproximateMatching, 0)
|
| 141 |
+
def PatternAddCompressedPattern(builder, compressedPattern): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(compressedPattern), 0)
|
| 142 |
+
def PatternAddVerificationOptions(builder, verificationOptions): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(verificationOptions), 0)
|
| 143 |
+
def PatternAddCapturingGroup(builder, capturingGroup): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(capturingGroup), 0)
|
| 144 |
+
def PatternStartCapturingGroupVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
| 145 |
+
def PatternAddSerializedEntityData(builder, serializedEntityData): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(serializedEntityData), 0)
|
| 146 |
+
def PatternAddEntityData(builder, entityData): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(entityData), 0)
|
| 147 |
+
def PatternEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/SelectionModelOptions.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class SelectionModelOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsSelectionModelOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = SelectionModelOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def SelectionModelOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# SelectionModelOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# SelectionModelOptions
|
| 28 |
+
def StripUnpairedBrackets(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return True
|
| 33 |
+
|
| 34 |
+
# SelectionModelOptions
|
| 35 |
+
def SymmetryContextSize(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return 0
|
| 40 |
+
|
| 41 |
+
# SelectionModelOptions
|
| 42 |
+
def BatchSize(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 46 |
+
return 1024
|
| 47 |
+
|
| 48 |
+
# SelectionModelOptions
|
| 49 |
+
def AlwaysClassifySuggestedSelection(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 53 |
+
return False
|
| 54 |
+
|
| 55 |
+
def SelectionModelOptionsStart(builder): builder.StartObject(4)
|
| 56 |
+
def SelectionModelOptionsAddStripUnpairedBrackets(builder, stripUnpairedBrackets): builder.PrependBoolSlot(0, stripUnpairedBrackets, 1)
|
| 57 |
+
def SelectionModelOptionsAddSymmetryContextSize(builder, symmetryContextSize): builder.PrependInt32Slot(1, symmetryContextSize, 0)
|
| 58 |
+
def SelectionModelOptionsAddBatchSize(builder, batchSize): builder.PrependInt32Slot(2, batchSize, 1024)
|
| 59 |
+
def SelectionModelOptionsAddAlwaysClassifySuggestedSelection(builder, alwaysClassifySuggestedSelection): builder.PrependBoolSlot(3, alwaysClassifySuggestedSelection, 0)
|
| 60 |
+
def SelectionModelOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/TranslateAnnotatorOptions.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class TranslateAnnotatorOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsTranslateAnnotatorOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = TranslateAnnotatorOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def TranslateAnnotatorOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# TranslateAnnotatorOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# TranslateAnnotatorOptions
|
| 28 |
+
def Enabled(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# TranslateAnnotatorOptions
|
| 35 |
+
def Score(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 39 |
+
return 1.0
|
| 40 |
+
|
| 41 |
+
# TranslateAnnotatorOptions
|
| 42 |
+
def PriorityScore(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0.0
|
| 47 |
+
|
| 48 |
+
# TranslateAnnotatorOptions
|
| 49 |
+
def Algorithm(self):
|
| 50 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 51 |
+
if o != 0:
|
| 52 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 53 |
+
return 0
|
| 54 |
+
|
| 55 |
+
# TranslateAnnotatorOptions
|
| 56 |
+
def BackoffOptions(self):
|
| 57 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 58 |
+
if o != 0:
|
| 59 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 60 |
+
from libtextclassifier3.TranslateAnnotatorOptions_.BackoffOptions import BackoffOptions
|
| 61 |
+
obj = BackoffOptions()
|
| 62 |
+
obj.Init(self._tab.Bytes, x)
|
| 63 |
+
return obj
|
| 64 |
+
return None
|
| 65 |
+
|
| 66 |
+
def TranslateAnnotatorOptionsStart(builder): builder.StartObject(5)
|
| 67 |
+
def TranslateAnnotatorOptionsAddEnabled(builder, enabled): builder.PrependBoolSlot(0, enabled, 0)
|
| 68 |
+
def TranslateAnnotatorOptionsAddScore(builder, score): builder.PrependFloat32Slot(1, score, 1.0)
|
| 69 |
+
def TranslateAnnotatorOptionsAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(2, priorityScore, 0.0)
|
| 70 |
+
def TranslateAnnotatorOptionsAddAlgorithm(builder, algorithm): builder.PrependInt32Slot(3, algorithm, 0)
|
| 71 |
+
def TranslateAnnotatorOptionsAddBackoffOptions(builder, backoffOptions): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(backoffOptions), 0)
|
| 72 |
+
def TranslateAnnotatorOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/TranslateAnnotatorOptions_/Algorithm.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: TranslateAnnotatorOptions_
|
| 4 |
+
|
| 5 |
+
class Algorithm(object):
|
| 6 |
+
DEFAULT_ALGORITHM = 0
|
| 7 |
+
BACKOFF = 1
|
| 8 |
+
|
19/libtextclassifier3/TranslateAnnotatorOptions_/BackoffOptions.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: TranslateAnnotatorOptions_
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class BackoffOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsBackoffOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = BackoffOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def BackoffOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# BackoffOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# BackoffOptions
|
| 28 |
+
def MinTextSize(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 32 |
+
return 20
|
| 33 |
+
|
| 34 |
+
# BackoffOptions
|
| 35 |
+
def PenalizeRatio(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 39 |
+
return 1.0
|
| 40 |
+
|
| 41 |
+
# BackoffOptions
|
| 42 |
+
def SubjectTextScoreRatio(self):
|
| 43 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 44 |
+
if o != 0:
|
| 45 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 46 |
+
return 0.4
|
| 47 |
+
|
| 48 |
+
def BackoffOptionsStart(builder): builder.StartObject(3)
|
| 49 |
+
def BackoffOptionsAddMinTextSize(builder, minTextSize): builder.PrependInt32Slot(0, minTextSize, 20)
|
| 50 |
+
def BackoffOptionsAddPenalizeRatio(builder, penalizeRatio): builder.PrependFloat32Slot(1, penalizeRatio, 1.0)
|
| 51 |
+
def BackoffOptionsAddSubjectTextScoreRatio(builder, subjectTextScoreRatio): builder.PrependFloat32Slot(2, subjectTextScoreRatio, 0.4)
|
| 52 |
+
def BackoffOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/TranslateAnnotatorOptions_/__init__.py
ADDED
|
File without changes
|
19/libtextclassifier3/VerificationOptions.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class VerificationOptions(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsVerificationOptions(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = VerificationOptions()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def VerificationOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# VerificationOptions
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# VerificationOptions
|
| 28 |
+
def VerifyLuhnChecksum(self):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
|
| 32 |
+
return False
|
| 33 |
+
|
| 34 |
+
# VerificationOptions
|
| 35 |
+
def LuaVerifier(self):
|
| 36 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 37 |
+
if o != 0:
|
| 38 |
+
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
| 39 |
+
return -1
|
| 40 |
+
|
| 41 |
+
def VerificationOptionsStart(builder): builder.StartObject(2)
|
| 42 |
+
def VerificationOptionsAddVerifyLuhnChecksum(builder, verifyLuhnChecksum): builder.PrependBoolSlot(0, verifyLuhnChecksum, 0)
|
| 43 |
+
def VerificationOptionsAddLuaVerifier(builder, luaVerifier): builder.PrependInt32Slot(1, luaVerifier, -1)
|
| 44 |
+
def VerificationOptionsEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/VocabModel.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# automatically generated by the FlatBuffers compiler, do not modify
|
| 2 |
+
|
| 3 |
+
# namespace: libtextclassifier3
|
| 4 |
+
|
| 5 |
+
import flatbuffers
|
| 6 |
+
from flatbuffers.compat import import_numpy
|
| 7 |
+
np = import_numpy()
|
| 8 |
+
|
| 9 |
+
class VocabModel(object):
|
| 10 |
+
__slots__ = ['_tab']
|
| 11 |
+
|
| 12 |
+
@classmethod
|
| 13 |
+
def GetRootAsVocabModel(cls, buf, offset):
|
| 14 |
+
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
| 15 |
+
x = VocabModel()
|
| 16 |
+
x.Init(buf, n + offset)
|
| 17 |
+
return x
|
| 18 |
+
|
| 19 |
+
@classmethod
|
| 20 |
+
def VocabModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
| 21 |
+
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
|
| 22 |
+
|
| 23 |
+
# VocabModel
|
| 24 |
+
def Init(self, buf, pos):
|
| 25 |
+
self._tab = flatbuffers.table.Table(buf, pos)
|
| 26 |
+
|
| 27 |
+
# VocabModel
|
| 28 |
+
def VocabTrie(self, j):
|
| 29 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 30 |
+
if o != 0:
|
| 31 |
+
a = self._tab.Vector(o)
|
| 32 |
+
return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
| 33 |
+
return 0
|
| 34 |
+
|
| 35 |
+
# VocabModel
|
| 36 |
+
def VocabTrieAsNumpy(self):
|
| 37 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 38 |
+
if o != 0:
|
| 39 |
+
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
|
| 40 |
+
return 0
|
| 41 |
+
|
| 42 |
+
# VocabModel
|
| 43 |
+
def VocabTrieLength(self):
|
| 44 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 45 |
+
if o != 0:
|
| 46 |
+
return self._tab.VectorLen(o)
|
| 47 |
+
return 0
|
| 48 |
+
|
| 49 |
+
# VocabModel
|
| 50 |
+
def VocabTrieIsNone(self):
|
| 51 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
| 52 |
+
return o == 0
|
| 53 |
+
|
| 54 |
+
# VocabModel
|
| 55 |
+
def BeginnerLevel(self):
|
| 56 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
| 57 |
+
if o != 0:
|
| 58 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 59 |
+
from libtextclassifier3.BitVectorData import BitVectorData
|
| 60 |
+
obj = BitVectorData()
|
| 61 |
+
obj.Init(self._tab.Bytes, x)
|
| 62 |
+
return obj
|
| 63 |
+
return None
|
| 64 |
+
|
| 65 |
+
# VocabModel
|
| 66 |
+
def DoNotTriggerInUpperCase(self):
|
| 67 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
| 68 |
+
if o != 0:
|
| 69 |
+
x = self._tab.Indirect(o + self._tab.Pos)
|
| 70 |
+
from libtextclassifier3.BitVectorData import BitVectorData
|
| 71 |
+
obj = BitVectorData()
|
| 72 |
+
obj.Init(self._tab.Bytes, x)
|
| 73 |
+
return obj
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
# VocabModel
|
| 77 |
+
def TriggeringLocales(self):
|
| 78 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
| 79 |
+
if o != 0:
|
| 80 |
+
return self._tab.String(o + self._tab.Pos)
|
| 81 |
+
return None
|
| 82 |
+
|
| 83 |
+
# VocabModel
|
| 84 |
+
def TargetClassificationScore(self):
|
| 85 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
| 86 |
+
if o != 0:
|
| 87 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 88 |
+
return 1.0
|
| 89 |
+
|
| 90 |
+
# VocabModel
|
| 91 |
+
def PriorityScore(self):
|
| 92 |
+
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
| 93 |
+
if o != 0:
|
| 94 |
+
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
| 95 |
+
return 0.0
|
| 96 |
+
|
| 97 |
+
def VocabModelStart(builder): builder.StartObject(6)
|
| 98 |
+
def VocabModelAddVocabTrie(builder, vocabTrie): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(vocabTrie), 0)
|
| 99 |
+
def VocabModelStartVocabTrieVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
| 100 |
+
def VocabModelAddBeginnerLevel(builder, beginnerLevel): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(beginnerLevel), 0)
|
| 101 |
+
def VocabModelAddDoNotTriggerInUpperCase(builder, doNotTriggerInUpperCase): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(doNotTriggerInUpperCase), 0)
|
| 102 |
+
def VocabModelAddTriggeringLocales(builder, triggeringLocales): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(triggeringLocales), 0)
|
| 103 |
+
def VocabModelAddTargetClassificationScore(builder, targetClassificationScore): builder.PrependFloat32Slot(4, targetClassificationScore, 1.0)
|
| 104 |
+
def VocabModelAddPriorityScore(builder, priorityScore): builder.PrependFloat32Slot(5, priorityScore, 0.0)
|
| 105 |
+
def VocabModelEnd(builder): return builder.EndObject()
|
19/libtextclassifier3/__init__.py
ADDED
|
File without changes
|
19/libtextclassifier3/__pycache__/FeatureProcessorOptions.cpython-310.pyc
ADDED
|
Binary file (18.3 kB). View file
|
|
|
19/libtextclassifier3/__pycache__/Model.cpython-310.pyc
ADDED
|
Binary file (16.3 kB). View file
|
|
|