Command Palette
Search for a command to run...
Emoji Prediction in Tweets using BERT
Emoji Prediction in Tweets using BERT
Muhammad Osama Nusrat Zeeshan Habib Mehreen Alam Saad Ahmed Jamal
Abstract
In recent years, the use of emojis in social media has increased dramatically, making them an important element in understanding online communication. However, predicting the meaning of emojis in a given text is a challenging task due to their ambiguous nature. In this study, we propose a transformerbased approach for emoji prediction using BERT, a widely-used pre-trained language model. We fine-tuned BERT on a large corpus of text (tweets) containing both text and emojis to predict the most appropriate emoji for a given text. Our experimental results demonstrate that our approach outperforms several stateof-the-art models in predicting emojis with an accuracy of over 75 percent. This work has potential applications in natural language processing, sentiment analysis, and social media marketing.
One-sentence Summary
Fast Nuces and Université Bretagne Sud propose a transformer-based approach for emoji prediction in tweets by fine-tuning BERT on a large corpus of text-emoji pairs, achieving over 75% accuracy and outperforming several state-of-the-art models, with potential applications in natural language processing, sentiment analysis, and social media marketing.
Key Contributions
- A BERT-based transformer approach is proposed for emoji prediction in social media text, where ambiguous emoji meanings are inferred from surrounding text.
- BERT is fine-tuned on a large corpus of tweets containing both text and emojis to select the most appropriate emoji for a given message.
- The fine-tuned model outperforms several state-of-the-art emoji prediction models, achieving accuracy over 75 percent and indicating potential for natural language processing, sentiment analysis, and social media marketing.
Introduction
Social media platforms generate large amounts of short, informal text, where emojis often convey emotion, tone, and intent more clearly than words alone. Predicting the most appropriate emoji for a given message can therefore improve communication and support related NLP tasks such as sentiment analysis and emotion detection. Prior work has shown that transformer models and emoji-based supervision can be effective, but emoji prediction remains challenged by limited large and diverse datasets and by language and culture differences in emoji use. The authors leverage a BERT model, fine-tuning it on a large tweet dataset to predict emojis and analyzing how training-data size and the number of emoji classes affect performance.
Dataset
-
The authors use two public tweet emoji datasets hosted on Kaggle.
-
Dataset 1 is a small CSV dataset containing tweets paired with emoji labels. It has 132 training rows, 56 testing rows, 5 emoji classes, and a 70:30 train test split.
-
Dataset 2 is a larger set stored in separate Train and Test CSV files. The training file contains 69,832 tweets, and the testing file contains 25,920 tweets.
-
In Dataset 2, emoji labels are represented in coded form, and the dataset covers 20 emoji classes. The authors keep the same 70:30 train test split as in Dataset 1.
-
Dataset 2 also includes two supplementary CSV files: a Mapping file that stores emoji symbols with their label mappings, and an Output file that stores unique ids.
-
The data schema is simple: tweet text, emoji or coded emoji label, and, for Dataset 2, additional mapping and id metadata.
-
The paper does not describe cropping, augmentation, or extra metadata construction beyond the stated CSV files and label mapping.
-
The smaller dataset is used first as an initial setup or warm up phase for the model.
-
After this initial stage, the model is further trained on the larger dataset to expose it to more data and improve performance and accuracy.
Method
The authors design an emoji prediction system as a staged natural language processing pipeline. The workflow is organized into dataset collection, preprocessing, tokenization, fine-tuning, evaluation, and inference. Refer to the framework diagram below:
The process begins with collection of representative text and emoji data. The raw text is first cleaned to reduce noise, inconsistency, and irrelevant information. This includes removing punctuation, converting text to lowercase, handling special characters, and addressing missing values. The authors then apply stemming with the Natural Language Toolkit to reduce words toward their root forms, which helps normalize lexical variation and improve the model’s ability to generalize across similar words.
Next, the text is converted into model-usable form through tokenization and embedding. Tokens are usually words, and each token is represented as a unique integer index before being transformed into numerical vector representations. These vectors allow the neural network to process textual input while capturing semantic and contextual relationships between words.
The central model component is BERT, a pretrained bidirectional transformer encoder. The authors leverage BERT’s pretrained language representations as a general linguistic foundation and then fine-tune the model on the target tweet dataset. During fine-tuning, model parameters are updated so the pretrained encoder becomes specialized for the downstream task of predicting emojis from text. The approach can incorporate tweet-specific signals such as hashtags and user mentions, which may provide additional context for emoji prediction.
After training, the model is evaluated on training, validation, and test splits to measure prediction quality and generalization. Once the final model is trained, it is used in the inference stage, where new unseen text inputs are processed by the same pipeline and the model returns predicted emojis.
Experiment
The experiments evaluated a BERT-based emoji prediction model on tweets using F1 score alongside precision, recall, and accuracy, with separate datasets to assess generalization. Results show that the fine-tuned model learned effectively, achieving stronger balanced performance on dataset 1 and capturing many positive cases on dataset 2 despite more false positives, while training curves confirm stable convergence. Overall, the findings indicate that a BERT model with a dense classifier is effective for emoji prediction, and preprocessing steps and tweet-specific features contribute to improved performance.