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
示例#2
0
 def deserialize(self, stream: Stream, all0_: typing.List['Referent'],
                 sofa: 'SourceOfAnalysis') -> None:
     typ = SerializerHelper.deserialize_string(stream)
     cou = SerializerHelper.deserialize_int(stream)
     i = 0
     while i < cou:
         typ = SerializerHelper.deserialize_string(stream)
         c = SerializerHelper.deserialize_int(stream)
         id0_ = SerializerHelper.deserialize_int(stream)
         val = None
         if ((id0_ < 0) and all0_ is not None):
             id1 = (-id0_) - 1
             if (id1 < len(all0_)):
                 val = (all0_[id1])
         elif (id0_ > 0):
             stream.position = stream.position - (4)
             val = (SerializerHelper.deserialize_string(stream))
         self.add_slot(typ, val, False, c)
         i += 1
     cou = SerializerHelper.deserialize_int(stream)
     self.__m_occurrence = list()
     i = 0
     while i < cou:
         a = TextAnnotation._new2863(sofa, self)
         self.__m_occurrence.append(a)
         a.begin_char = SerializerHelper.deserialize_int(stream)
         a.end_char = SerializerHelper.deserialize_int(stream)
         attr = SerializerHelper.deserialize_int(stream)
         if (((attr & 1)) != 0):
             a.essential_for_occurence = True
         i += 1
示例#3
0
 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(self, stream: Stream) -> None:
     self.ext_id = (SerializerHelper.deserialize_string(stream))
     self.__m_caption = SerializerHelper.deserialize_string(stream)
     cou = SerializerHelper.deserialize_int(stream)
     if (cou > 0):
         self._refs = list()
         while cou > 0:
             typ = SerializerHelper.deserialize_string(stream)
             r = ProcessorService.create_referent(typ)
             r.deserialize(stream, self._refs, None)
             self._refs.append(r)
             cou -= 1
     self.type_name = SerializerHelper.deserialize_string(stream)
     self.referent = ProcessorService.create_referent(self.type_name)
     self.referent.deserialize(stream, self._refs, None)
示例#5
0
 def deserialize(self, stream: Stream) -> bool:
     vers = 0
     b = stream.readbyte()
     if (b == (0xAA)):
         b = (stream.readbyte())
         vers = (b)
     else:
         stream.position = stream.position - (1)
     self.__m_sofa = SourceOfAnalysis(None)
     self.__m_sofa.deserialize(stream)
     self.base_language = MorphLang._new56(
         SerializerHelper.deserialize_int(stream))
     self.__m_entities = list()
     cou = SerializerHelper.deserialize_int(stream)
     i = 0
     while i < cou:
         typ = SerializerHelper.deserialize_string(stream)
         r = ProcessorService.create_referent(typ)
         if (r is None):
             r = Referent("UNDEFINED")
         self.__m_entities.append(r)
         i += 1
     i = 0
     while i < cou:
         self.__m_entities[i].deserialize(stream, self.__m_entities,
                                          self.__m_sofa)
         i += 1
     self.first_token = SerializerHelper.deserialize_tokens(
         stream, self, vers)
     self.__create_statistics()
     return True
示例#6
0
 def _deserialize(self, stream: Stream, kit_: 'AnalysisKit',
                  vers: int) -> None:
     from pullenti.ner.core.internal.SerializerHelper import SerializerHelper
     super()._deserialize(stream, kit_, vers)
     if (vers == 0):
         buf = Utils.newArrayOfBytes(8, 0)
         stream.read(buf, 0, 8)
         lo = int.from_bytes(buf[0:0 + 8], byteorder="little")
         self.value = str(lo)
     else:
         self.value = SerializerHelper.deserialize_string(stream)
     self.typ = (Utils.valToEnum(SerializerHelper.deserialize_int(stream),
                                 NumberSpellingType))
示例#7
0
 def deserialize(self, stream: Stream) -> None:
     """ Восстановить словарь из потока
     
     Args:
         stream(Stream): поток для десериализации
     """
     self.__m_specs = SerializerHelper.deserialize_string(stream)
     self.__init()
     cou = SerializerHelper.deserialize_int(stream)
     while cou > 0:
         it = ExtOntologyItem()
         it._deserialize(stream)
         self.items.append(it)
         cou -= 1
     self.__init_hash()
示例#8
0
 def deserialize(self, stream: Stream) -> None:
     self.text = SerializerHelper.deserialize_string(stream)