Exemple #1
0
 def parse(self, log: ProcessLogger, text, text_unit_id, text_unit_lang, **kwargs) -> ParseResults:
     court_config = dict_data_cache.get_court_config()
     found = [dict_entities.get_entity_id(i[0])
              for i in courts.get_courts(text,
                                         court_config_list=court_config,
                                         text_languages=[text_unit_lang])]
     if found:
         unique = set(found)
         return ParseResults({CourtUsage: [CourtUsage(text_unit_id=text_unit_id,
                                                      court_id=court_id,
                                                      count=found.count(court_id)) for court_id in unique]})
Exemple #2
0
 def parse(self, log: ProcessLogger, text, text_unit_id, text_unit_lang,
           document_initial_load: bool = False, **kwargs) -> ParseResults:
     from apps.extract.app_vars import SIMPLE_LOCATOR_TOKENIZATION
     simple_norm = SIMPLE_LOCATOR_TOKENIZATION.val
     court_config = dict_data_cache.get_court_config()
     found = [i[0].id
              for i in courts.get_courts(text,
                                         court_config_list=court_config,
                                         text_languages=[text_unit_lang],
                                         simplified_normalization=simple_norm)]
     if found:
         unique = set(found)
         return ParseResults({CourtUsage: [CourtUsage(text_unit_id=text_unit_id,
                                                      court_id=court_id,
                                                      count=found.count(court_id)) for court_id in unique]})