Model card in English; add widget examples, link to EN counterpart
Browse files
README.md
CHANGED
|
@@ -8,54 +8,78 @@ tags:
|
|
| 8 |
- literature
|
| 9 |
- digital-humanities
|
| 10 |
- narratology
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# de-setting-classifier
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
(BERT-large,
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
| 24 |
-
|
|
| 25 |
-
| `
|
| 26 |
-
| `
|
| 27 |
-
| `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Training
|
| 30 |
|
| 31 |
-
⟨
|
| 32 |
-
|
| 33 |
|
| 34 |
## Evaluation
|
| 35 |
|
| 36 |
-
⟨
|
| 37 |
-
|
| 38 |
-
## Verwendung
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
```python
|
| 43 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
```
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
```python
|
| 53 |
-
from transformers import
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
|
|
|
| 57 |
```
|
| 58 |
|
| 59 |
-
##
|
| 60 |
|
| 61 |
-
⟨
|
|
|
|
| 8 |
- literature
|
| 9 |
- digital-humanities
|
| 10 |
- narratology
|
| 11 |
+
widget:
|
| 12 |
+
- text: "Er trat durch die Tür und schloss sie hinter sich."
|
| 13 |
+
example_title: action_space
|
| 14 |
+
- text: "Vom Hügel aus konnte sie das ganze Tal unter sich liegen sehen."
|
| 15 |
+
example_title: visual_space
|
| 16 |
+
- text: "Das Zimmer wirkte schwer und bedrückend, als rückten die Wände näher."
|
| 17 |
+
example_title: perceived_space
|
| 18 |
+
- text: "In der Ecke stand ein Tisch, bedeckt mit staubigen Büchern."
|
| 19 |
+
example_title: descriptive_space
|
| 20 |
+
- text: "Sie fragte sich, ob er ihr jemals zurückschreiben würde."
|
| 21 |
+
example_title: no_space
|
| 22 |
---
|
| 23 |
|
| 24 |
# de-setting-classifier
|
| 25 |
|
| 26 |
+
Sentence-level classifier for the representation of space in German narrative prose.
|
| 27 |
+
Fine-tuned from [`lkonle/fiction-gbert-large`](https://huggingface.co/lkonle/fiction-gbert-large)
|
| 28 |
+
(BERT-large, pre-trained on German fiction).
|
| 29 |
|
| 30 |
+
German counterpart to
|
| 31 |
+
[`katrohrb/narrative-space-classifier`](https://huggingface.co/katrohrb/narrative-space-classifier);
|
| 32 |
+
both models use the same five categories and the same label encoding.
|
| 33 |
|
| 34 |
+
## Categories
|
| 35 |
+
|
| 36 |
+
| Label | German term | Description |
|
| 37 |
+
|---------------------|--------------------|-----------------------------------------------------------------------------|
|
| 38 |
+
| `action_space` | Aktionsraum | Space registered through a character's movement and direct physical contact |
|
| 39 |
+
| `visual_space` | Anschauungsraum | Space as perceived by a character from a distance |
|
| 40 |
+
| `perceived_space` | gestimmter Raum | Space as it carries mood and atmosphere |
|
| 41 |
+
| `descriptive_space` | Raumbeschreibung | Things and objects in space, without reference to a character |
|
| 42 |
+
| `no_space` | kein Raum | No spatial reference |
|
| 43 |
+
|
| 44 |
+
Label ids: `0 perceived_space`, `1 action_space`, `2 visual_space`, `3 descriptive_space`,
|
| 45 |
+
`4 no_space` (stored in `config.json` as `id2label`).
|
| 46 |
|
| 47 |
## Training
|
| 48 |
|
| 49 |
+
⟨Training corpus (size, source, period), annotation procedure, number of annotators and
|
| 50 |
+
inter-annotator agreement to be added.⟩
|
| 51 |
|
| 52 |
## Evaluation
|
| 53 |
|
| 54 |
+
⟨Per-class and macro-averaged F1 on a held-out test set to be added.⟩
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
## Usage
|
| 57 |
|
| 58 |
```python
|
| 59 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 60 |
+
import torch
|
| 61 |
+
|
| 62 |
+
name = "katrohrb/de-setting-classifier"
|
| 63 |
+
tok = AutoTokenizer.from_pretrained(name)
|
| 64 |
+
model = AutoModelForSequenceClassification.from_pretrained(name).eval()
|
| 65 |
|
| 66 |
+
sentence = "Er trat durch die Tür und schloss sie hinter sich."
|
| 67 |
+
with torch.no_grad():
|
| 68 |
+
probs = model(**tok(sentence, return_tensors="pt")).logits.softmax(-1)[0]
|
| 69 |
+
print(model.config.id2label[int(probs.argmax())])
|
| 70 |
+
# → action_space
|
| 71 |
```
|
| 72 |
|
| 73 |
+
Or with a pipeline:
|
| 74 |
|
| 75 |
```python
|
| 76 |
+
from transformers import pipeline
|
| 77 |
|
| 78 |
+
clf = pipeline("text-classification", model="katrohrb/de-setting-classifier")
|
| 79 |
+
clf("Vom Hügel aus konnte sie das ganze Tal unter sich liegen sehen.")
|
| 80 |
+
# → [{'label': 'visual_space', 'score': 0.93}]
|
| 81 |
```
|
| 82 |
|
| 83 |
+
## Citation
|
| 84 |
|
| 85 |
+
⟨Bibliographic reference for the underlying study to be added.⟩
|