From 45e0daf78317e5bb0015cd635e334532aca59043 Mon Sep 17 00:00:00 2001 From: Bartlomiej <bartlomiej.piotr.bojanowski@gmail.com> Date: Wed, 18 Oct 2023 11:36:39 +0200 Subject: [PATCH] Add ner annotation --- src/input_parsers/wiktor_ner.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/input_parsers/wiktor_ner.py b/src/input_parsers/wiktor_ner.py index 7a6523e..9eec842 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 -- GitLab