Mental health is a global issue that has garnered significant public attention on social media. The platform X (formerly Twitter) is widely used by the public to openly express emotional conditions, yielding vast amounts of unstructured textual data. This research aims to analyze public sentiment regarding mental health issues on social media X using the Multinomial Naïve Bayes algorithm combined with Term Frequency-Inverse Document Frequency (TF-IDF) word weighting. The dataset consists of 9,000 tweets written in Indonesian, collected between February 15 and 27, 2025, using the keywords kesehatan_mental (mental health), stress (stress), kecemasan (anxiety), and depresi (depression). To enhance data quality, a comprehensive text preprocessing pipeline was implemented, including cleaning, case folding, word normalization (using a 59-entry mapping dictionary), tokenizing, stopword removal, and stemming. The performance of the classification model was evaluated using a confusion matrix on 1,800 test data. The results demonstrate that the Multinomial Naïve Bayes model achieved a high accuracy of 90.78% and a macro average F1-score of 90.75%. Specifically, the positive sentiment class yielded a precision of 96.22% and a recall of 84.89%, while the negative sentiment class achieved a precision of 86.48% and a recall of 96.67%. Furthermore, this study integrates the classification model into a web-based system equipped with an explainability feature that visualizes word contributions to the sentiment outcomes. This research contributes an interpretative, informative, and efficient computational approach for monitoring public sentiment trends toward mental health issues on Indonesian social media.
Copyrights © 2026