# 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()