Downloads · 30 days
10
29% of all-time downloads
katrohrb/animal-metaphor-classifier
animal-metaphor-classifier is a text classification model from katrohrb. Use it when you need a label for a piece of text. The card lists the license as cc-by-4.0.
Binary sentence classifier: is an animal reference in the sentence used metaphorically or literally? Fine-tuned from FacebookAI/roberta-base.
Downloads · 30 days
10
29% of all-time downloads
All-time downloads
35
Public
Parameters
125M
499 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors499 MB · 99%
From the Hugging Face model README
Binary sentence classifier: is an animal reference in the sentence used metaphorically
or literally? Fine-tuned from
FacebookAI/roberta-base.
| Label | Description |
|---|---|
metaphor | The animal is used figuratively — to characterise a person, action, or situation |
non_metaphor | The animal is referred to literally, as an actual animal |
Label ids: 0 non_metaphor, 1 metaphor (stored in config.json as id2label).
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
name = "katrohrb/animal-metaphor-classifier"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForSequenceClassification.from_pretrained(name).eval()
sentence = "He is a real snake, you can't trust a word he says."
with torch.no_grad():
probs = model(**tok(sentence, return_tensors="pt")).logits.softmax(-1)[0]
print(model.config.id2label[int(probs.argmax())])
# → metaphor
Or with a pipeline:
from transformers import pipeline
clf = pipeline("text-classification", model="katrohrb/animal-metaphor-classifier")
clf("The dog barked at the mailman every morning.")
# → [{'label': 'non_metaphor', 'score': 0.90}]
Rohrbacher, K., Wagner, A., Mahlberg, M. (2026). “Letting the Cat out of the Bag”: Towards the Automatic Detection of Animal Metaphors in Literary Texts. Book of Abstracts of the DH 2026, ADHO Annual Conference, South Korea, pp. 685–688. https://doi.org/10.5281/zenodo.21495909