def _deserialize(self, stream: Stream, kit_: 'AnalysisKit', vers: int) -> None: from pullenti.ner.core.internal.SerializerHelper import SerializerHelper super()._deserialize(stream, kit_, vers) self.term = SerializerHelper.deserialize_string(stream) self.lemma = SerializerHelper.deserialize_string(stream) self.invariant_prefix_length_of_morph_vars = SerializerHelper.deserialize_short( stream) self.max_length_of_morph_vars = SerializerHelper.deserialize_short( stream)
def __deserialize_item(self, stream: Stream) -> 'MorphBaseInfo': from pullenti.ner.core.internal.SerializerHelper import SerializerHelper ty = stream.readbyte() res = (MorphBaseInfo() if ty == 0 else MorphWordForm()) res.class0_ = MorphClass._new53( SerializerHelper.deserialize_short(stream)) res.case_ = MorphCase._new29( SerializerHelper.deserialize_short(stream)) res.gender = Utils.valToEnum( SerializerHelper.deserialize_short(stream), MorphGender) res.number = Utils.valToEnum( SerializerHelper.deserialize_short(stream), MorphNumber) res.language = MorphLang._new56( SerializerHelper.deserialize_short(stream)) if (ty == 0): return res wf = Utils.asObjectOrNull(res, MorphWordForm) wf.normal_case = SerializerHelper.deserialize_string(stream) wf.normal_full = SerializerHelper.deserialize_string(stream) wf.undef_coef = SerializerHelper.deserialize_short(stream) cou = SerializerHelper.deserialize_int(stream) i = 0 while i < cou: if (wf.misc is None): wf.misc = MorphMiscInfo() wf.misc.attrs.append(SerializerHelper.deserialize_string(stream)) i += 1 return res
def _deserialize(self, stream: Stream) -> None: from pullenti.ner.core.internal.SerializerHelper import SerializerHelper self.__m_class = MorphClass._new53( SerializerHelper.deserialize_short(stream)) self.__m_case = MorphCase._new29( SerializerHelper.deserialize_short(stream)) self.__m_gender = (Utils.valToEnum( SerializerHelper.deserialize_short(stream), MorphGender)) self.__m_number = (Utils.valToEnum( SerializerHelper.deserialize_short(stream), MorphNumber)) self.__m_voice = (Utils.valToEnum( SerializerHelper.deserialize_short(stream), MorphVoice)) self.__m_language = MorphLang._new56( SerializerHelper.deserialize_short(stream)) cou = SerializerHelper.deserialize_int(stream) self.__m_items = list() i = 0 while i < cou: it = self.__deserialize_item(stream) if (it is not None): self.__m_items.append(it) i += 1 self.__m_need_recalc = False