Update README.md
Browse files
README.md
CHANGED
|
@@ -6,18 +6,22 @@ tags:
|
|
| 6 |
- text-classification
|
| 7 |
widget:
|
| 8 |
- text: "Auto, stop a diesel e benzina dal 2035. Ecco cosa cambia per i consumatori"
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
-
#
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
## Metrics:
|
| 16 |
|
| 17 |
|
| 18 |
## Training Data
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
Scraped data:
|
|
|
|
| 21 |
- Italian non-sarcastic news from [Il Giornale]([https://www.ilgiornale.it])
|
| 22 |
- Italian sarcastic news from [Lercio]([https://www.lercio.it])
|
| 23 |
|
|
@@ -36,12 +40,12 @@ import string
|
|
| 36 |
def preprocess_data(text: str) -> str:
|
| 37 |
return text.lower().translate(str.maketrans("", "", string.punctuation)).strip()
|
| 38 |
|
| 39 |
-
MODEL_PATH = "helinivan/
|
| 40 |
|
| 41 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
| 42 |
model = AutoModelForSequenceClassification.from_pretrained(MODEL_PATH)
|
| 43 |
|
| 44 |
-
text = "
|
| 45 |
tokenized_text = tokenizer([preprocess_data(text)], padding=True, truncation=True, max_length=512, return_tensors="pt")
|
| 46 |
output = model(**tokenized_text)
|
| 47 |
probs = output.logits.softmax(dim=-1).tolist()[0]
|
|
|
|
| 6 |
- text-classification
|
| 7 |
widget:
|
| 8 |
- text: "Auto, stop a diesel e benzina dal 2035. Ecco cosa cambia per i consumatori"
|
| 9 |
+
- text: "CIA Realizes It's Been Using Black Highlighters All These Years."
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Multilingual Sarcasm Detector
|
| 13 |
|
| 14 |
+
Mltilingual Sarcasm Detector is a text classification model built to detect sarcasm from news article titles. It is fine-tuned on bert-multilingual uncased and the training data consists of ready-made datasets available on Kaggle as well scraped data from multiple newspapers in English, Dutch and Italian.
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
## Training Data
|
| 18 |
+
|
| 19 |
+
Datasets:
|
| 20 |
+
- English language data: [Kaggle: News Headlines Dataset For Sarcasm Detection]([https://www.kaggle.com/datasets/rmisra/news-headlines-dataset-for-sarcasm-detection]).
|
| 21 |
+
- Dutch non-sarcastic data: [Kaggle: Dutch News Articles]([https://www.kaggle.com/datasets/maxscheijen/dutch-news-articles])
|
| 22 |
|
| 23 |
Scraped data:
|
| 24 |
+
- Dutch sarcastic news from [De Speld]([https://speld.nl])
|
| 25 |
- Italian non-sarcastic news from [Il Giornale]([https://www.ilgiornale.it])
|
| 26 |
- Italian sarcastic news from [Lercio]([https://www.lercio.it])
|
| 27 |
|
|
|
|
| 40 |
def preprocess_data(text: str) -> str:
|
| 41 |
return text.lower().translate(str.maketrans("", "", string.punctuation)).strip()
|
| 42 |
|
| 43 |
+
MODEL_PATH = "helinivan/multilingual-sarcasm-detector"
|
| 44 |
|
| 45 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
| 46 |
model = AutoModelForSequenceClassification.from_pretrained(MODEL_PATH)
|
| 47 |
|
| 48 |
+
text = "CIA Realizes It's Been Using Black Highlighters All These Years."
|
| 49 |
tokenized_text = tokenizer([preprocess_data(text)], padding=True, truncation=True, max_length=512, return_tensors="pt")
|
| 50 |
output = model(**tokenized_text)
|
| 51 |
probs = output.logits.softmax(dim=-1).tolist()[0]
|