Skip to main content
QUICK REVIEW

[Paper Review] pysentimiento: A Python Toolkit for Opinion Mining and Social NLP tasks

Juan Manuel Pérez, Mariela Rajngewerc|arXiv (Cornell University)|Jun 17, 2021
Sentiment Analysis and Opinion MiningComputer Science34 citations
TL;DR

pysentimiento is a multilingual Python toolkit that provides state-of-the-art models for sentiment, emotion, hate speech, and irony analysis across Spanish, English, Italian, and Portuguese, with benchmark results and fairness assessment.

ABSTRACT

In recent years, the extraction of opinions and information from user-generated text has attracted a lot of interest, largely due to the unprecedented volume of content in Social Media. However, social researchers face some issues in adopting cutting-edge tools for these tasks, as they are usually behind commercial APIs, unavailable for other languages than English, or very complex to use for non-experts. To address these issues, we present pysentimiento, a comprehensive multilingual Python toolkit designed for opinion mining and other Social NLP tasks. This open-source library brings state-of-the-art models for Spanish, English, Italian, and Portuguese in an easy-to-use Python library, allowing researchers to leverage these techniques. We present a comprehensive assessment of performance for several pre-trained language models across a variety of tasks, languages, and datasets, including an evaluation of fairness in the results.

Motivation & Objective

  • Provide an open-source, multilingual toolkit for opinion mining and Social NLP tasks in Python for Spanish, English, Portuguese, and Italian.
  • Benchmark performance of state-of-the-art models across multiple tasks and languages.
  • Offer a fairness assessment for emotion analysis in English and guidelines for bias diagnostics.
  • Release best-performing models via HuggingFace hub integrated in the library.
  • Lay groundwork for extending languages and tasks within pysentimiento.

Proposed method

  • Fine-tune multiple pre-trained language models per language/task on representative datasets.
  • Preprocess noisy social media text with Twitter-specific normalization rules.
  • Evaluate models using Macro F1 across ten runs with different seeds.
  • Select the best-performing model for each language/task based on validation performance.
  • Assess fairness for English emotion analysis using the Equity Evaluation Corpus and statistical parity metrics.
  • Provide open-source implementation and repository links for code and models.

Experimental results

Research questions

  • RQ1Which pre-trained language models best support sentiment, emotion, hate speech, and irony detection across Spanish, English, Italian, and Portuguese?
  • RQ2How do specialized social-media models compare to general-domain models in multilingual opinion-mining tasks?
  • RQ3What is the fairness/bias profile of emotion analysis models in English using a demographic-balanced corpus?
  • RQ4How can pysentimiento facilitate reproducible benchmarking and fair evaluation for Social NLP tasks?

Key findings

  • Specialized social-media models (e.g., BERTweet, RoBERTuito, BERTabaporu) generally outperform general-domain models for most languages and tasks.
  • RoBERTuito and Spanish-tuned models often deliver robust performance across tasks; Italian best model is BERTit, while for Portuguese, BERTweet BR and BERTabaporu show strong results.
  • Table 3 shows Macro F1 scores across languages and tasks, with RoBERTuito and BERTweet variants often achieving top performance; Portuguese results include models BERT pt, BERTweet BR, RoBERTuito, and BERTabaporu.
  • A fairness analysis on English emotion detection using the ECC corpus indicates no evidence of adverse impact under statistical parity for the evaluated model-task combinations.
  • The authors make models and code publicly available on GitHub and HuggingFace hub for easy reuse by researchers.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.