Sentiment Analysis and Characteristics of Youtube User Opinions Toward Samsung and Iphone Brands Using TF-IDF With Naive Bayes and KNN Comparison and Mcnemar Test - Naurah Atikah Nurpadhilah; Surya Ade Saputera (LPPJPHKI Universitas Dehasen Bengkulu, 2026)
The development of social media, particularly YouTube, has generated a large amount of public opinion data that can be utilized to understand user perceptions of products. Samsung and iPhone are two smartphone brands with intense market competition and are frequently discussed in YouTube comment sections. This study aims to compare the performance of the Naive Bayes and K-Nearest Neighbor (KNN) algorithms in sentiment analysis of YouTube comments related to these two brands. The research data were collected through a YouTube comment scraping process using the youtube-comment-downloader library. The research stages included data collection, text pre-processing consisting of case folding, punctuation removal, number removal, stopword removal, and stemming using the Sastrawi library. Furthermore, the text data were transformed into numerical representations using the Term Frequency-Inverse Document Frequency (TF-IDF) method. The classification process was carried out using the Naive Bayes and KNN algorithms and evaluated using accuracy, classification reports, confusion matrices, and the McNemar test to determine the significance of performance differences between the models. In addition, this study also analyzed word distribution based on sentiment and brand using WordCloud visualization. The results indicate that both algorithms are capable of classifying comment sentiments effectively and provide insights into user opinion characteristics toward Samsung and iPhone based on YouTube comments.