예제 #1
0
 def parse(self, log: ProcessLogger, text, text_unit_id, _text_unit_lang, **kwargs) -> ParseResults:
     found = [u.url for u in urls.get_url_annotations(text)]
     if found:
         unique = set(found)
         return ParseResults({UrlUsage: [UrlUsage(text_unit_id=text_unit_id,
                                                  source_url=item,
                                                  count=found.count(item)) for item in unique]})
예제 #2
0
 def parse(self, text, text_unit_id, _text_unit_lang,
           **kwargs) -> ParseResults:
     found = list(urls.get_urls(text))
     if found:
         unique = set(found)
         return ParseResults({
             UrlUsage: [
                 UrlUsage(text_unit_id=text_unit_id,
                          source_url=item,
                          count=found.count(item)) for item in unique
             ]
         })