Jurnal Ilmiah METADATA
Vol. 8 No. 1 (2026): Edition January 2026

SENTIMENT ANALYSIS OF THE NATIONAL MANDATE PARTY (PAN) IN YOUTUBE COMMENTS USING THE TF-IDF AND COSINE SIMILARITY APPROACHES

Tresna Yudha Prawira (Universitas Muhammadiyah Brebes)
Fitri Ayuning Tyas (Universitas Muhammadiyah Brebes)
Azhar Basir (Universitas Muhammadiyah Brebes)



Article Info

Publish Date
28 Jan 2026

Abstract

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.

Copyrights © 2026






Journal Info

Abbrev

metadata

Publisher

Subject

Religion Education Law, Crime, Criminology & Criminal Justice Social Sciences

Description

for aims to serve as a medium of information and exchange of scientific articles between teaching staff, alumni, students, practitioners and observers of science in education, Sains, Social, Technology and Humaniora. Focus ans Scope : Education, Management, Law, Sains, Social, Technology and ...