katrohrb's picture
Update README.md
51b1d59 verified
|
Raw History Blame Contribute Delete
3.14 kB
---
language: de
license: cc-by-4.0
base_model: lkonle/fiction-gbert-large
pipeline_tag: text-classification
tags:
- german
- literature
- digital-humanities
- narratology
widget:
- text: "Er trat durch die Tür und schloss sie hinter sich."
example_title: action_space
- text: "Vom Hügel aus konnte sie das ganze Tal unter sich liegen sehen."
example_title: visual_space
- text: "Das Zimmer wirkte schwer und bedrückend, als rückten die Wände näher."
example_title: perceived_space
- text: "In der Ecke stand ein Tisch, bedeckt mit staubigen Büchern."
example_title: descriptive_space
- text: "Sie fragte sich, ob er ihr jemals zurückschreiben würde."
example_title: no_space
---
# de-setting-classifier
Sentence-level classifier for the representation of space in German narrative prose.
Fine-tuned from [`lkonle/fiction-gbert-large`](https://huggingface.co/lkonle/fiction-gbert-large)
(BERT-large, pre-trained on German fiction).
German counterpart to
[`katrohrb/en-setting-classifier`](https://huggingface.co/katrohrb/en-setting-classifier);
both models use the same five categories and the same label encoding.
## Categories
| Label | German term | Description |
|---------------------|--------------------|-----------------------------------------------------------------------------|
| `action_space` | Aktionsraum | Space registered through a character's movement and direct physical contact |
| `visual_space` | Anschauungsraum | Space as perceived by a character from a distance |
| `perceived_space` | gestimmter Raum | Space as it carries mood and atmosphere |
| `descriptive_space` | Raumbeschreibung | Things and objects in space, without reference to a character |
| `no_space` | kein Raum | No spatial reference |
Label ids: `0 perceived_space`, `1 action_space`, `2 visual_space`, `3 descriptive_space`,
`4 no_space` (stored in `config.json` as `id2label`).
## Usage
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
name = "katrohrb/de-setting-classifier"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForSequenceClassification.from_pretrained(name).eval()
sentence = "Er trat durch die Tür und schloss sie hinter sich."
with torch.no_grad():
probs = model(**tok(sentence, return_tensors="pt")).logits.softmax(-1)[0]
print(model.config.id2label[int(probs.argmax())])
# → action_space
```
Or with a pipeline:
```python
from transformers import pipeline
clf = pipeline("text-classification", model="katrohrb/de-setting-classifier")
clf("Vom Hügel aus konnte sie das ganze Tal unter sich liegen sehen.")
# → [{'label': 'visual_space', 'score': 0.93}]
```
## Citation
Rohrbacher, K. (2025). Opening Worlds: Narrative Beginnings and the Role of Setting.
CCLS2025 Conference Preprints, 4(1). https://doi.org/10.26083/tuprints-00030149