cardiffnlp/tweet_topic_multi

Dataset

12

stars

61

commits

1

linked in READMEs

Jun 12, 2025

updated

README

Dataset Card for "cardiffnlp/tweet_topic_multi"

Dataset Description

Dataset Summary

This is the official repository of TweetTopic ("Twitter Topic Classification , COLING main conference 2022"), a topic classification dataset on Twitter with 19 labels. Each instance of TweetTopic comes with a timestamp which distributes from September 2019 to August 2021. See cardiffnlp/tweet_topic_single for single label version of TweetTopic. The tweet collection used in TweetTopic is same as what used in TweetNER7. The dataset is integrated in TweetNLP too.

Preprocessing

We pre-process tweets before the annotation to normalize some artifacts, converting URLs into a special token {{URL}} and non-verified usernames into {{USERNAME}}. For verified usernames, we replace its display name (or account name) with symbols {@}. For example, a tweet

Get the all-analog Classic Vinyl Edition
of "Takin' Off" Album from @herbiehancock
via @bluenoterecords link below: 
http://bluenote.lnk.to/AlbumOfTheWeek

is transformed into the following text.

Get the all-analog Classic Vinyl Edition
of "Takin' Off" Album from {@herbiehancock@}
via {@bluenoterecords@} link below: {{URL}}

A simple function to format tweet follows below.

import re
from urlextract import URLExtract
extractor = URLExtract()

def format_tweet(tweet):
    # mask web urls
    urls = extractor.find_urls(tweet)
    for url in urls:
        tweet = tweet.replace(url, "{{URL}}")
    # format twitter account
    tweet = re.sub(r"\b(\s*)(@[\S]+)\b", r'\1{\2@}', tweet)
    return tweet

target = """Get the all-analog Classic Vinyl Edition of "Takin' Off" Album from @herbiehancock via @bluenoterecords link below: http://bluenote.lnk.to/AlbumOfTheWeek"""
target_format = format_tweet(target)
print(target_format)
'Get the all-analog Classic Vinyl Edition of "Takin\' Off" Album from {@herbiehancock@} via {@bluenoterecords@} link below: {{URL}}'

Data Splits

splitnumber of textsdescription
test_2020573test dataset from September 2019 to August 2020
test_20211679test dataset from September 2020 to August 2021
train_20204585training dataset from September 2019 to August 2020
train_20211505training dataset from September 2020 to August 2021
train_all6090combined training dataset of train_2020 and train_2021
validation_2020573validation dataset from September 2019 to August 2020
validation_2021188validation dataset from September 2020 to August 2021
train_random4564randomly sampled training dataset with the same size as train_2020 from train_all
validation_random573randomly sampled training dataset with the same size as validation_2020 from validation_all
test_coling2022_random5536random split used in the COLING 2022 paper
train_coling2022_random5731random split used in the COLING 2022 paper
test_coling20225536temporal split used in the COLING 2022 paper
train_coling20225731temporal split used in the COLING 2022 paper

For the temporal-shift setting, model should be trained on train_2020 with validation_2020 and evaluate on test_2021. In general, model would be trained on train_all, the most representative training set with validation_2021 and evaluate on test_2021.

IMPORTANT NOTE: To get a result that is comparable with the results of the COLING 2022 Tweet Topic paper, please use train_coling2022 and test_coling2022 for temporal-shift, and train_coling2022_random and test_coling2022_random fir random split (the coling2022 split does not have validation set).

Models

