Text Classification
Transformers
TensorBoard
Safetensors
German
xlm-roberta
Generated from Trainer
text-embeddings-inference
Instructions to use ubffm/academic_text_classifier_de with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ubffm/academic_text_classifier_de with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ubffm/academic_text_classifier_de")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("ubffm/academic_text_classifier_de") model = AutoModelForSequenceClassification.from_pretrained("ubffm/academic_text_classifier_de", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 12,341 Bytes
b00b71b 5be109b b00b71b 5be109b b00b71b 5be109b b00b71b 29d84c0 b00b71b 5be109b b00b71b 5be109b 58bf34d 5be109b 0eed99e 5be109b 3b78ee5 5be109b b00b71b 3b78ee5 58bf34d 3b78ee5 58bf34d 3b78ee5 58bf34d 3b78ee5 b00b71b 3b78ee5 5be109b 2697f53 5be109b b00b71b 29d84c0 0dc01ea b00b71b 29d84c0 b00b71b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | ---
library_name: transformers
license: mit
base_model: FacebookAI/xlm-roberta-base
tags:
- generated_from_trainer
language: de
metrics:
- accuracy
- precision
- recall
- f1
model-index:
- name: academic_main_text_classifier_de
results: []
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
# Academic Main Text_Classifier (de)
This model is a fine-tuned version of [FacebookAI/xlm-roberta-base](https://huggingface.co/FacebookAI/xlm-roberta-base) on a labelled dataset of publications in the Bibliography of Linguistic Literature.
It achieves the following results on the evaluation set:
- Loss: 0.2342
- Accuracy: 0.9385
- Precision: 0.9385
- Recall: 0.9385
- F1: 0.9385
## Model description
The model is fine-tuned with academic publications in Linguistics, to classify texts in publications into 4 classes as a filter to other tasks. Sentence-based data obtained from OCR-processed PDF files was annotated manually with the following classes:
- 0: out of scope - materials that are of low significance, eg. page number and page header, noise from OCR/pdf-to-text convertion
- 1: main text - texts that are the main texts of the publication, to be used for down-stream tasks
- 2: examples - texts that are captions of the figures, or quotes or excerpts
- 3: references - references of the publication, excluding in-text citations
## Intended uses & limitations
Intended uses:
- filter out noise from OCR of academic texts (conference papers, journals, books etc.)
- extract main text in academic texts for down-stream NLP tasks
Limitations:
- training and evaluation data is limited to German, and academic texts in Linguistics (though still to a higher extent usable for English texts)
## How to run
```python
from transformers import pipeline
# define model name
model_name = "ubffm/academic_text_classifier_de"
# run model with hf pipeline
## return output for the best label
## eg. [{'label': 'EXAMPLE', 'score': 0.9601941108703613}]
classifier = pipeline("text-classification", model=model_name, tokenizer=model_name)
## return output for all labels
## eg. [[{'label': 'OUT OF SCOPE', 'score': 0.007808608002960682}, {'label': 'MAIN TEXT', 'score': 0.028077520430088043}, {'label': 'EXAMPLE', 'score': 0.9601941108703613}, {'label': 'REFERENCE', 'score': 0.003919811453670263}]]
classifier = pipeline("text-classification", model=model_name, tokenizer=model_name, return_all_scores=True)
# Perform inference on your input text
your_text = "your text here."
result = classifier(your_text)
print(result)
```
## Try it yourself with the following examples (not in training/ evaluation data)
Excerpts from Haspelmath, M. (2002). Grammatikalisierung: Von der Perfomanz zur Kompetenz ohne angeborene Grammatik. Gibt es eine Sprache hinter dem Sprechen?, 262-286. retrieved from https://scholar.google.com/citations?view_op=view_citation&hl=en&user=JoLnQhwAAAAJ&cstart=20&pagesize=80&citation_for_view=JoLnQhwAAAAJ:hC7cP41nSMkC
- (3a) Märchen / existier Geiß mal / Junge Geiß sieben / Geiß Junge lieb / Mutter lieb Kinder genauso / mal Wunsch Geiß rausgeh Haus / Zweck besorg Essen Junge / Geiß Junge warn Grund / schleich Wolf manchmal Haus rum / "ich fort Zeit immer nicht aufmach Tür / Zweck nicht reinkomm"
- 2 Allgemeine Darstellungen der Grammatikalisierungs-Theorie sind Lehmann (1995) und Hopper & Traugott (1993).
- Ursprünglich wird im Englischen Negation einfach durch not nach dem Verb ausgedrückt, wie in (7a); das finden wir so noch bei Shakespeare.
- (8b) ist wörtlich übersetzbar als 'Wohin ist es, dass du gehst?'
- 4 Nihil est in intellectu quod prius non fuerit in sensibus 'Nichts ist im Verstand, was nicht vorher in den Sinnen war' (Gottfried Wilhelm Leibniz, Nouveaux essais sur l'entendement humain, 1765, Buch II.)
Excerpts from Astrid Adler, Silvia Kutscher, Hélène Vinckel-Roisin. Valenzalternation im Vergleich: Antikausativa im Deutschen, Französischen und Ungarischen. Online-only Publikationen des Leibniz-Instituts für Deutsche Sprache, 2025, 11, pp.1-60. ff10.21248/idsopen.11.2025.52ff. ffhal-05217153 retrieved from https://scholar.googleusercontent.com/scholar?q=cache:SUM6z35DPOsJ:scholar.google.com/+haspelmath+zwischen&hl=en&as_sdt=0,5
- Neben dieser reinen Stelligkeitslabilität, wie sie in (1) veranschaulicht wurde, findet sich ein etwas anders geartetes Phänomen der Labilität. Verben wie Dt. zerbrechen können ebenfalls in einer transitiven (2a) und einer intransitiven (2b) Konstruktion stehen
- 3 Lemmens (1998) schlägt ebenfalls eine 4er-Klassifizierung vor, allerdings basierend auf semantischen Parametern von Hopper/Thompson (1980) („effective“); diese sind jedoch teilweise idiosynkratisch („non-effective“). Und es führt zu einer den traditionellen Gepflogenheiten entgegenlaufenden Klassifizierung von intransitiven (d. h. einstelligen) Verben als eine Unterklasse zu transitiven Verben (vgl. auch Review von Bert Peeters 2000 zu Lemmens 1998).
- 3.1 Alternierende vs. nicht-alternierende Verben
- (7) a. Die Tablette zerfällt. / Das Wasserrohr platzt. b. *Der Kranke / *Das Wasser zerfällt die Tablette. c. *Der Klempner / *Das gefrorene Wasser platzt das Rohr.
- Alexiadou, Artemis/Anagnostopoulou, Elena/Schäfer, Florian (2006): The properties of anticausatives crosslinguistically. In: Frascarelli, Mara (Hg.): Phases of interpretation. (= Studies in Generative Grammar 91). Berlin/New York: De Gruyter, S. 187–211
Excerpts from Hüning, M. (2002). Zwischen Deutsch und Englisch–Aspekte der sprachlichen Identität des Niederländischen. na. retrieved from https://neon.niederlandistik.fu-berlin.de/static/mh/Taal_en_identiteit.pdf
Das Deutsche hat noch die drei Genera und verwendet dafür auch unterschiedliche Artikel, das Niederländische hat die Dreiteilung bei den Genera zugunsten einer Zweiteilung aufgegeben: die sogenannten de-woorden (auch das 'Genus commune' oder 'Utrum' genannt), in denen das Maskulinum und das Femininum zusammengefallen sind, und die het-woorden (Neutrum)
(6) Possesivpronomen + eigen (a) ze heeft d'r eigen in de spiegel bekeken ('sie hat sich im Spiegel angesehen') (b) ik ben m'n eigen kapot geschrokken ('ich habe mich zu Tode erschrocken')
5 Ekkehard König und Peter Siemund haben typologische Eigenschaften und die historische Entwicklung solcher 'Intensifikatoren' untersucht (König & Siemund 1999).
Van Bree, C. (1981), Hebben-constructies en datiefconstructies binnen het Nederlandse taalgebied. Een taalgeografisch onderzoek. Diss. Rijksuniversiteit Leiden, Leiden. Goossens, J. (1971), Was ist Deutsch - und wie verhält es sich zum Niederländischen? Bonn: Kgl. Niederländische Botschaft
(25) (a) ?der Schweiß steht auf meiner Stirn (b) *mein Herz schlägt in meinem Hals / bis zu meinem Hals
Zwischen Deutsch und Englisch - 9 -
## Problematic cases
Excerpts from Haspelmath, M. (2002). Grammatikalisierung: Von der Perfomanz zur Kompetenz ohne angeborene Grammatik. Gibt es eine Sprache hinter dem Sprechen?, 262-286. retrieved from https://scholar.google.com/citations?view_op=view_citation&hl=en&user=JoLnQhwAAAAJ&cstart=20&pagesize=80&citation_for_view=JoLnQhwAAAAJ:hC7cP41nSMkC
Examples that are not obviously in table or excerpt structures can be missed out as type "Examples", possibly mistaken as in-text examples:
- Genitiv < 'Herkunft' engl. of, dt. von, frz. de < lat. de 'von ... her'
- ler 'als' < l'heure 'die Stunde' ou 'du' < vous 'Sie' 'n, fin Perfekt < finir 'beenden' sa definiter Artikel < ça 'das' (Demonstrativ) i Präsens < il zot 'sie' < les autres 'die anderen' ti Präteritum < était 'war' (ti vin < était à venir, o.ä.) ek 'und' < avec 'mit' Tabelle 2: Neue grammatische Elemente im Seychellen-Kreol
- (11) Elterngrammatik Kindergrammatik Elternsprachgebrauch Kindersprachgebrauch
Titles in longer phrases may not be recognised
- Die Inseln jenseits des Roten Meeres: das reale Experiment
Definitions or findings written in point form are challenging for the model. For example:
- (10a) Die überwältigende Mehrheit aller grammatischen Elemente aller Sprachen kann auf ein lexikalisches Ursprungsmodell zurückgeführt werden.
Excerpts from Hüning, M. (2002). Zwischen Deutsch und Englisch–Aspekte der sprachlichen Identität des Niederländischen. na. retrieved from https://neon.niederlandistik.fu-berlin.de/static/mh/Taal_en_identiteit.pdf
Instances with a higher percentage of numbers (such as subtitles) can be misclassified as non-main text:
- 2 Zwischen Deutsch und Englisch 2.1 Genera Als ein bekanntes und auffälliges Beispiel für die Mittelstellung des Niederländischen nennt Van Haeringen (1956:28) das Genus.1
Numbered sub-titles and footnotes can be mistaken as examples:
- (23) Variation im Mittelniederländischen
- (13) Adnominale Intensifikatoren (a) Den ersten Vortrag hielt Van Uffelen selbst/selber. (b) De eerste lezing werd gehouden door Van Uffelen zelf.
## Training and evaluation data
Manually labelled dataset on Huggingface: ubffm/academic_main_text_classifier_de_annotated (https://huggingface.co/datasets/ubffm/academic_main_text_classifier_de_annotated)
The Bibliography of Linguistic Literature (BLL) is one of the most comprehensive sources of bibliographic information for the general linguistics with its subdomains and neighboring disciplines as well as for the English, German and Romance linguistics. The subject bibliography is based mainly on the library's holdings on linguistics. It lists monographs, dissertations, articles from periodicals, collective works, conference contributions, unpublished research papers, etc. The printed edition is published annually (at the end of each year) and covers the literature of the previous year and some supplements. Usually, it includes about 10,000 references per year. (Frankfurt a. M. : Klostermann, 1.1971/75(1976) - 47.2021 (2022)) (See more at https://www.ub.uni-frankfurt.de/linguistik/sammlung_en.html)
### Labelled dataset from open access publications of the Bibliography of Linguistic Literature (BLL)
- Manually labelled dataset on Huggingface:
ubffm/academic_main_text_classifier_de_annotated (https://huggingface.co/datasets/ubffm/academic_main_text_classifier_de_annotated)
- The Bibliography of Linguistic Literature (BLL) is one of the most comprehensive sources of bibliographic information for the general linguistics with its subdomains and neighboring disciplines as well as for the English, German and Romance linguistics. The subject bibliography is based mainly on the library's holdings on linguistics. It lists monographs, dissertations, articles from periodicals, collective works, conference contributions, unpublished research papers, etc. The printed edition is published annually (at the end of each year) and covers the literature of the previous year and some supplements. Usually, it includes about 10,000 references per year. (Frankfurt a. M. : Klostermann, 1.1971/75(1976) - 47.2021 (2022))
(See more at https://www.ub.uni-frankfurt.de/linguistik/sammlung_en.html)
## Training procedure
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 32
- eval_batch_size: 64
- seed: 42
- optimizer: Use adamw_torch_fused with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 500
- num_epochs: 5
### Training results
| Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | F1 |
|:-------------:|:-----:|:----:|:---------------:|:--------:|:---------:|:------:|:------:|
| 0.9745 | 1.0 | 268 | 0.4236 | 0.8629 | 0.8629 | 0.8629 | 0.8629 |
| 0.4594 | 2.0 | 536 | 0.2755 | 0.9193 | 0.9193 | 0.9193 | 0.9193 |
| 0.2734 | 3.0 | 804 | 0.2541 | 0.9287 | 0.9287 | 0.9287 | 0.9287 |
| 0.2288 | 4.0 | 1072 | 0.2300 | 0.9329 | 0.9329 | 0.9329 | 0.9329 |
| 0.1909 | 5.0 | 1340 | 0.2342 | 0.9385 | 0.9385 | 0.9385 | 0.9385 |
### Framework versions
- Transformers 4.57.1
- Pytorch 2.9.0+cu128
- Datasets 4.2.0
- Tokenizers 0.22.1
|