init
Browse files- .gitattributes +3 -0
- data/tweet_intimacy/test.jsonl +3 -0
- data/tweet_intimacy/train.jsonl +3 -0
- data/tweet_intimacy/validation.jsonl +3 -0
- process/tweet_intimacy.py +33 -0
- super_tweet_eval.py +23 -0
.gitattributes
CHANGED
|
@@ -61,3 +61,6 @@ data/tweet_ner7/test.jsonl filter=lfs diff=lfs merge=lfs -text
|
|
| 61 |
data/tweet_ner7/train.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 62 |
data/tweet_ner7/validation.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 63 |
data/tweet_qa/test.jsonl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
data/tweet_ner7/train.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 62 |
data/tweet_ner7/validation.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 63 |
data/tweet_qa/test.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
data/tweet_intimacy/validation.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
data/tweet_intimacy/test.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
data/tweet_intimacy/train.jsonl filter=lfs diff=lfs merge=lfs -text
|
data/tweet_intimacy/test.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65d90ca4aa24f1ce66dee43de896a3cec2d66cc61ef99cfa5fca890843b999cd
|
| 3 |
+
size 39034
|
data/tweet_intimacy/train.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d298076649d94845628a800b2fb9f801b009518d9cde6b45845d21b06de0f30d
|
| 3 |
+
size 121089
|
data/tweet_intimacy/validation.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:40a4dc181f8cf3a8e259e510efc533762c7ac7baee7f8058e7b8d23e37f89e85
|
| 3 |
+
size 40483
|
process/tweet_intimacy.py
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
from random import shuffle, seed
|
| 4 |
+
import pandas as pd
|
| 5 |
+
|
| 6 |
+
os.makedirs("data/tweet_intimacy", exist_ok=True)
|
| 7 |
+
df_test = pd.read_csv("misc/multilingual_tweet_intimacy/test.csv")
|
| 8 |
+
df_test = df_test[df_test['language'] == 'English']
|
| 9 |
+
df_test.pop("language")
|
| 10 |
+
test = [i.to_dict() for _, i in df_test.iterrows()]
|
| 11 |
+
for i in test:
|
| 12 |
+
i['label_float'] = i.pop("label")
|
| 13 |
+
|
| 14 |
+
df_train = pd.read_csv("misc/multilingual_tweet_intimacy/train.csv")
|
| 15 |
+
df_train = df_train[df_train['language'] == 'English']
|
| 16 |
+
df_train.pop("language")
|
| 17 |
+
train = [i.to_dict() for _, i in df_train.iterrows()]
|
| 18 |
+
for i in train:
|
| 19 |
+
i['label_float'] = i.pop("label")
|
| 20 |
+
seed(42)
|
| 21 |
+
shuffle(train)
|
| 22 |
+
val = train[:len(test)]
|
| 23 |
+
train = train[len(test):]
|
| 24 |
+
|
| 25 |
+
with open("data/tweet_intimacy/train.jsonl", "w") as f:
|
| 26 |
+
f.write("\n".join([json.dumps(i) for i in train]))
|
| 27 |
+
with open("data/tweet_intimacy/validation.jsonl", "w") as f:
|
| 28 |
+
f.write("\n".join([json.dumps(i) for i in val]))
|
| 29 |
+
with open("data/tweet_intimacy/test.jsonl", "w") as f:
|
| 30 |
+
f.write("\n".join([json.dumps(i) for i in test]))
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
super_tweet_eval.py
CHANGED
|
@@ -63,6 +63,20 @@ _TWEET_QA_CITATION = """\
|
|
| 63 |
year={2019}
|
| 64 |
}
|
| 65 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
class SuperTweetEvalConfig(datasets.BuilderConfig):
|
|
@@ -113,6 +127,13 @@ class SuperTweetEval(datasets.GeneratorBasedBuilder):
|
|
| 113 |
citation=_TWEET_QA_CITATION,
|
| 114 |
features=["text", "label_str", "paragraph", "question"],
|
| 115 |
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_qa",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
)
|
| 117 |
]
|
| 118 |
|
|
@@ -130,6 +151,8 @@ class SuperTweetEval(datasets.GeneratorBasedBuilder):
|
|
| 130 |
'B-corporation', 'B-creative_work', 'B-event', 'B-group', 'B-location', 'B-person', 'B-product',
|
| 131 |
'I-corporation', 'I-creative_work', 'I-event', 'I-group', 'I-location', 'I-person', 'I-product', 'O']
|
| 132 |
features["label_sequence"] = datasets.Sequence(datasets.features.ClassLabel(names=names))
|
|
|
|
|
|
|
| 133 |
|
| 134 |
return datasets.DatasetInfo(
|
| 135 |
description=_SUPER_TWEET_EVAL_DESCRIPTION + "\n" + self.config.description,
|
|
|
|
| 63 |
year={2019}
|
| 64 |
}
|
| 65 |
"""
|
| 66 |
+
_TWEET_INTIMACY_DESCRIPTION = """\
|
| 67 |
+
See https://sites.google.com/umich.edu/semeval-2023-tweet-intimacy/home for more detail. We randomly take the same amount of
|
| 68 |
+
test set as the validation set.
|
| 69 |
+
"""
|
| 70 |
+
_TWEET_INTIMACY_CITATION = """\
|
| 71 |
+
@misc{pei2023semeval,
|
| 72 |
+
title={SemEval 2023 Task 9: Multilingual Tweet Intimacy Analysis},
|
| 73 |
+
author={Jiaxin Pei and Vítor Silva and Maarten Bos and Yozon Liu and Leonardo Neves and David Jurgens and Francesco Barbieri},
|
| 74 |
+
year={2023},
|
| 75 |
+
eprint={2210.01108},
|
| 76 |
+
archivePrefix={arXiv},
|
| 77 |
+
primaryClass={cs.CL}
|
| 78 |
+
}
|
| 79 |
+
"""
|
| 80 |
|
| 81 |
|
| 82 |
class SuperTweetEvalConfig(datasets.BuilderConfig):
|
|
|
|
| 127 |
citation=_TWEET_QA_CITATION,
|
| 128 |
features=["text", "label_str", "paragraph", "question"],
|
| 129 |
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_qa",
|
| 130 |
+
),
|
| 131 |
+
SuperTweetEvalConfig(
|
| 132 |
+
name="tweet_intimacy",
|
| 133 |
+
description=_TWEET_INTIMACY_DESCRIPTION,
|
| 134 |
+
citation=_TWEET_INTIMACY_CITATION,
|
| 135 |
+
features=["text", "label_float"],
|
| 136 |
+
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_intimacy",
|
| 137 |
)
|
| 138 |
]
|
| 139 |
|
|
|
|
| 151 |
'B-corporation', 'B-creative_work', 'B-event', 'B-group', 'B-location', 'B-person', 'B-product',
|
| 152 |
'I-corporation', 'I-creative_work', 'I-event', 'I-group', 'I-location', 'I-person', 'I-product', 'O']
|
| 153 |
features["label_sequence"] = datasets.Sequence(datasets.features.ClassLabel(names=names))
|
| 154 |
+
if self.config.name == "tweet_intimacy":
|
| 155 |
+
features["label_float"] = datasets.Value("float32")
|
| 156 |
|
| 157 |
return datasets.DatasetInfo(
|
| 158 |
description=_SUPER_TWEET_EVAL_DESCRIPTION + "\n" + self.config.description,
|