◆SkillLanguage & NLPFree
Flair — State-of-the-Art NLP Framework
Simple NLP library with SOTA models for NER, POS tagging, chunking, text classification, and contextual string embeddings.
Installs145k
Rating★ 4.7
Reviews48
Flair
Flair provides a very simple API for applying SOTA NLP models — including its own contextual string embeddings — to sequence labelling, classification, and entity extraction tasks in 12+ languages. It stacks seamlessly on top of Hugging Face Transformers.
Key Features
- SOTA NER: 93.9 F1 on CoNLL-2003 English with stacked embeddings
- POS tagging, chunking, dependency parsing, NEL
- Contextual string embeddings (character-level LM) + BERT/XLM-R stacking
- Text classification: sentiment, intent, topic
- Multilingual: 12+ languages, zero-shot cross-lingual transfer
- Training API: train custom sequence labellers and classifiers in ~10 lines
Quick Start
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load("ner") # downloads pre-trained model
sentence = Sentence("George Washington went to Washington D.C.")
tagger.predict(sentence)
for entity in sentence.get_spans("ner"):
print(entity) # Span[0:2]: "George Washington" → [PER (0.9998)]
Install via ai-supply
npx ai-supply add flair-nlp-framework
Curated mirror of the open-source Flair (MIT). Get it from the source.