File size: 23,202 Bytes
f4ef793 c518314 c600d00 f4ef793 285e4d9 8fe28fd 1f8eb0e 1939eed d28db7f 1d84d4a 52e2e2b 916102c f4ef793 916102c f4ef793 9400377 b7ab850 f4ef793 9400377 88611d7 f4ef793 d48c484 88611d7 285e4d9 140e6d4 d48c484 140e6d4 285e4d9 9400377 285e4d9 8fe28fd 9400377 8fe28fd 1f8eb0e 0f543b6 58777b6 1f8eb0e 1939eed c071786 d84685a d28db7f 916102c d28db7f 1d84d4a 52e2e2b dc775e4 6ab64e8 916102c d84685a f4ef793 916102c f4ef793 916102c f4ef793 916102c c518314 8fe28fd 9400377 1f8eb0e 9400377 dc775e4 916102c 58777b6 1939eed a9c8c25 916102c 1939eed d28db7f d84685a 8b233f5 d84685a 1d84d4a 3469cdc f8ff84a 916102c 1d84d4a 52e2e2b 916102c c518314 916102c 52e2e2b f4ef793 c600d00 f4ef793 c600d00 f4ef793 916102c e6f2070 b7ab850 88611d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
"""The SuperTweetEval benchmark."""
import json
import datasets
_VERSION = "0.1.5"
_SUPER_TWEETEVAL_CITATION = """TBA"""
_SUPER_TWEETEVAL_DESCRIPTION = """TBA"""
_TWEET_TOPIC_DESCRIPTION = """
TweetTopic is a multi-label twitter topic classification task, where each example consists of a tweet
and a set of topics. One tweet can be associated with multiple topics, and the training/validation tweets are taken
from September 2019 to August 2020, while the test tweets are taken from September 2020 to August 2021.
Following the original work, we evaluate with macro F1 score."""
_TWEET_TOPIC_CITATION = """\
@inproceedings{antypas-etal-2022-twitter,
title = "{T}witter Topic Classification",
author = "Antypas, Dimosthenis and
Ushio, Asahi and
Camacho-Collados, Jose and
Silva, Vitor and
Neves, Leonardo and
Barbieri, Francesco",
booktitle = "Proceedings of the 29th International Conference on Computational Linguistics",
month = oct,
year = "2022",
address = "Gyeongju, Republic of Korea",
publisher = "International Committee on Computational Linguistics",
url = "https://aclanthology.org/2022.coling-1.299",
pages = "3386--3400",
abstract = "Social media platforms host discussions about a wide variety of topics that arise everyday. Making sense of all the content and organising it into categories is an arduous task. A common way to deal with this issue is relying on topic modeling, but topics discovered using this technique are difficult to interpret and can differ from corpus to corpus. In this paper, we present a new task based on tweet topic classification and release two associated datasets. Given a wide range of topics covering the most important discussion points in social media, we provide training and testing data from recent time periods that can be used to evaluate tweet classification models. Moreover, we perform a quantitative evaluation and analysis of current general- and domain-specific language models on the task, which provide more insights on the challenges and nature of the task.",
}
"""
_TWEET_NER7_DESCRIPTION = """
TweetNER is a named-entity recognition dataset on Twitter. The training/validation tweets are taken
from September 2019 to August 2020, while the test tweets are taken from September 2020 to August 2021.
Following the original work, we evaluate with span F1 score.
"""
_TWEET_NER7_CITATION = """\
@inproceedings{ushio-etal-2022-named,
title = "Named Entity Recognition in {T}witter: A Dataset and Analysis on Short-Term Temporal Shifts",
author = "Ushio, Asahi and
Barbieri, Francesco and
Sousa, Vitor and
Neves, Leonardo and
Camacho-Collados, Jose",
booktitle = "Proceedings of the 2nd Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 12th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)",
month = nov,
year = "2022",
address = "Online only",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2022.aacl-main.25",
pages = "309--319",
abstract = "Recent progress in language model pre-training has led to important improvements in Named Entity Recognition (NER). Nonetheless, this progress has been mainly tested in well-formatted documents such as news, Wikipedia, or scientific articles. In social media the landscape is different, in which it adds another layer of complexity due to its noisy and dynamic nature. In this paper, we focus on NER in Twitter, one of the largest social media platforms, and construct a new NER dataset, TweetNER7, which contains seven entity types annotated over 11,382 tweets from September 2019 to August 2021. The dataset was constructed by carefully distributing the tweets over time and taking representative trends as a basis. Along with the dataset, we provide a set of language model baselines and perform an analysis on the language model performance on the task, especially analyzing the impact of different time periods. In particular, we focus on three important temporal aspects in our analysis: short-term degradation of NER models over time, strategies to fine-tune a language model over different periods, and self-labeling as an alternative to lack of recently-labeled data. TweetNER7 is released publicly (https://huggingface.co/datasets/tner/tweetner7) along with the models fine-tuned on it (NER models have been integrated into TweetNLP and can be found at https://github.com/asahi417/tner/tree/master/examples/tweetner7{\_}paper).",
}
"""
_TWEET_QA_DESCRIPTION = """\
TweetQA is am abstractive question-answering dataset on Twitter.
"""
_TWEET_QA_CITATION = """\
@inproceedings{xiong2019tweetqa,
title={TweetQA: A Social Media Focused Question Answering Dataset},
author={Xiong, Wenhan and Wu, Jiawei and Wang, Hong and Kulkarni, Vivek and Yu, Mo and Guo, Xiaoxiao and Chang, Shiyu and Wang, William Yang},
booktitle={Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},
year={2019}
}
"""
_TWEET_INTIMACY_DESCRIPTION = """\
See https://sites.google.com/umich.edu/semeval-2023-tweet-intimacy/home for more detail. We randomly take the same amount of
test set as the validation set.
"""
_TWEET_INTIMACY_CITATION = """\
@misc{pei2023semeval,
title={SemEval 2023 Task 9: Multilingual Tweet Intimacy Analysis},
author={Jiaxin Pei and Vítor Silva and Maarten Bos and Yozon Liu and Leonardo Neves and David Jurgens and Francesco Barbieri},
year={2023},
eprint={2210.01108},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
"""
_TWEET_SIMILARITY_DESCRIPTION = """TBA"""
_TWEET_SIMILARITY_CITATION = """TBA"""
_TEMPO_WIC_DESCRIPTION = """TBA"""
_TEMPO_WIC_CITATION = """\
@inproceedings{loureiro-etal-2022-tempowic,
title = "{T}empo{W}i{C}: An Evaluation Benchmark for Detecting Meaning Shift in Social Media",
author = "Loureiro, Daniel and
D{'}Souza, Aminette and
Muhajab, Areej Nasser and
White, Isabella A. and
Wong, Gabriel and
Espinosa-Anke, Luis and
Neves, Leonardo and
Barbieri, Francesco and
Camacho-Collados, Jose",
booktitle = "Proceedings of the 29th International Conference on Computational Linguistics",
month = oct,
year = "2022",
address = "Gyeongju, Republic of Korea",
publisher = "International Committee on Computational Linguistics",
url = "https://aclanthology.org/2022.coling-1.296",
pages = "3353--3359",
abstract = "Language evolves over time, and word meaning changes accordingly. This is especially true in social media, since its dynamic nature leads to faster semantic shifts, making it challenging for NLP models to deal with new content and trends. However, the number of datasets and models that specifically address the dynamic nature of these social platforms is scarce. To bridge this gap, we present TempoWiC, a new benchmark especially aimed at accelerating research in social media-based meaning shift. Our results show that TempoWiC is a challenging benchmark, even for recently-released language models specialized in social media.",
}
"""
_TWEET_HATE_DESCRIPTION = """TBA"""
_TWEET_HATE_CITATION = """\
@inproceedings{sachdeva-etal-2022-measuring,
title = "The Measuring Hate Speech Corpus: Leveraging Rasch Measurement Theory for Data Perspectivism",
author = "Sachdeva, Pratik and
Barreto, Renata and
Bacon, Geoff and
Sahn, Alexander and
von Vacano, Claudia and
Kennedy, Chris",
booktitle = "Proceedings of the 1st Workshop on Perspectivist Approaches to NLP @LREC2022",
month = jun,
year = "2022",
address = "Marseille, France",
publisher = "European Language Resources Association",
url = "https://aclanthology.org/2022.nlperspectives-1.11",
pages = "83--94",
abstract = "We introduce the Measuring Hate Speech corpus, a dataset created to measure hate speech while adjusting for annotators{'} perspectives. It consists of 50,070 social media comments spanning YouTube, Reddit, and Twitter, labeled by 11,143 annotators recruited from Amazon Mechanical Turk. Each observation includes 10 ordinal labels: sentiment, disrespect, insult, attacking/defending, humiliation, inferior/superior status, dehumanization, violence, genocide, and a 3-valued hate speech benchmark label. The labels are aggregated using faceted Rasch measurement theory (RMT) into a continuous score that measures each comment{'}s location on a hate speech spectrum. The annotation experimental design assigned comments to multiple annotators in order to yield a linked network, allowing annotator disagreement (perspective) to be statistically summarized. Annotators{'} labeling strictness was estimated during the RMT scaling, projecting their perspective onto a linear measure that was adjusted for the hate speech score. Models that incorporate this annotator perspective parameter as an auxiliary input can generate label- and score-level predictions conditional on annotator perspective. The corpus includes the identity group targets of each comment (8 groups, 42 subgroups) and annotator demographics (6 groups, 40 subgroups), facilitating analyses of interactions between annotator- and comment-level identities, i.e. identity-related annotator perspective.",
}
"""
_TWEET_NERD_DESCRIPTION = """TBA"""
_TWEET_NERD_CITATION = """\
@article{mishra2022tweetnerd,
title={TweetNERD--End to End Entity Linking Benchmark for Tweets},
author={Mishra, Shubhanshu and Saini, Aman and Makki, Raheleh and Mehta, Sneha and Haghighi, Aria and Mollahosseini, Ali},
journal={arXiv preprint arXiv:2210.08129},
year={2022}
}
"""
_TWEET_EMOJI_DESCRIPTION = """TBA"""
_TWEET_EMOJI_CITATION = """TBA"""
_TWEET_SENTIMENT_DESCRIPTION = """TBA"""
_TWEET_SENTIMENT_CITATION = """\
@inproceedings{rosenthal-etal-2017-semeval,
title = "{S}em{E}val-2017 Task 4: Sentiment Analysis in {T}witter",
author = "Rosenthal, Sara and
Farra, Noura and
Nakov, Preslav",
booktitle = "Proceedings of the 11th International Workshop on Semantic Evaluation ({S}em{E}val-2017)",
month = aug,
year = "2017",
address = "Vancouver, Canada",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/S17-2088",
doi = "10.18653/v1/S17-2088",
pages = "502--518",
abstract = "This paper describes the fifth year of the Sentiment Analysis in Twitter task. SemEval-2017 Task 4 continues with a rerun of the subtasks of SemEval-2016 Task 4, which include identifying the overall sentiment of the tweet, sentiment towards a topic with classification on a two-point and on a five-point ordinal scale, and quantification of the distribution of sentiment towards a topic across a number of tweets: again on a two-point and on a five-point ordinal scale. Compared to 2016, we made two changes: (i) we introduced a new language, Arabic, for all subtasks, and (ii) we made available information from the profiles of the Twitter users who posted the target tweets. The task continues to be very popular, with a total of 48 teams participating this year.",
}
"""
_TWEET_EMOTION_DESCRIPTION = """TBA"""
_TWEET_EMOTION_CITATION = """\
@inproceedings{mohammad-etal-2018-semeval,
title = "{S}em{E}val-2018 Task 1: Affect in Tweets",
author = "Mohammad, Saif and
Bravo-Marquez, Felipe and
Salameh, Mohammad and
Kiritchenko, Svetlana",
booktitle = "Proceedings of the 12th International Workshop on Semantic Evaluation",
month = jun,
year = "2018",
address = "New Orleans, Louisiana",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/S18-1001",
doi = "10.18653/v1/S18-1001",
pages = "1--17",
abstract = "We present the SemEval-2018 Task 1: Affect in Tweets, which includes an array of subtasks on inferring the affectual state of a person from their tweet. For each task, we created labeled data from English, Arabic, and Spanish tweets. The individual tasks are: 1. emotion intensity regression, 2. emotion intensity ordinal classification, 3. valence (sentiment) regression, 4. valence ordinal classification, and 5. emotion classification. Seventy-five teams (about 200 team members) participated in the shared task. We summarize the methods, resources, and tools used by the participating teams, with a focus on the techniques and resources that are particularly useful. We also analyze systems for consistent bias towards a particular race or gender. The data is made freely available to further improve our understanding of how people convey emotions through language.",
}
"""
class SuperTweetEvalConfig(datasets.BuilderConfig):
"""BuilderConfig for SuperTweetEval."""
def __init__(self, features, data_url, citation, label_classes=("False", "True"), **kwargs):
"""BuilderConfig for SuperTweetEval.
Args:
features: `list[string]`, list of the features that will appear in the
feature dict. Should not include "label".
data_url: `string`, url to download the zip file from.
citation: `string`, citation for the data set.
url: `string`, url for information about the data set.
label_classes: `list[string]`, the list of classes for the label if the
label is present as a string. Non-string labels will be cast to either
'False' or 'True'.
**kwargs: keyword arguments forwarded to super.
"""
super(SuperTweetEvalConfig, self).__init__(
version=datasets.Version(_VERSION), **kwargs)
self.features = features
self.label_classes = label_classes
self.data_url = data_url
self.citation = citation
class SuperTweetEval(datasets.GeneratorBasedBuilder):
"""The SuperTweetEval benchmark."""
BUILDER_CONFIGS = [
SuperTweetEvalConfig(
name="tweet_topic",
description=_TWEET_TOPIC_DESCRIPTION,
citation=_TWEET_TOPIC_CITATION,
features=["text", "gold_label_list", "date"],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_topic",
),
SuperTweetEvalConfig(
name="tweet_ner7",
description=_TWEET_NER7_DESCRIPTION,
citation=_TWEET_NER7_CITATION,
features=["text", "text_tokenized", "gold_label_sequence", "date"],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_ner7",
),
SuperTweetEvalConfig(
name="tweet_qa",
description=_TWEET_QA_DESCRIPTION,
citation=_TWEET_QA_CITATION,
features=["text", "context", "gold_label_str"],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_qa",
),
SuperTweetEvalConfig(
name="tweet_qg",
description=_TWEET_QA_DESCRIPTION,
citation=_TWEET_QA_CITATION,
features=["text", "context", "gold_label_str"],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_qg",
),
SuperTweetEvalConfig(
name="tweet_intimacy",
description=_TWEET_INTIMACY_DESCRIPTION,
citation=_TWEET_INTIMACY_CITATION,
features=["text", "gold_score"],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_intimacy",
),
SuperTweetEvalConfig(
name="tweet_similarity",
description=_TWEET_SIMILARITY_DESCRIPTION,
citation=_TWEET_SIMILARITY_CITATION,
features=["text_1", "text_2", "gold_score"],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_similarity",
),
SuperTweetEvalConfig(
name="tempo_wic",
description=_TEMPO_WIC_DESCRIPTION,
citation=_TEMPO_WIC_CITATION,
features=['gold_label_binary', 'word',
'text_1', 'text_1_tokenized', 'text_start_1', 'text_end_1', 'date_1',
'text_2', 'text_2_tokenized', 'text_start_2', 'text_end_2', 'date_2'],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tempo_wic",
),
SuperTweetEvalConfig(
name="tweet_hate",
description=_TWEET_HATE_DESCRIPTION,
citation=_TWEET_HATE_CITATION,
features=['gold_label', 'text'],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_hate",
),
SuperTweetEvalConfig(
name="tweet_nerd",
description=_TWEET_NERD_DESCRIPTION,
citation=_TWEET_NERD_CITATION,
features=['gold_label_binary', 'target', 'context',
'definition', 'text_start', 'text_end'],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_nerd",
),
SuperTweetEvalConfig(
name="tweet_emoji",
description=_TWEET_EMOJI_DESCRIPTION,
citation=_TWEET_EMOJI_CITATION,
features=['gold_label', 'text'],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_emoji",
),
SuperTweetEvalConfig(
name="tweet_sentiment",
description=_TWEET_SENTIMENT_DESCRIPTION,
citation=_TWEET_SENTIMENT_CITATION,
features=['gold_label', 'target', 'text'],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_sentiment",
),
SuperTweetEvalConfig(
name="tweet_emotion",
description=_TWEET_EMOTION_DESCRIPTION,
citation=_TWEET_EMOTION_CITATION,
features=["text", "gold_label_list"],
data_url="https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_emotion",
)
]
def _info(self):
features = {feature: datasets.Value(
"string") for feature in self.config.features}
if self.config.name == "tweet_topic":
names = [
"arts_&_culture", "business_&_entrepreneurs", "celebrity_&_pop_culture", "diaries_&_daily_life",
"family", "fashion_&_style", "film_tv_&_video", "fitness_&_health", "food_&_dining", "gaming",
"learning_&_educational", "music", "news_&_social_concern", "other_hobbies", "relationships",
"science_&_technology", "sports", "travel_&_adventure", "youth_&_student_life"]
features["gold_label_list"] = datasets.Sequence(
datasets.features.ClassLabel(names=names))
if self.config.name == "tweet_ner7":
names = [
'B-corporation', 'B-creative_work', 'B-event', 'B-group', 'B-location', 'B-person', 'B-product',
'I-corporation', 'I-creative_work', 'I-event', 'I-group', 'I-location', 'I-person', 'I-product', 'O']
features["gold_label_sequence"] = datasets.Sequence(
datasets.features.ClassLabel(names=names))
features["text_tokenized"] = datasets.Sequence(
datasets.Value("string"))
features["entities"] = datasets.Sequence({"entity": datasets.Value("string"), "type": datasets.Value("string")})
if self.config.name in ["tweet_intimacy", "tweet_similarity"]:
features["gold_score"] = datasets.Value("float32")
if self.config.name == "tempo_wic":
features["gold_label_binary"] = datasets.Value("int32")
features["text_start_1"] = datasets.Value("int32")
features["text_start_2"] = datasets.Value("int32")
features["text_end_1"] = datasets.Value("int32")
features["text_end_2"] = datasets.Value("int32")
features["text_1_tokenized"] = datasets.Sequence(
datasets.Value("string"))
features["text_2_tokenized"] = datasets.Sequence(
datasets.Value("string"))
features['date_1'] = datasets.Value("string")
features['date_2'] = datasets.Value("string")
if self.config.name == "tweet_hate":
label_classes = [
'hate_gender', 'hate_race', 'hate_sexuality', 'hate_religion', 'hate_origin', 'hate_disability',
'hate_age', 'not_hate']
features['gold_label'] = datasets.features.ClassLabel(
names=label_classes)
features["text"] = datasets.Value("string")
if self.config.name == "tweet_nerd":
features['target'] = datasets.Value("string")
features['context'] = datasets.Value("string")
features['definition'] = datasets.Value("string")
features['text_start'] = datasets.Value("int32")
features['text_end'] = datasets.Value("int32")
features['gold_label_binary'] = datasets.Value("int32")
if self.config.name == "tweet_emoji":
# download class mapping
dl_manager = datasets.utils.download_manager.DownloadManager()
url_map = "https://huggingface.co/datasets/cardiffnlp/super_tweet_eval/resolve/main/data/tweet_emoji/map.txt"
with open(dl_manager.download(url_map)) as f:
label_classes = f.readlines()
label_classes = [x.strip('\n') for x in label_classes]
features['gold_label'] = datasets.features.ClassLabel(
names=label_classes)
features["text"] = datasets.Value("string")
if self.config.name == "tweet_sentiment":
features["text"] = datasets.Value("string")
names = ['anger', 'anticipation', 'disgust', 'fear', 'joy',
'love', 'optimism', 'pessimism', 'sadness', 'surprise', 'trust']
features["gold_label_list"] = datasets.Sequence(
datasets.features.ClassLabel(names=names))
return datasets.DatasetInfo(
description=_SUPER_TWEETEVAL_DESCRIPTION + "\n" + self.config.description,
features=datasets.Features(features),
citation=self.config.citation + "\n" + _SUPER_TWEETEVAL_CITATION,
)
def _split_generators(self, dl_manager):
splits = ['train', 'test', 'validation']
downloaded_file = dl_manager.download_and_extract(
{s: f"{self.config.data_url}/{s}.jsonl" for s in splits})
return [datasets.SplitGenerator(name=s, gen_kwargs={"filepath": downloaded_file[s]}) for s in splits]
def _generate_examples(self, filepath):
_key = 0
with open(filepath, encoding="utf-8") as f:
_list = [i for i in f.read().split('\n') if len(i) > 0]
for i in _list:
data = json.loads(i)
yield _key, data
_key += 1
|