Views
No views yet
pip install flair) and load the model directly from the Hub. For the best performance in sequence labeling (NER, POS), it is recommended to stack this backward model with the corresponding forward model.1from flair.embeddings import FlairEmbeddings, StackedEmbeddings
2
3# Load the backward model
4backward_embeddings = FlairEmbeddings('mschonhardt/mhg-mhdbdb-backward')
5
6# Load the forward model for a bidirectional setup
7forward_embeddings = FlairEmbeddings('mschonhardt/mhg-mhdbdb-forward')
8
9# Stack them for best performance
10stacked_embeddings = StackedEmbeddings([forward_embeddings, backward_embeddings])
11
12# Example usage
13from flair.data import Sentence
14sentence = Sentence("von abegescheidenheit ich hân der geschrift vil gelesen")
15stacked_embeddings.embed(sentence)1@software{schonhardt_michael_2026_mhg_flair_back,
2 author = "Schonhardt, Michael",
3 title = "Middle High German Contextual String Embeddings (Backward): Trained on the MHDBDB TEI-Texte Corpus",
4 year = 2026,
5 publisher = "Zenodo",
6 doi = "10.5281/zenodo.18659437",
7 url = "https://doi.org/10.5281/zenodo.18659437"
8}1@inproceedings{akbik-etal-2018-contextual,
2 title = "Contextual String Embeddings for Sequence Labeling",
3 author = "Akbik, Alan and
4 Blythe, Duncan and
5 Vollgraf, Roland",
6 booktitle = "Proceedings of the 27th International Conference on Computational Linguistics",
7 year = "2018",
8 url = "[https://aclanthology.org/C18-1139/](https://aclanthology.org/C18-1139/)",
9 pages = "1638--1649"
10}