Data and code accompanying the paper Negativity spreads faster: A large-scale multilingual twitter analysis on the role of sentiment in political communication.
In specific:
Our model, xlm-twitter-politics-sentiment, along with a small tutorial on how to use it can be found in huggingface.co.
The model is based on the implementation of 'cardiffnlp/twitter-xlm-roberta-base-sentiment' while being further finetuned on the annotated dataset.
from transformers import AutoModelForSequenceClassification, pipeline
model = AutoModelForSequenceClassification.from_pretrained('cardiffnlp/xlm-twitter-politics-sentiment')
sentiment_analysis_task = pipeline("sentiment-analysis", model=model, tokenizer="cardiffnlp/twitter-xlm-roberta-base-sentiment")
sentiment_analysis_task('Today is a good day')
Out: [{'label': 'Positive', 'score': 0.978614866733551}]
For more details, please check the reference paper. If you use the data contained in this repository for your research, please cite the paper using the following bib entry:
@article{antypas2023negativity,
title={Negativity spreads faster: A large-scale multilingual twitter analysis on the role of sentiment in political communication},
author={Antypas, Dimosthenis and Preece, Alun and Camacho-Collados, Jose},
journal={Online Social Networks and Media},
volume={33},
pages={100242},
year={2023},
publisher={Elsevier}
}
Jupyter Notebook
96.8%
Python
3.2%
Data and code accompanying the paper Negativity spreads faster: A large-scale multilingual twitter analysis on the role of sentiment in political communication.
In specific:
Our model, xlm-twitter-politics-sentiment, along with a small tutorial on how to use it can be found in huggingface.co.
The model is based on the implementation of 'cardiffnlp/twitter-xlm-roberta-base-sentiment' while being further finetuned on the annotated dataset.
from transformers import AutoModelForSequenceClassification, pipeline
model = AutoModelForSequenceClassification.from_pretrained('cardiffnlp/xlm-twitter-politics-sentiment')
sentiment_analysis_task = pipeline("sentiment-analysis", model=model, tokenizer="cardiffnlp/twitter-xlm-roberta-base-sentiment")
sentiment_analysis_task('Today is a good day')
Out: [{'label': 'Positive', 'score': 0.978614866733551}]
For more details, please check the reference paper. If you use the data contained in this repository for your research, please cite the paper using the following bib entry:
@article{antypas2023negativity,
title={Negativity spreads faster: A large-scale multilingual twitter analysis on the role of sentiment in political communication},
author={Antypas, Dimosthenis and Preece, Alun and Camacho-Collados, Jose},
journal={Online Social Networks and Media},
volume={33},
pages={100242},
year={2023},
publisher={Elsevier}
}
Jupyter Notebook
96.8%
Python
3.2%