SENTIMENT ANALYSIS OF THE NATIONAL MANDATE PARTY (PAN) IN YOUTUBE COMMENTS USING THE TF-IDF AND COSINE SIMILARITY APPROACHES - Tresna Yudha Prawira; Fitri Ayuning Tyas; Azhar Basir (Jurnal Ilmiah METADATA, 2026)
This study analyzed public sentiment towards the National Mandate Party (PAN) on YouTube comments using the Term Frequency Inverse Document Frequency (TF-IDF) approach and cosine similarity. The aim of the study was to map the tendency of public opinion into three categories: positive, negative, and neutral, and to evaluate the performance of this method compared to a simple lexicon-based approach. Comment data is obtained through the YouTube Data API, then processed through the stages of text cleanup, normalization, stopword removal, and stemming using Sastrawi. Word representation is formed with TF-IDF, while sentiment classification is done by calculating vector similarity using cosine similarity. The results of the analysis showed that neutral sentiment dominated at 63.2%, followed by negative sentiment at 20.7%, and positive sentiment at 16.1%.  The TF-IDF model  is able to classify neutral and negative comments quite well, although some positive comments are difficult to distinguish from neutral comments. These findings suggest that discussions about PAN on YouTube tend to be informative rather than emotional, with a higher tendency to criticize than support. In conclusion, the TF-IDF and cosine similarity methods are effective in providing an overview of public opinion with low computational complexity, while being a lightweight alternative to deep learning-based methods.