đ Dutch NER in Flair (default model)
This project provides a standard 4 - class Named Entity Recognition (NER) model for Dutch, which is integrated with Flair. It effectively identifies named entities in Dutch text, offering high - accuracy performance with an F1 - Score of 92.58 on the CoNLL - 03 dataset.
⨠Features
- Four - Tag Prediction: It predicts four types of named entities:
PER
(person name), LOC
(location name), ORG
(organization name), and MISC
(other name).
- Advanced Architecture: Based on Transformer embeddings and LSTM - CRF, ensuring accurate entity recognition.
Property |
Details |
Model Type |
Transformer - based NER model |
Training Data |
CoNLL - 03 Dutch dataset |
đĻ Installation
Requires Flair. You can install it using the following command:
pip install flair
đģ Usage Examples
Basic Usage
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load("flair/ner-dutch")
sentence = Sentence("George Washington ging naar Washington")
tagger.predict(sentence)
print(sentence)
print('The following NER tags are found:')
for entity in sentence.get_spans('ner'):
print(entity)
This code will yield the following output:
Span [1,2]: "George Washington" [â Labels: PER (0.997)]
Span [5]: "Washington" [â Labels: LOC (0.9996)]
It means that the entities "George Washington" (labeled as a person) and "Washington" (labeled as a location) are found in the sentence "George Washington ging naar Washington".
đ§ Technical Details
The model is trained using the following Flair script:
from flair.data import Corpus
from flair.datasets import CONLL_03_DUTCH
from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
corpus: Corpus = CONLL_03_DUTCH()
tag_type = 'ner'
tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
embeddings = TransformerWordEmbeddings('wietsedv/bert-base-dutch-cased')
tagger: SequenceTagger = SequenceTagger(hidden_size=256,
embeddings=embeddings,
tag_dictionary=tag_dictionary,
tag_type=tag_type)
trainer: ModelTrainer = ModelTrainer(tagger, corpus)
trainer.train('resources/taggers/ner-dutch',
train_with_dev=True,
max_epochs=150)
đ License
No license information is provided in the original document.
đ Documentation
Cite
Please cite the following paper when using this model:
@inproceedings{akbik-etal-2019-flair,
title = "{FLAIR}: An Easy-to-Use Framework for State-of-the-Art {NLP}",
author = "Akbik, Alan and
Bergmann, Tanja and
Blythe, Duncan and
Rasul, Kashif and
Schweter, Stefan and
Vollgraf, Roland",
booktitle = "Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics (Demonstrations)",
year = "2019",
url = "https://www.aclweb.org/anthology/N19-4010",
pages = "54--59",
}
Issues?
The Flair issue tracker is available here.