def parse(self, log: ProcessLogger, text, text_unit_id, _text_unit_lang, **kwargs) -> ParseResults: found = list(regulations.get_regulation_annotations(text)) if found: unique = set(found) return ParseResults({RegulationUsage: [RegulationUsage(text_unit_id=text_unit_id, regulation_type=item.source, regulation_name=item.name, count=found.count(item)) for item in unique]})
def parse(self, text, text_unit_id, _text_unit_lang, **kwargs) -> ParseResults: found = list(regulations.get_regulations(text)) if found: unique = set(found) return ParseResults({ RegulationUsage: [ RegulationUsage(text_unit_id=text_unit_id, regulation_type=item[0], regulation_name=item[1], count=found.count(item)) for item in unique ] })