Skip to content
Snippets Groups Projects
Commit 45e0daf7 authored by Bartlomiej's avatar Bartlomiej
Browse files

Add ner annotation

parent 3edf55cb
Branches
1 merge request!11Clarin json support
Pipeline #14197 passed with stages
in 1 minute and 10 seconds
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
from typing import List, Tuple from typing import List, Tuple
from src.annotations import Annotation, MorphosyntacticAnnotation from src.annotations import Annotation, MorphosyntacticAnnotation, NerAnnotation
from src.input_parsers.interface import InputParser from src.input_parsers.interface import InputParser
...@@ -99,5 +99,13 @@ class WiktorNERInputParser(InputParser): ...@@ -99,5 +99,13 @@ class WiktorNERInputParser(InputParser):
), ),
) )
) )
# NER annotations
if content.spans:
for entity in content.spans('ner'):
if entity.start and entity.stop:
if entity.type:
annotations.append(
(entity.start, entity.stop, NerAnnotation(entity.type))
)
return text, annotations return text, annotations
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment