Exemplo n.º 1
0
 def parse(self,
           log: ProcessLogger,
           text,
           text_unit_id,
           _text_unit_lang,
           document_initial_load: bool = False,
           **kwargs) -> ParseResults:
     found = [
         definition_caught for definition_caught in
         definitions.get_definition_list_in_sentence((
             0,
             len(text),
             text,
         )) if self._is_any_alphanumeric(definition_caught.name)
     ]
     if found:
         unique = set(found)
         return ParseResults({
             DefinitionUsage: [
                 DefinitionUsage(text_unit_id=text_unit_id,
                                 definition=item.name.upper()
                                 if item.name is not None else None,
                                 count=found.count(item)) for item in unique
             ]
         })
Exemplo n.º 2
0
 def parse(self, log: ProcessLogger, text, text_unit_id, _text_unit_lang, **kwargs) -> ParseResults:
     found = definitions.get_definition_list_in_sentence((0, len(text), text,))
     if found:
         unique = set(found)
         return ParseResults({DefinitionUsage: [DefinitionUsage(text_unit_id=text_unit_id,
                                                                definition=item.name,
                                                                count=found.count(item)
                                                                ) for item in unique]})
Exemplo n.º 3
0
 def parse(self, text, text_unit_id, _text_unit_lang,
           **kwargs) -> ParseResults:
     found = list(definitions.get_definitions_in_sentence(text))
     if found:
         unique = set(found)
         return ParseResults({
             DefinitionUsage: [
                 DefinitionUsage(text_unit_id=text_unit_id,
                                 definition=item,
                                 count=found.count(item)) for item in unique
             ]
         })