modeltraining dataF1F1 (macro)Accuracy
cardiffnlp/roberta-large-tweet-topic-multi-allall (2020 + 2021)0.7631040.6202570.536629
cardiffnlp/roberta-base-tweet-topic-multi-allall (2020 + 2021)0.7518140.6007820.531864
cardiffnlp/twitter-roberta-base-2019-90m-tweet-topic-multi-allall (2020 + 2021)0.7625130.6035330.547945
cardiffnlp/twitter-roberta-base-dec2020-tweet-topic-multi-allall (2020 + 2021)0.7599170.599010.536033
cardiffnlp/twitter-roberta-base-dec2021-tweet-topic-multi-allall (2020 + 2021)0.7647670.6187020.548541
cardiffnlp/roberta-large-tweet-topic-multi-20202020 only0.7323660.5794560.493746
cardiffnlp/roberta-base-tweet-topic-multi-20202020 only0.7252290.5612610.499107
cardiffnlp/twitter-roberta-base-2019-90m-tweet-topic-multi-20202020 only0.736710.5656240.513401
cardiffnlp/twitter-roberta-base-dec2020-tweet-topic-multi-20202020 only0.7294460.5347990.50268
cardiffnlp/twitter-roberta-base-dec2021-tweet-topic-multi-20202020 only0.7311060.5321410.509827

Model fine-tuning script can be found here.

Dataset Structure

Data Instances

An example of train looks as follows.

