Пример #1
0
 def _serialize(self, stream: Stream) -> None:
     from pullenti.ner.core.internal.SerializerHelper import SerializerHelper
     super()._serialize(stream)
     SerializerHelper.serialize_string(stream, self.term)
     SerializerHelper.serialize_string(stream, self.lemma)
     SerializerHelper.serialize_short(
         stream, self.invariant_prefix_length_of_morph_vars)
     SerializerHelper.serialize_short(stream, self.max_length_of_morph_vars)
Пример #2
0
 def __serialize_item(self, stream: Stream, bi: 'MorphBaseInfo') -> None:
     from pullenti.ner.core.internal.SerializerHelper import SerializerHelper
     ty = 0
     if (isinstance(bi, MorphWordForm)):
         ty = (1)
     stream.writebyte(ty)
     SerializerHelper.serialize_short(stream, bi.class0_.value)
     SerializerHelper.serialize_short(stream, bi.case_.value)
     SerializerHelper.serialize_short(stream, bi.gender)
     SerializerHelper.serialize_short(stream, bi.number)
     SerializerHelper.serialize_short(stream, bi.language.value)
     wf = Utils.asObjectOrNull(bi, MorphWordForm)
     if (wf is None):
         return
     SerializerHelper.serialize_string(stream, wf.normal_case)
     SerializerHelper.serialize_string(stream, wf.normal_full)
     SerializerHelper.serialize_short(stream, wf.undef_coef)
     SerializerHelper.serialize_int(
         stream, (0 if wf.misc is None else len(wf.misc.attrs)))
     if (wf.misc is not None):
         for a in wf.misc.attrs:
             SerializerHelper.serialize_string(stream, a)
Пример #3
0
 def _serialize(self, stream: Stream) -> None:
     from pullenti.ner.core.internal.SerializerHelper import SerializerHelper
     SerializerHelper.serialize_short(stream, self.__m_class.value)
     SerializerHelper.serialize_short(stream, self.__m_case.value)
     SerializerHelper.serialize_short(stream, self.__m_gender)
     SerializerHelper.serialize_short(stream, self.__m_number)
     SerializerHelper.serialize_short(stream, self.__m_voice)
     SerializerHelper.serialize_short(stream, self.__m_language.value)
     if (self.__m_items is None):
         self.__m_items = list()
     SerializerHelper.serialize_int(stream, len(self.__m_items))
     for it in self.__m_items:
         self.__serialize_item(stream, it)