def _serialize(self, stream: io.IOBase) -> None: from pullenti.ner.core.internal.SerializerHelper import SerializerHelper super()._serialize(stream) SerializerHelper.serializeString(stream, self.term) SerializerHelper.serializeString(stream, self.lemma) SerializerHelper.serializeShort(stream, self.invariant_prefix_length) SerializerHelper.serializeShort(stream, self.max_length)
def serialize(self, stream: io.IOBase) -> None: SerializerHelper.serializeString(stream, self.type_name) SerializerHelper.serializeInt(stream, len(self.__m_slots)) for s in self.__m_slots: SerializerHelper.serializeString(stream, s.type_name) SerializerHelper.serializeInt(stream, s.count) if ((isinstance(s.value, Referent)) and (isinstance( (s.value).tag, int))): SerializerHelper.serializeInt(stream, -((s.value).tag)) elif (isinstance(s.value, str)): SerializerHelper.serializeString( stream, Utils.asObjectOrNull(s.value, str)) elif (s.value is None): SerializerHelper.serializeInt(stream, 0) else: SerializerHelper.serializeString(stream, str(s.value)) if (self.__m_occurrence is None): SerializerHelper.serializeInt(stream, 0) else: SerializerHelper.serializeInt(stream, len(self.__m_occurrence)) for o in self.__m_occurrence: SerializerHelper.serializeInt(stream, o.begin_char) SerializerHelper.serializeInt(stream, o.end_char) attr = 0 if (o.essential_for_occurence): attr = 1 SerializerHelper.serializeInt(stream, attr)
def serialize(self, stream : io.IOBase) -> None: Utils.writeByteIO(stream, 0xAA) Utils.writeByteIO(stream, 1) self.__m_sofa.serialize(stream) SerializerHelper.serializeInt(stream, self.base_language.value) if (len(self.__m_entities) == 0): for d in self.__m_datas.items(): self.__m_entities.extend(d[1].referents) SerializerHelper.serializeInt(stream, len(self.__m_entities)) i = 0 while i < len(self.__m_entities): self.__m_entities[i].tag = i + 1 SerializerHelper.serializeString(stream, self.__m_entities[i].type_name) i += 1 for e0_ in self.__m_entities: e0_.serialize(stream) SerializerHelper.serializeTokens(stream, self.first_token, 0)
def _serialize(self, stream: io.IOBase) -> None: from pullenti.ner.core.internal.SerializerHelper import SerializerHelper super()._serialize(stream) SerializerHelper.serializeString(stream, self.__m_value) SerializerHelper.serializeInt(stream, self.typ)
def serialize(self, stream: io.IOBase) -> None: SerializerHelper.serializeString(stream, self.text)