Instructions to use flair/entity-german-8class with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Flair
How to use flair/entity-german-8class with Flair:
from flair.data import Sentence from flair.models import SequenceTagger tagger = SequenceTagger.load("flair/entity-german-8class") sentence = Sentence("George Washington went to Washington.") tagger.predict(sentence) print(sentence) - Notebooks
- Google Colab
- Kaggle
|
Download README.md from flair/entity-german-8class: direct link, hf CLI and curl.
- Browser
- Download file 3.39 kB
-
https://huggingface.co/flair/entity-german-8class/resolve/main/README.md
- Command line
-
hf download hf://flair/entity-german-8class/README.md
-
curl -L -o README.md https://huggingface.co/flair/entity-german-8class/resolve/main/README.md
3.39 kB
| library_name: flair | |
| tags: | |
| - flair | |
| - token-classification | |
| - sequence-tagger-model | |
| language: de | |
| license: other | |
| license_name: flukes-nc-1.0 | |
| license_link: https://github.com/flairNLP/flukes/blob/main/MODEL_LICENSE.md | |
| widget: | |
| - text: "Die Deutsche Nationalmannschaft, trainiert von Helmut Schön, gewann in München bei der Weltmeisterschaft 1974 das Endspiel gegen die Niederlande." | |
| ## German NER in Flair (8-class) | |
| This is the 8-class NER model for German for [Flair](https://github.com/flairNLP/flair/). | |
| F1-Score: **95.6** | |
| Predicts 8 tags: | |
| | **tag** | **meaning** | | |
| |---------------------------------|-----------| | |
| | PER | person name | | |
| | LOC | location name | | |
| | ORG | organization name | | |
| | PRODUCT | product name ("Oura Ring 5")| | |
| | WORK_OF_ART | film/song/album/book name | | |
| | EVENT | named event ("1970 World Cup") | | |
| | IDENT | nationality, ethnicity or adherence | | |
| | MISC | other name | | |
| > ⚠️ **Default license: noncommercial use only.** This model is released under the | |
| > [Flukes NC 1.0 License](https://github.com/flairNLP/flukes/blob/main/MODEL_LICENSE.md). | |
| > Commercial use — including using this model's predictions in a commercial | |
| > product or service — requires a separate license. Contact | |
| > `alan.akbik@gmail.com`. | |
| > | |
| --- | |
| ### Demo: How to use in Flair | |
| Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`) | |
| ```python | |
| from flair.data import Sentence | |
| from flair.models import SequenceTagger | |
| # load tagger | |
| tagger = SequenceTagger.load("flair/entity-german-4class") | |
| # make example sentence | |
| sentence = Sentence("Die Deutsche Nationalmannschaft, trainiert von Helmut Schön, gewann in München bei der Weltmeisterschaft 1974 das Endspiel gegen die Niederlande.") | |
| # predict NER tags | |
| tagger.predict(sentence) | |
| # print sentence | |
| print(sentence) | |
| # print predicted NER spans | |
| print('The following NER tags are found:') | |
| # iterate over entities and print | |
| for entity in sentence.get_spans('ner'): | |
| print(entity) | |
| ``` | |
| This yields the following output: | |
| ``` | |
| Span[1:3]: "Deutsche Nationalmannschaft" → ORG (1.0000) | |
| Span[6:8]: "Helmut Schön" → PER (1.0000) | |
| Span[11:12]: "München" → LOC (1.0000) | |
| Span[14:16]: "Weltmeisterschaft 1974" → EVENT (1.0000) | |
| Span[20:21]: "Niederlande" → ORG (1.0000) | |
| ``` | |
| So, the entities "*Deutsche Nationalmannschaft*" and "*Niederlande*" are tagged as **organization** (soccer teams), "*Helmut Schön*" is tagged as a **person**, | |
| "*Mexico*" as a **location** and "*, together with | |
| the entity "*Weltmeisterschaft 1974*", labeled as **event**. | |
| --- | |
| ### Cite | |
| Please cite the following paper when using this model. | |
| ``` | |
| @inproceedings{akbik2019flair, | |
| 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={{NAACL} 2019, 2019 Annual Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations)}, | |
| pages={54--59}, | |
| year={2019} | |
| } | |
| ``` | |
| --- | |
| ## License | |
| **Model weights**: [Flukes Noncommercial License 1.0](https://github.com/flairNLP/flukes/blob/main/MODEL_LICENSE.md). | |
| Personal, academic, and other noncommercial use permitted. Commercial use | |
| requires a separate license — contact `alan.akbik@gmail.com`. |