flair
A very simple framework for state-of-the-art Natural Language Processing (NLP)
Flair is:
A powerful NLP library. Flair allows you to apply our state-of-the-art natural language processing (NLP)
models to your text, such as named entity recognition (NER), part-of-speech tagging (PoS),
sense disambiguation and classification.Multilingual. Thanks to the Flair community, we support a rapidly growing number of languages. We also now include
‘one model, many languages‘ taggers, i.e. single models that predict PoS or NER tags for input text in various languages.A text embedding library. Flair has simple interfaces that allow you to use and combine different word and
document embeddings, including our proposed Flair embeddings, BERT embeddings and ELMo embeddings.A Pytorch NLP framework. Our framework builds directly on Pytorch, making it easy to
train your own models and experiment with new approaches using Flair embeddings and classes.
Now at version 0.4.0!
Comparison with State-of-the-Art
复现论文结果 How to Reproduce Experiments
Flair outperforms the previous best methods on a range of NLP tasks:
Task | Language | Dataset | Flair | Previous best |
---|---|---|---|---|
Named Entity Recognition | English | Conll-03 | 93.09 (F1) | 92.22 (Peters et al., 2018) |
Named Entity Recognition | English | Ontonotes | 89.71 (F1) | 86.28 (Chiu et al., 2016) |
Emerging Entity Detection | English | WNUT-17 | 50.20 (F1) | 45.55 (Aguilar et al., 2018) |
Part-of-Speech tagging | English | WSJ | 97.85 | 97.64 (Choi, 2016) |
Chunking | English | Conll-2000 | 96.72 (F1) | 96.36 (Peters et al., 2017) |
Named Entity Recognition | German | Conll-03 | 88.32 (F1) | 78.76 (Lample et al., 2016) |
Named Entity Recognition | German | Germeval | 84.65 (F1) | 79.08 (Hänig et al, 2014) |
Named Entity Recognition | Polish | PolEval-2018 | 86.6 (F1) (Borchmann et al., 2018) |
85.1 (PolDeepNer) |
flair 各种词嵌入的使用
flair 包含普通的 Glove 词嵌入;字符嵌入;自带的 flair 嵌入;第三方嵌入: ELMo 嵌入、BERT嵌入。注意每一种嵌入又分为具体多种小种类可以使用,以下代码仅仅举例,更多用法见 flair 说明文档。
1 | from flair.embeddings import StackedEmbeddings |