You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Flair team,
and thank you for your great project!
I'm trying to use Flair for named entity recognition task. I need to get text and associated label separately. Unfortunately documentation examples contain only code for printing entire NER.
So far I've come to this solution
for entity in sentence.get_spans('ner'):
text = ' '.join([token.text for token in entity.annotation_layers['ner'][0].data_point.tokens])
label = entity.annotation_layers['ner'][0].value
print(text, '->', label)
Is there some more elegant API usage option? Like in spacy-nlp for example
doc = nlp(text)
for ent in doc.ents:
print(ent.text, '->', ent.label_)
The text was updated successfully, but these errors were encountered:
Question
Hello Flair team,
and thank you for your great project!
I'm trying to use Flair for named entity recognition task. I need to get text and associated label separately. Unfortunately documentation examples contain only code for printing entire NER.
So far I've come to this solution
Is there some more elegant API usage option? Like in spacy-nlp for example
The text was updated successfully, but these errors were encountered: