Exemple #1
0
 def deserialize(self, stream: io.IOBase, all0_: typing.List['Referent'],
                 sofa: 'SourceOfAnalysis') -> None:
     typ = SerializerHelper.deserializeString(stream)
     cou = SerializerHelper.deserializeInt(stream)
     i = 0
     while i < cou:
         typ = SerializerHelper.deserializeString(stream)
         c = SerializerHelper.deserializeInt(stream)
         id0_ = SerializerHelper.deserializeInt(stream)
         val = None
         if (id0_ < 0):
             val = (all0_[(-id0_) - 1])
         elif (id0_ > 0):
             stream.seek(stream.tell() - (4), io.SEEK_SET)
             val = (SerializerHelper.deserializeString(stream))
         self.addSlot(typ, val, False, c)
         i += 1
     cou = SerializerHelper.deserializeInt(stream)
     self.__m_occurrence = list()
     i = 0
     while i < cou:
         a = TextAnnotation._new2691(sofa, self)
         self.__m_occurrence.append(a)
         a.begin_char = SerializerHelper.deserializeInt(stream)
         a.end_char = SerializerHelper.deserializeInt(stream)
         attr = SerializerHelper.deserializeInt(stream)
         if (((attr & 1)) != 0):
             a.essential_for_occurence = True
         i += 1
Exemple #2
0
 def _deserialize(self, stream: io.IOBase, kit_: 'AnalysisKit',
                  vers: int) -> None:
     from pullenti.ner.core.internal.SerializerHelper import SerializerHelper
     super()._deserialize(stream, kit_, vers)
     self.term = SerializerHelper.deserializeString(stream)
     self.lemma = SerializerHelper.deserializeString(stream)
     self.invariant_prefix_length = SerializerHelper.deserializeShort(
         stream)
     self.max_length = SerializerHelper.deserializeShort(stream)
Exemple #3
0
 def deserialize(self, stream : io.IOBase) -> bool:
     vers = 0
     b = Utils.readByteIO(stream)
     if (b == (0xAA)): 
         b = (Utils.readByteIO(stream))
         vers = (b)
     else: 
         stream.seek(stream.tell() - (1), io.SEEK_SET)
     self.__m_sofa = SourceOfAnalysis(None)
     self.__m_sofa.deserialize(stream)
     self.base_language = MorphLang._new5(SerializerHelper.deserializeInt(stream))
     self.__m_entities = list()
     cou = SerializerHelper.deserializeInt(stream)
     i = 0
     while i < cou: 
         typ = SerializerHelper.deserializeString(stream)
         r = ProcessorService.createReferent(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.deserializeTokens(stream, self, vers)
     self.__createStatistics()
     return True
Exemple #4
0
 def _deserialize(self, stream: io.IOBase, 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)
         Utils.readIO(stream, buf, 0, 8)
         lo = int.from_bytes(buf[0:0 + 8], byteorder="little")
         self.value = str(lo)
     else:
         self.value = SerializerHelper.deserializeString(stream)
     self.typ = (Utils.valToEnum(SerializerHelper.deserializeInt(stream),
                                 NumberSpellingType))
 def deserialize(self, stream: io.IOBase) -> None:
     self.text = SerializerHelper.deserializeString(stream)