Profanity and Sentiment Detection in Filipino Social Media Comments Using Transformer-Based NLP Models
Marc P. Laureta | Wendell Alfred Y. Feria | Patrick Carl D. Limbag | Bienmarc D. Montecillo
Discipline: Artificial Intelligence
Abstract:
Filipino is considered a low-resource language, which makes it challenging to process due to the limited availability of annotated datasets and linguistic tools. These challenges are further complicated by code switching, regional variations, and the evolving nature of slang in online conversations. To address these issues, the study used a developmental research design and applied three transformer-based models: BERT, DistilBERT, and XLNet. A total of 13,565 Reddit comments were collected using web scraping techniques and the Reddit PRAW API. The dataset underwent preprocessing, including annotation, cleaning, and augmentation. The models were trained and evaluated on their ability to classify profanity into four categories: Non-Profane, Mild, Moderate, and High. Among the models, BERT achieved the highest accuracy of 99.53%, followed by XLNet and DistilBERT. A web application and a Reddit bot were created to demonstrate real-time detection, filtering, and severity-based masking of profane content. Sentiment analysis was also performed to assess the emotional tone and intent behind each comment. The results highlight the system’s effectiveness in improving online content moderation through accurate and context-aware detection of profanity and sentiment in Filipino social media posts, and further suggest that handling profanity detection and sentiment analysis as separate but complementary tasks shows better performance and interpretability.
References:
- Adams, N. (2022). 'Scraping' Reddit posts for academic research? Addressing some blurred lines of consent in growing internet-based research trend during the time of COVID-19. International Journal of Social Research Methodology. https://doi.org/10.1080/13645579.2022.2111816
- Arganosa, S., Marasigan, R., Villanueva, J., Wenceslao, K., & Ponay, C. (2022). Hate speech in Filipino election-related tweets: A sentiment analysis using convolutional neural networks. Proceedings of the 2022 3rd International Conference on Artificial Intelligence in Information and Communication (ICAIIC), 451–456.
- Cruz, J. C. B., & Cheng, C. (2019). Evaluating language model fine-tuning techniques for low-resource languages. arXiv. https://arxiv.org/abs/1907.00409
- Esquivel, O. J. (2022). A sociolinguistic analysis of Tagalog profanities through variables: Age, sex, and context. ResearchGate. https://www.researchgate.net/publication/383431040
- Galinato, V., Amores, L., Magsino, G. B., & Sumawang, D. R. (2023). Context-based profanity detection and censorship using Bidirectional Encoder Representations from Transformers (BERT). SSRN. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4341604
- Hajibabaee, P., Malekzadeh, M., Ahmadi, M., Heidari, M., Esmaeilzadeh, A., Abdolazimi, R., & Jones, J. H. (2022). Offensive language detection on social media based on text classification. In 2022 Computing and Communication Workshop and Conference (CCWC) (pp. 92–98). IEEE. https://doi.org/10.1109/CCWC54503.2022.9720804
- Hernandez Urbano Jr, R., Uy Ajero, J., Legaspi Angeles, A., Hacar Quintos, M. N., Regalado Imperial, J. M., & Llabanes Rodriguez, R. (2021, August). A BERT-based hate speech classifier from transcribed online short-form videos. In Proceedings of the 2021 5th International Conference on e-Society, e-Education and e-Technology (ICSET) (pp. 186–192). https://doi.org/10.1145/3485768.3485806
- Krämer, S., Saxena, S., & Pundir, A. S. (2024). Revolutionizing sentiment analysis: Accelerated data science approaches for Reddit submissions. In 2024 IEEE INDISCON (pp. 1–6). IEEE. https://doi.org/10.1109/indiscon62179.2024.10744244
- Kunilovskaya, M., & Plum, A. (2021). Text preprocessing and its implications in a digital humanities project. In Proceedings of RANLP 2021 Student Research Workshop (pp. 85–93). INCOMA Ltd. https://aclanthology.org/2021.ranlp-srw.13/
- Raza, M. O., Mahoto, N. A., Hamdi, M., Reshan, M. S. A., Rajab, A., & Shaikh, A. (2023). Detection of offensive terms in resource-poor language using machine learning algorithms. PeerJ Computer Science, 9, e1524. https://doi.org/10.7717/peerj-cs.1524
- Roache, R. (2023). What is swearing? In For fck’s sake: Why swearing is shocking, rude, and fun (online ed.). Oxford University Press. https://doi.org/10.1093/oso/9780190665067.003.0002
- Vidgen, B., & Yasseri, T. (2020). Detecting weak and strong Islamophobic hate speech on social media. Journal of Information Technology & Politics, 17(1), 66-78. https://doi.org/10.1080/19331681.2019.1702607
- Yang, Z., Dai, Z., Yang, Y., Carbonell, J., Salakhutdinov, R., & Le, Q. V. (2019). XLNet: Generalized autoregressive pretraining for language understanding. arXiv. https://arxiv.org/abs/1906.08237
- Yi, M., Lim, M., Ko, H., & Shin, J. (2021). Method of profanity detection using word embedding and LSTM. Mobile Information Systems, 2021, 6654029. https://doi.org/10.1155/2021/6654029
- Zampieri, M., Malmasi, S., Nakov, P., Rosenthal, S., Farra, N., & Kumar, R. (2019). Predicting the type and target of offensive posts in social media. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL HLT) (pp. 1415–1420). Association for Computational Linguistics. https://aclanthology.org/N19-1144/
ISSN 3082-3706 (Online)
ISSN 3082-3692 (Print)