Пример #1
0
 def _serialize(self, stream: io.IOBase) -> None:
     from pullenti.ner.core.internal.SerializerHelper import SerializerHelper
     SerializerHelper.serializeInt(stream, self.begin_char)
     SerializerHelper.serializeInt(stream, self.end_char)
     SerializerHelper.serializeInt(stream, self.__m_attrs)
     SerializerHelper.serializeInt(stream, self.chars.value)
     if (self.__m_morph is None):
         self.__m_morph = MorphCollection()
     self.__m_morph._serialize(stream)
Пример #2
0
 def serialize(self, stream : io.IOBase) -> None:
     Utils.writeByteIO(stream, 0xAA)
     Utils.writeByteIO(stream, 1)
     self.__m_sofa.serialize(stream)
     SerializerHelper.serializeInt(stream, self.base_language.value)
     if (len(self.__m_entities) == 0): 
         for d in self.__m_datas.items(): 
             self.__m_entities.extend(d[1].referents)
     SerializerHelper.serializeInt(stream, len(self.__m_entities))
     i = 0
     while i < len(self.__m_entities): 
         self.__m_entities[i].tag = i + 1
         SerializerHelper.serializeString(stream, self.__m_entities[i].type_name)
         i += 1
     for e0_ in self.__m_entities: 
         e0_.serialize(stream)
     SerializerHelper.serializeTokens(stream, self.first_token, 0)
Пример #3
0
 def _serialize(self, stream: io.IOBase) -> None:
     from pullenti.ner.core.internal.SerializerHelper import SerializerHelper
     super()._serialize(stream)
     SerializerHelper.serializeString(stream, self.__m_value)
     SerializerHelper.serializeInt(stream, self.typ)
Пример #4
0
 def serialize(self, stream: io.IOBase) -> None:
     SerializerHelper.serializeString(stream, self.type_name)
     SerializerHelper.serializeInt(stream, len(self.__m_slots))
     for s in self.__m_slots:
         SerializerHelper.serializeString(stream, s.type_name)
         SerializerHelper.serializeInt(stream, s.count)
         if ((isinstance(s.value, Referent)) and (isinstance(
             (s.value).tag, int))):
             SerializerHelper.serializeInt(stream, -((s.value).tag))
         elif (isinstance(s.value, str)):
             SerializerHelper.serializeString(
                 stream, Utils.asObjectOrNull(s.value, str))
         elif (s.value is None):
             SerializerHelper.serializeInt(stream, 0)
         else:
             SerializerHelper.serializeString(stream, str(s.value))
     if (self.__m_occurrence is None):
         SerializerHelper.serializeInt(stream, 0)
     else:
         SerializerHelper.serializeInt(stream, len(self.__m_occurrence))
         for o in self.__m_occurrence:
             SerializerHelper.serializeInt(stream, o.begin_char)
             SerializerHelper.serializeInt(stream, o.end_char)
             attr = 0
             if (o.essential_for_occurence):
                 attr = 1
             SerializerHelper.serializeInt(stream, attr)
Пример #5
0
 def _serialize(self, stream : io.IOBase) -> None:
     super()._serialize(stream)
     id0_ = 0
     if (self.referent is not None and (isinstance(self.referent.tag, int))): 
         id0_ = (self.referent.tag)
     SerializerHelper.serializeInt(stream, id0_)