Text Mining for Sentiment Analysis of Social Media Regarding the Revision of the TNI Law Using Python by Utilizing the Lexicon Approach

Authors

  • Ridwan Ridwan Institut Teknologi dan Bisnis Dewantara, Bogor, Indonesia
  • Hapzi Ali Universitas Bhayangkara Jakarta Raya, Jakarta, Indonesia
  • Hendarman Lubis Universitas Bhayangkara Jakarta Raya, Jakarta, Indonesia

DOI:

https://doi.org/10.38035/sijet.v2i2.156

Keywords:

Sentiment Analysis, TNI Law Revision, Social Media, Twitter, Natural Language Processing, Machine Learning, Naive Bayes, Public Opinion, Indonesia, TextBlob

Abstract

This study aims to analyze public sentiment regarding the proposed revision of the Indonesian National Military (TNI) Law through social media, specifically Twitter. With the growing role of social media as a public sphere, it serves as a critical platform for expressing public opinions on national issues, including legal reforms. Using sentiment analysis, this research classifies Twitter posts into positive, neutral, or negative categories based on content related to the revision of the TNI Law. Data collection was carried out using the Twitter API (Tweepy), gathering 300 tweets using keywords related to the TNI Law revision. The analysis employed two methods: a lexicon-based approach using TextBlob and machine learning classification using Naive Bayes. The results reveal that the majority of the tweets express neutral sentiment (44.3%), followed by negative sentiment (28.3%) and positive sentiment (27.3%) based on TextBlob analysis. The Naive Bayes model demonstrated better sensitivity to negative sentiment, with 38.3% of tweets classified as negative. The findings suggest that public concern centers around the potential militarization of civil space, human rights violations, and threats to democracy. These concerns highlight the importance of transparent communication from the government regarding policy changes. Additionally, the research underscores the potential of natural language processing (NLP) and machine learning in monitoring public opinion in real time, which can serve as a valuable tool for policymakers in shaping responsive, data-driven legislation.

References

Bruns, A., & Burgess, J. E. (2015). The use of Twitter hashtags in the formation of publics. Journal of Communication, 65(4), 679–694. https://doi.org/10.1111/jcom.12158

Castells, M. (2012). Networks of outrage and hope: Social movements in the internet age. Polity Press.

Habermas, J. (1989). The structural transformation of the public sphere: An inquiry into a category of bourgeois society. MIT Press.

Huntington, S. P. (1957). The soldier and the state: The theory and politics of civil-military relations. Belknap Press.

Kaplan, A. M., & Haenlein, M. (2010). Users of the world, unite! The challenges and opportunities of social media. Business Horizons, 53(1), 59–68. https://doi.org/10.1016/j.bushor.2009.09.003

KontraS. (2023). Catatan kritis terhadap revisi UU TNI: Ancaman terhadap demokrasi. KontraS Official Report.

LIPI (2020). Reformasi sektor keamanan: TNI dan supremasi sipil. Lembaga Ilmu Pengetahuan Indonesia.

Lippmann, W. (1922). Public opinion. Harcourt, Brace and Company.

Liu, B. (2012). Sentiment analysis and opinion mining. Morgan & Claypool Publishers.

Republika. (2023). Revisi UU TNI dan penguatan peran nonmiliter. Republika.co.id. Retrieved from https://www.republika.co.id

TextBlob Documentation (2022). TextBlob: Simplified Text Processing. Retrieved from https://textblob.readthedocs.io/en/dev/

Twitter Developer Documentation (2022). Tweepy Documentation. Retrieved from https://docs.tweepy.org/en/stable/

Womack, T. (2013). Social media and the shaping of public opinion. Political Communication Review, 7(2), 114–131. https://doi.org/10.1080/1751278X.2013.824429

Zimbra, D., & Norrick, R. (2015). Public sentiment analysis and its use in policy-making. Journal of Policy Analysis, 9(3), 44–58. https://doi.org/10.1016/j.jpolan.2015.07.003.

Published

2025-04-19

How to Cite

Ridwan, R., Ali, H., & Lubis, H. (2025). Text Mining for Sentiment Analysis of Social Media Regarding the Revision of the TNI Law Using Python by Utilizing the Lexicon Approach. Siber International Journal of Education Technology (SIJET), 2(2), 43–52. https://doi.org/10.38035/sijet.v2i2.156

Most read articles by the same author(s)