added sentiment/emoji labels
Browse files- data/tweet_hate/map.txt +8 -0
- data/tweet_sentiment/test.jsonl +0 -0
- data/tweet_sentiment/train.jsonl +0 -0
- data/tweet_sentiment/validation.jsonl +0 -0
- process/tweet_sentiment.py +13 -0
- super_tweet_eval.py +8 -7
data/tweet_hate/map.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
0,hate_gender
|
| 2 |
+
1,hate_race
|
| 3 |
+
2,hate_sexuality
|
| 4 |
+
3,hate_religion
|
| 5 |
+
4,hate_origin
|
| 6 |
+
5,hate_disability
|
| 7 |
+
6,hate_age
|
| 8 |
+
7,not_hate
|
data/tweet_sentiment/test.jsonl
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/tweet_sentiment/train.jsonl
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/tweet_sentiment/validation.jsonl
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
process/tweet_sentiment.py
CHANGED
|
@@ -59,6 +59,19 @@ train['text'] = train['text'].apply(clean_text)
|
|
| 59 |
validation['text'] = validation['text'].apply(clean_text)
|
| 60 |
test['text'] = test['text'].apply(clean_text)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# save splits
|
| 63 |
cols_to_keep = ['gold_label', 'topic', 'text']
|
| 64 |
train[cols_to_keep].to_json(
|
|
|
|
| 59 |
validation['text'] = validation['text'].apply(clean_text)
|
| 60 |
test['text'] = test['text'].apply(clean_text)
|
| 61 |
|
| 62 |
+
# map classes to 0-4
|
| 63 |
+
class_map = {
|
| 64 |
+
-2:0,
|
| 65 |
+
-1:1,
|
| 66 |
+
0:2,
|
| 67 |
+
1:3,
|
| 68 |
+
2:4
|
| 69 |
+
}
|
| 70 |
+
train['gold_label'] = train['gold_label'].map(class_map)
|
| 71 |
+
validation['gold_label'] = validation['gold_label'].map(class_map)
|
| 72 |
+
test['gold_label'] = test['gold_label'].map(class_map)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
# save splits
|
| 76 |
cols_to_keep = ['gold_label', 'topic', 'text']
|
| 77 |
train[cols_to_keep].to_json(
|
super_tweet_eval.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
import json
|
| 3 |
import datasets
|
| 4 |
|
| 5 |
-
_VERSION = "0.1.
|
| 6 |
_SUPER_TWEET_EVAL_CITATION = """TBA"""
|
| 7 |
_SUPER_TWEET_EVAL_DESCRIPTION = """TBA"""
|
| 8 |
_TWEET_TOPIC_DESCRIPTION = """
|
|
@@ -274,8 +274,6 @@ class SuperTweetEval(datasets.GeneratorBasedBuilder):
|
|
| 274 |
features["gold_score"] = datasets.Value("float32")
|
| 275 |
if self.config.name == "tempo_wic":
|
| 276 |
features["gold_label_binary"] = datasets.Value("int32")
|
| 277 |
-
# features["token_idx_1"] = datasets.Value("int32")
|
| 278 |
-
# features["token_idx_2"] = datasets.Value("int32")
|
| 279 |
features["text_start_1"] = datasets.Value("int32")
|
| 280 |
features["text_start_2"] = datasets.Value("int32")
|
| 281 |
features["text_end_1"] = datasets.Value("int32")
|
|
@@ -285,9 +283,8 @@ class SuperTweetEval(datasets.GeneratorBasedBuilder):
|
|
| 285 |
if self.config.name == "tweet_hate":
|
| 286 |
label_classes = [
|
| 287 |
'hate_gender','hate_race', 'hate_sexuality', 'hate_religion','hate_origin', 'hate_disability',
|
| 288 |
-
'
|
| 289 |
features['gold_label'] = datasets.features.ClassLabel(names=label_classes)
|
| 290 |
-
#features["gold_label"] = datasets.Value("int32")
|
| 291 |
features["text"] = datasets.Value("string")
|
| 292 |
if self.config.name == "tweet_nerd":
|
| 293 |
features['target'] = datasets.Value("string")
|
|
@@ -297,10 +294,14 @@ class SuperTweetEval(datasets.GeneratorBasedBuilder):
|
|
| 297 |
features['text_end'] = datasets.Value("int32")
|
| 298 |
features['gold_label_binary'] = datasets.Value("int32")
|
| 299 |
if self.config.name == "tweet_emoji":
|
| 300 |
-
|
|
|
|
|
|
|
|
|
|
| 301 |
features["text"] = datasets.Value("string")
|
| 302 |
if self.config.name == "tweet_sentiment":
|
| 303 |
-
|
|
|
|
| 304 |
features["text"] = datasets.Value("string")
|
| 305 |
features["target"] = datasets.Value("string")
|
| 306 |
|
|
|
|
| 2 |
import json
|
| 3 |
import datasets
|
| 4 |
|
| 5 |
+
_VERSION = "0.1.38"
|
| 6 |
_SUPER_TWEET_EVAL_CITATION = """TBA"""
|
| 7 |
_SUPER_TWEET_EVAL_DESCRIPTION = """TBA"""
|
| 8 |
_TWEET_TOPIC_DESCRIPTION = """
|
|
|
|
| 274 |
features["gold_score"] = datasets.Value("float32")
|
| 275 |
if self.config.name == "tempo_wic":
|
| 276 |
features["gold_label_binary"] = datasets.Value("int32")
|
|
|
|
|
|
|
| 277 |
features["text_start_1"] = datasets.Value("int32")
|
| 278 |
features["text_start_2"] = datasets.Value("int32")
|
| 279 |
features["text_end_1"] = datasets.Value("int32")
|
|
|
|
| 283 |
if self.config.name == "tweet_hate":
|
| 284 |
label_classes = [
|
| 285 |
'hate_gender','hate_race', 'hate_sexuality', 'hate_religion','hate_origin', 'hate_disability',
|
| 286 |
+
'hate_age', 'not_hate']
|
| 287 |
features['gold_label'] = datasets.features.ClassLabel(names=label_classes)
|
|
|
|
| 288 |
features["text"] = datasets.Value("string")
|
| 289 |
if self.config.name == "tweet_nerd":
|
| 290 |
features['target'] = datasets.Value("string")
|
|
|
|
| 294 |
features['text_end'] = datasets.Value("int32")
|
| 295 |
features['gold_label_binary'] = datasets.Value("int32")
|
| 296 |
if self.config.name == "tweet_emoji":
|
| 297 |
+
with open('./data/tweet_emoji/map.txt') as f:
|
| 298 |
+
label_classes = f.readlines()
|
| 299 |
+
label_classes = [x.strip('\n') for x in label_classes]
|
| 300 |
+
features['gold_label'] = datasets.features.ClassLabel(names=label_classes)
|
| 301 |
features["text"] = datasets.Value("string")
|
| 302 |
if self.config.name == "tweet_sentiment":
|
| 303 |
+
label_classes = ["strongly negative", "negative", "negative or neutral", "positive", "strongly positive"]
|
| 304 |
+
features['gold_label'] = datasets.features.ClassLabel(names=label_classes)
|
| 305 |
features["text"] = datasets.Value("string")
|
| 306 |
features["target"] = datasets.Value("string")
|
| 307 |
|