A Machine Learning Approach to Irony Detection in Text Using TF-IDF and Random Forests

This paper presents the development of a machine learning model to detect irony in Pidgin English text which is achallenging task due to the unique linguistic features of the language. Social media has transformed global communicationvia text, but detecting irony, where the intended meaning differs from the literal one, remains difficult, especially in nonstandard languages like Pidgin English. Current irony detection models, designed primarily for standard English, struggle inthis context. To address this, we collected a dataset of 58,745 online comments, encompassing ironic statements or comments,hate and neutral comments, from crowdsourced surveys and Kaggle datasets. The final dataset of 6,000 instances, evenlydistributed among the three speech categories, was used for training, validation, and testing. After cleaning and balancing thedata through random undersampling, the Term Frequency-Inverse Document Frequency (TF-IDF) was applied to convert thetext into numerical vectors, while the Random Forest Classifier was used for the text classification. Results revealed that theproposed model achieved an impressive accuracy of 93%, with a precision of 90% and a recall of 91%, proving itseffectiveness in detecting ironic speech. The results demonstrate that machine learning can accurately identify irony even innon-standard languages like Nigerian Pidgin English, which could reduce misinterpretations in social media interactions andpotentially lower the incidence of conflicts caused by irony. This research contributes to the field of natural languageprocessing by emphasizing the importance of language-specific tools for irony detection.

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2025-04-30
DOI
https://doi.org/10.5281/zenodo.15575229
Primary Topic
Sentiment Analysis and Opinion Mining
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

A Machine Learning Approach to Irony Detection in Text Using TF-IDF and Random Forests

Zenodo (CERN European Organization for Nuclear Research)
Sentiment Analysis and Opinion Mining
article

A Machine Learning Approach to Irony Detection in Text Using TF-IDF and Random Forests

article en

Abstract

This paper presents the development of a machine learning model to detect irony in Pidgin English text which is achallenging task due to the unique linguistic features of the language. Social media has transformed global communicationvia text, but detecting irony, where the intended meaning differs from the literal one, remains difficult, especially in nonstandard languages like Pidgin English. Current irony detection models, designed primarily for standard English, struggle inthis context. To address this, we collected a dataset of 58,745 online comments, encompassing ironic statements or comments,hate and neutral comments, from crowdsourced surveys and Kaggle datasets. The final dataset of 6,000 instances, evenlydistributed among the three speech categories, was used for training, validation, and testing. After cleaning and balancing thedata through random undersampling, the Term Frequency-Inverse Document Frequency (TF-IDF) was applied to convert thetext into numerical vectors, while the Random Forest Classifier was used for the text classification. Results revealed that theproposed model achieved an impressive accuracy of 93%, with a precision of 90% and a recall of 91%, proving itseffectiveness in detecting ironic speech. The results demonstrate that machine learning can accurately identify irony even innon-standard languages like Nigerian Pidgin English, which could reduce misinterpretations in social media interactions andpotentially lower the incidence of conflicts caused by irony. This research contributes to the field of natural languageprocessing by emphasizing the importance of language-specific tools for irony detection.

Zenodo (CERN European Organization for Nuclear Research)
Quality Education
Openalex Percentile: Top 75%
Sentiment Analysis and Opinion Mining
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.