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)
Beispiel #2
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
Beispiel #3
0
 def clone(self) -> 'Referent':
     from pullenti.ner.Slot import Slot
     res = ProcessorService.create_referent(self.type_name)
     if (res is None):
         res = Referent(self.type_name)
     res.occurrence.extend(self.occurrence)
     res.ontology_items = self.ontology_items
     for r in self.slots:
         rr = Slot._new2862(r.type_name, r.value, r.count)
         rr.owner = res
         res.slots.append(rr)
     return res