Esempio n. 1
0
 def get_oov_node(self, text, oov, length):
     node = self.create_node()
     node.set_parameter(oov.left_id, oov.right_id, oov.cost)
     info = wordinfo.WordInfo(surface=text, head_word_length=length, pos_id=oov.pos_id, normalized_form=text,
                              dictionary_form_word_id=-1, dictionary_form=text, reading_form="",
                              a_unit_split=[], b_unit_split=[], word_structure=[], synonym_group_ids=[])
     node.set_word_info(info)
     return node
Esempio n. 2
0
 def provide_oov(self, input_text, offset, has_other_words):
     if not has_other_words:
         node = self.create_node()
         node.set_parameter(self.left_id, self.right_id, self.cost)
         length = input_text.get_word_candidate_length(offset)
         s = input_text.get_substring(offset, offset + length)
         info = wordinfo.WordInfo(surface=s,
                                  head_word_length=length,
                                  pos_id=self.oov_pos_id,
                                  normalized_form=s,
                                  dictionary_form_word_id=-1,
                                  dictionary_form=s,
                                  reading_form="",
                                  a_unit_split=[],
                                  b_unit_split=[],
                                  word_structure=[])
         node.set_word_info(info)
         return [node]
     else:
         return []