diff --git a/src/input_parsers/wiktor_ner.py b/src/input_parsers/wiktor_ner.py index 7a6523e094f8be5ca466ea96ac009a541e98f113..9eec84254e8ffd29cada351aeb738e4b1efb4197 100644 --- a/src/input_parsers/wiktor_ner.py +++ b/src/input_parsers/wiktor_ner.py @@ -2,7 +2,7 @@ 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 @@ -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