flairNLP / flair

A very simple framework for state-of-the-art Natural Language Processing (NLP)
https://flairnlp.github.io/flair/
Other
13.9k stars 2.1k forks source link

Support for granular numerical named entities in ner-ontonotes #946

Closed prashantbudania closed 5 years ago

prashantbudania commented 5 years ago

I am working on a relation extraction project and I want to extract factual numerical information. Can we add support for more granular numerical entities in the NER (ner-ontonotes) tagger? For ex: PERCENT, MONEY, QUANTITY etc. Right now, everything is tagged as CARDINAL entity.

Describe the solution you'd like Training and providing weights for a 17/18 class NER tagger. 'ner-ontonotes' (fine-grained/granular/extended)

alanakbik commented 5 years ago

Hello @prashantbudania the ontonotes model in fact has all 18 classes, so you can detect them already with the current model.

Try this:

tagger = SequenceTagger.load('ner-ontonotes')

sentence = Sentence('Stock rose to 18 euros - or 12% - in the third quarter.', use_tokenizer=True)
tagger.predict(sentence)

for ner in sentence.get_spans('ner'):
    print(ner)
alanakbik commented 5 years ago

Oops accidentally closed the issue. Feel free to reopen if you have more questions.