File size: 2,039 Bytes
4c8c729 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: TranslateAnnotatorOptions_
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class BackoffOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsBackoffOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = BackoffOptions()
x.Init(buf, n + offset)
return x
@classmethod
def BackoffOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed)
# BackoffOptions
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# BackoffOptions
def MinTextSize(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 20
# BackoffOptions
def PenalizeRatio(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
return 1.0
# BackoffOptions
def SubjectTextScoreRatio(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
return 0.4
def BackoffOptionsStart(builder): builder.StartObject(3)
def BackoffOptionsAddMinTextSize(builder, minTextSize): builder.PrependInt32Slot(0, minTextSize, 20)
def BackoffOptionsAddPenalizeRatio(builder, penalizeRatio): builder.PrependFloat32Slot(1, penalizeRatio, 1.0)
def BackoffOptionsAddSubjectTextScoreRatio(builder, subjectTextScoreRatio): builder.PrependFloat32Slot(2, subjectTextScoreRatio, 0.4)
def BackoffOptionsEnd(builder): return builder.EndObject()
|