Downloads · 30 days
13
2% of all-time downloads
helinivan/dutch-sarcasm-detector
dutch-sarcasm-detector is a text classification model from helinivan. Use it when you need a label for a piece of text. It is set up for transformers.
Dutch Sarcasm Detector is a text classification model built to detect sarcasm from news article titles. It is fine-tuned on GroNLP/bert-base-dutch-cased and the training data consists of ready-made dataset available o…
Downloads · 30 days
13
2% of all-time downloads
All-time downloads
630
Public
Repo size
1.3 GB
Likes
1
Public
Click a slice to open those files.
.bin437 MB · 100%
From the Hugging Face model README
Dutch Sarcasm Detector is a text classification model built to detect sarcasm from news article titles. It is fine-tuned on GroNLP/bert-base-dutch-cased and the training data consists of ready-made dataset available on Kaggle as well as scraped data from Dutch sarcastic newspaper (De Speld).
<b>Labels</b>: 0 -> Not Sarcastic; 1 -> Sarcastic
Datasets:
Scraped data:
from transformers import AutoModelForSequenceClassification
from transformers import AutoTokenizer
import string
def preprocess_data(text: str) -> str:
return text.lower().translate(str.maketrans("", "", string.punctuation)).strip()
MODEL_PATH = "helinivan/dutch-sarcasm-detector"
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_PATH)
text = "We deden een man een nacht in een vat met cola en nu is hij dood"
tokenized_text = tokenizer([preprocess_data(text)], padding=True, truncation=True, max_length=256, return_tensors="pt")
output = model(**tokenized_text)
probs = output.logits.softmax(dim=-1).tolist()[0]
confidence = max(probs)
prediction = probs.index(confidence)
results = {"is_sarcastic": prediction, "confidence": confidence}
Output:
{'is_sarcastic': 1, 'confidence': 0.8915400505065918}
| Model-Name | F1 | Precision | Recall | Accuracy |
|---|---|---|---|---|
| helinivan/english-sarcasm-detector | 92.38 | 92.75 | 92.38 | 92.42 |
| helinivan/italian-sarcasm-detector | 88.26 | 87.66 | 89.66 | 88.69 |
| helinivan/multilingual-sarcasm-detector | 87.23 | 88.65 | 86.33 | 88.30 |
| helinivan/dutch-sarcasm-detector | 83.02 | 84.27 | 82.01 | 86.81 |