đ English Chunking in Flair (default model)
This is a standard English phrase chunking model provided by Flair, which can effectively identify and classify different types of phrases in English text.
⨠Features
- High Accuracy: Achieves an F1-Score of 96.48 on the CoNLL-2000 dataset.
- Rich Tag Prediction: Predicts 4 tags, including ADJP, ADVP, CONJP, etc., covering a wide range of phrase types.
- Advanced Technology: Based on Flair embeddings and LSTM - CRF technology.
Property |
Details |
Model Type |
Phrase Chunking Model |
Training Data |
conll2000 |
tag |
meaning |
ADJP |
adjectival |
ADVP |
adverbial |
CONJP |
conjunction |
INTJ |
interjection |
LST |
list marker |
NP |
noun phrase |
PP |
prepositional |
PRT |
particle |
SBAR |
subordinate clause |
VP |
verb phrase |
đĻ Installation
Requires: Flair (pip install flair
)
đģ Usage Examples
Basic Usage
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load("flair/chunk-english")
sentence = Sentence("The happy man has been eating at the diner")
tagger.predict(sentence)
print(sentence)
print('The following NER tags are found:')
for entity in sentence.get_spans('np'):
print(entity)
This yields the following output:
Span [1,2,3]: "The happy man" [â Labels: NP (0.9958)]
Span [4,5,6]: "has been eating" [â Labels: VP (0.8759)]
Span [7]: "at" [â Labels: PP (1.0)]
Span [8,9]: "the diner" [â Labels: NP (0.9991)]
So, the spans "The happy man" and "the diner" are labeled as noun phrases (NP) and "has been eating" is labeled as a verb phrase (VP) in the sentence "The happy man has been eating at the diner".
đ§ Technical Details
The model is based on Flair embeddings and LSTM - CRF. The following Flair script was used to train this model:
from flair.data import Corpus
from flair.datasets import CONLL_2000
from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
corpus: Corpus = CONLL_2000()
tag_type = 'np'
tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
embedding_types = [
FlairEmbeddings('news-forward'),
FlairEmbeddings('news-backward'),
]
embeddings = StackedEmbeddings(embeddings=embedding_types)
from flair.models import SequenceTagger
tagger = SequenceTagger(hidden_size=256,
embeddings=embeddings,
tag_dictionary=tag_dictionary,
tag_type=tag_type)
from flair.trainers import ModelTrainer
trainer = ModelTrainer(tagger, corpus)
trainer.train('resources/taggers/chunk-english',
train_with_dev=True,
max_epochs=150)
đ License
No license information provided in the original document.
đ Documentation
Cite
Please cite the following paper when using this model.
@inproceedings{akbik2018coling,
title={Contextual String Embeddings for Sequence Labeling},
author={Akbik, Alan and Blythe, Duncan and Vollgraf, Roland},
booktitle = {{COLING} 2018, 27th International Conference on Computational Linguistics},
pages = {1638--1649},
year = {2018}
}
Issues?
The Flair issue tracker is available here.