{
    "date": "2021-03-07",
    "text": "The latest The Movie theater Daily! {{URL}} Thanks to {{USERNAME}} {{USERNAME}} {{USERNAME}} #lunchtimeread #amc1000",
    "id": "1368464923370676231",
    "label": [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    "label_name": ["film_tv_&_video"]
}

Labels

0: arts_&_culture5: fashion_&_style10: learning_&_educational15: science_&_technology
1: business_&_entrepreneurs6: film_tv_&_video11: music16: sports
2: celebrity_&_pop_culture7: fitness_&_health12: news_&_social_concern17: travel_&_adventure
3: diaries_&_daily_life8: food_&_dining13: other_hobbies18: youth_&_student_life
4: family9: gaming14: relationships

Annotation instructions can be found here.

The label2id dictionary can be found here.

Citation Information

@inproceedings{dimosthenis-etal-2022-twitter,
    title = "{T}witter {T}opic {C}lassification",
    author = "Antypas, Dimosthenis  and
    Ushio, Asahi  and
    Camacho-Collados, Jose  and
    Neves, Leonardo  and
    Silva, Vitor  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"
}

Contributors

asahi417

58 commits

antypasd

3 commits

cardiffnlp/tweet_topic_multi

Dataset

12

stars

61

commits

1

linked in READMEs

Jun 12, 2025

updated

README

Dataset Card for "cardiffnlp/tweet_topic_multi"

Dataset Description

Dataset Summary

This is the official repository of TweetTopic ("Twitter Topic Classification , COLING main conference 2022"), a topic classification dataset on Twitter with 19 labels. Each instance of TweetTopic comes with a timestamp which distributes from September 2019 to August 2021. See cardiffnlp/tweet_topic_single for single label version of TweetTopic. The tweet collection used in TweetTopic is same as what used in TweetNER7. The dataset is integrated in TweetNLP too.

Preprocessing

We pre-process tweets before the annotation to normalize some artifacts, converting URLs into a special token {{URL}} and non-verified usernames into {{USERNAME}}. For verified usernames, we replace its display name (or account name) with symbols {@}. For example, a tweet

Get the all-analog Classic Vinyl Edition
of "Takin' Off" Album from @herbiehancock
via @bluenoterecords link below: 
http://bluenote.lnk.to/AlbumOfTheWeek

is transformed into the following text.

Get the all-analog Classic Vinyl Edition
of "Takin' Off" Album from {@herbiehancock@}
via {@bluenoterecords@} link below: {{URL}}

A simple function to format tweet follows below.

import re
from urlextract import URLExtract
extractor = URLExtract()

def format_tweet(tweet):
    # mask web urls
    urls = extractor.find_urls(tweet)
    for url in urls:
        tweet = tweet.replace(url, "{{URL}}")
    # format twitter account
    tweet = re.sub(r"\b(\s*)(@[\S]+)\b", r'\1{\2@}', tweet)
    return tweet

target = """Get the all-analog Classic Vinyl Edition of "Takin' Off" Album from @herbiehancock via @bluenoterecords link below: http://bluenote.lnk.to/AlbumOfTheWeek"""
target_format = format_tweet(target)
print(target_format)
'Get the all-analog Classic Vinyl Edition of "Takin\' Off" Album from {@herbiehancock@} via {@bluenoterecords@} link below: {{URL}}'

Data Splits

splitnumber of textsdescription
test_2020573test dataset from September 2019 to August 2020
test_20211679test dataset from September 2020 to August 2021
train_20204585training dataset from September 2019 to August 2020
train_20211505training dataset from September 2020 to August 2021
train_all6090combined training dataset of train_2020 and train_2021
validation_2020573validation dataset from September 2019 to August 2020
validation_2021188validation dataset from September 2020 to August 2021
train_random4564randomly sampled training dataset with the same size as train_2020 from train_all
validation_random573randomly sampled training dataset with the same size as validation_2020 from validation_all
test_coling2022_random5536random split used in the COLING 2022 paper
train_coling2022_random5731random split used in the COLING 2022 paper
test_coling20225536temporal split used in the COLING 2022 paper
train_coling20225731temporal split used in the COLING 2022 paper

For the temporal-shift setting, model should be trained on train_2020 with validation_2020 and evaluate on test_2021. In general, model would be trained on train_all, the most representative training set with validation_2021 and evaluate on test_2021.

IMPORTANT NOTE: To get a result that is comparable with the results of the COLING 2022 Tweet Topic paper, please use train_coling2022 and test_coling2022 for temporal-shift, and train_coling2022_random and test_coling2022_random fir random split (the coling2022 split does not have validation set).

Models

modeltraining dataF1F1 (macro)Accuracy
cardiffnlp/roberta-large-tweet-topic-multi-allall (2020 + 2021)0.7631040.6202570.536629
cardiffnlp/roberta-base-tweet-topic-multi-allall (2020 + 2021)0.7518140.6007820.531864
cardiffnlp/twitter-roberta-base-2019-90m-tweet-topic-multi-allall (2020 + 2021)0.7625130.6035330.547945
cardiffnlp/twitter-roberta-base-dec2020-tweet-topic-multi-allall (2020 + 2021)0.7599170.599010.536033
cardiffnlp/twitter-roberta-base-dec2021-tweet-topic-multi-allall (2020 + 2021)0.7647670.6187020.548541
cardiffnlp/roberta-large-tweet-topic-multi-20202020 only0.7323660.5794560.493746
cardiffnlp/roberta-base-tweet-topic-multi-20202020 only0.7252290.5612610.499107
cardiffnlp/twitter-roberta-base-2019-90m-tweet-topic-multi-20202020 only0.736710.5656240.513401
cardiffnlp/twitter-roberta-base-dec2020-tweet-topic-multi-20202020 only0.7294460.5347990.50268
cardiffnlp/twitter-roberta-base-dec2021-tweet-topic-multi-20202020 only0.7311060.5321410.509827

Model fine-tuning script can be found here.

Dataset Structure

Data Instances

An example of train looks as follows.

{
    "date": "2021-03-07",
    "text": "The latest The Movie theater Daily! {{URL}} Thanks to {{USERNAME}} {{USERNAME}} {{USERNAME}} #lunchtimeread #amc1000",
    "id": "1368464923370676231",
    "label": [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    "label_name": ["film_tv_&_video"]
}

Labels

0: arts_&_culture5: fashion_&_style10: learning_&_educational15: science_&_technology
1: business_&_entrepreneurs6: film_tv_&_video11: music16: sports
2: celebrity_&_pop_culture7: fitness_&_health12: news_&_social_concern17: travel_&_adventure
3: diaries_&_daily_life8: food_&_dining13: other_hobbies18: youth_&_student_life
4: family9: gaming14: relationships

Annotation instructions can be found here.

The label2id dictionary can be found here.

Citation Information

@inproceedings{dimosthenis-etal-2022-twitter,
    title = "{T}witter {T}opic {C}lassification",
    author = "Antypas, Dimosthenis  and
    Ushio, Asahi  and
    Camacho-Collados, Jose  and
    Neves, Leonardo  and
    Silva, Vitor  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"
}

Contributors

asahi417

58 commits

antypasd

3 commits