Skip to content
rfqmaPublic

About

Penerapan Metode Klasifikasi K-Nearest Neighbor dan Lexicon Based untuk Analisis Sentimen Publik Terhadap Pemindahan Ibu Kota Negara dengan Ekstraksi Fitur TF-IDF

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Penerapan Metode Klasifikasi K-Nearest Neighbor dan Lexicon Based untuk Analisis Sentimen Publik Terhadap Pemindahan Ibu Kota Negara dengan Ekstraksi Fitur TF-IDF

Analyze opinions expressed on X (formerly Twitter) regarding the relocation of Indonesia's capital city using combination of classifiers algorithm K-Nearest Neighbor (KNN), Feature Extraction TF-IDF, SMOTE for balancer, and also Lexicon-based approach for labeling data as positive, negative, or neutral sentiment.

Input

  • dataset
    • Data regarding the relocation of Indonesia's capital city from X (formerly Twitter).
    • Data crawling was done at 26 October 2024 with keywords: ibu kota baru, ibu kota nusantara, ibu kota pindah, ikn, pemindahan ibu kota, ibukota baru, ibukota nusantara, ibukota pindah, pemindahan ibukota.
    • Some X Search Queries like: lang:id, since:2024-01-01, until:2024-10-01.
    • Also the crawler use LATEST or TOP tab from X.
  • slang, stopwords, negation, etc
  • Custom Lexicon
  • Ekstraksi Fitur
    • TF-IDF
  • Balancer
    • SMOTE
  • Classifier Algorithm
    • K-Nearest Neighbor (KNN)
  • Evaluation
    • Confusion Matrix
    • Classification Report

Dependencies

Look at requirements.txt for more details.

Flowchart

/flowcharts

Getting Started

Prerequisites On Machine

  • git
  • python
  • pip
  • virtualenv

Cookies

  • Export x cookies from browser with some cookies extractor extension on browser.
  • Save it to scraper/raw_cookies.json.
  • Generate twikit cookies with scraper/cookies.py.
  • Save it to scraper/twikit_cookies.json.
  • Run scraper/scraper.py.

virtualenv

  • Initialize virtualenv
virtualenv <virtualenv_name>
  • Activate virtualenv

    • Windows
      <virtualenv_name>/Scripts/activate
    • Linux/macOS
      source <virtualenv_name>/Scripts/activate
  • Install dependencies on virtualenv

pip install -r requirements.txt
  • Check installed dependencies on virtualenv
pip freeze
  • Install a new kernel for Jupyter Notebook named <virtualenv_name> on virtualenv
python -m ipykernel install --user --name <virtualenv_name>
  • Update pip
pip install wheel setuptools pip --upgrade
  • Start Jupyter Notebook server on virtualenv
jupyter notebook
  • Deactivate virtualenv
deactivate

Streamlit

streamlit run streamlit.py

About

Penerapan Metode Klasifikasi K-Nearest Neighbor dan Lexicon Based untuk Analisis Sentimen Publik Terhadap Pemindahan Ibu Kota Negara dengan Ekstraksi Fitur TF-IDF

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages