A lightweight, notebook-driven pipeline to scrape Google Play Store reviews for Google Classroom, preprocess English text, and run sentiment inference using two models: Logistic Regression (with TF‑IDF features) and a Dense Neural Network (DNN). The repo includes ready-to-run notebooks for scraping and inference, plus pretrained artifacts in the project root.
- Scrape Google Play reviews and export to CSV (
ulasan_classroom.csv). - Robust text preprocessing: cleaning, lowercasing, slang normalization, tokenization, stopword removal, lemmatization.
- Dual-model predictions: Logistic Regression (TF‑IDF) and Dense Neural Network.
- Interactive, CLI-style input inside the inference notebook.
- Clear, reproducible environment via
requirements.txt.
- Python
- Data & NLP: NumPy, pandas, NLTK, scikit‑learn, joblib
- Deep Learning: TensorFlow/Keras
- Scraping: google‑play‑scraper
- Visualization (optional): matplotlib, seaborn, wordcloud
- Notebooks: Jupyter / VS Code Notebook
- Notebooks:
- Inference:
Inference_Nelson_Ahli.ipynb - Scraping:
Scraping_Nelson_Ahli.ipynb
- Inference:
- Models & vectorizer (pretrained):
TFIDF_model_sentiment.pklLR_model_sentiment.pklDNN_model_sentiment.h5
- Data sample:
ulasan_classroom.csv
- Project manifest:
requirements.txt
- Create and activate a virtual environment (recommended)
macOS/Linux:
python3 -m venv .venv
source .venv/bin/activateWindows (PowerShell):
python -m venv .venv
.\.venv\Scripts\Activate.ps1- Install dependencies
pip install -r requirements.txtThe pinned dependencies include (from requirements.txt):
google_play_scraper,joblib,keras,matplotlib,nltk,numpy,pandas,protobuf,requests,scikit_learn,seaborn,tensorflow,wordcloud
- Download NLTK resources (first run)
The inference notebook will attempt to download NLTK corpora at runtime. To pre-download:
python -c "import nltk; nltk.download('stopwords'); nltk.download('wordnet'); nltk.download('punkt')"- Ensure model artifacts are available
This repository already includes the pretrained artifacts in the project root:
TFIDF_model_sentiment.pklLR_model_sentiment.pklDNN_model_sentiment.h5
If you move them, adjust paths in the inference notebook accordingly.
- Adjust Colab-style paths (if needed)
Inside Inference_Nelson_Ahli.ipynb, the model/vectorizer are loaded from /content/... (a Google Colab path). For local runs, change these to relative paths, for example:
tfidf = joblib.load("TFIDF_model_sentiment.pkl")
model_lr = joblib.load("LR_model_sentiment.pkl")
model_dnn = tf.keras.models.load_model("DNN_model_sentiment.h5")Option A - VS Code Notebook
- Open
Inference_Nelson_Ahli.ipynbin VS Code. - Select the Python interpreter for your virtual environment.
- Run all cells (or step through them).
- At the input prompt, type a review (e.g., "this app is amazing") and view predictions from both models.
Option B - Jupyter (CLI)
python -m jupyter notebook
# or
python -m jupyter lab- Open
Inference_Nelson_Ahli.ipynband run all cells.
Option C - Scrape dataset
- Open and run
Scraping_Nelson_Ahli.ipynb. - It uses
google_play_scraperto fetch reviews for Google Classroom (com.google.android.apps.classroom) and saves toulasan_classroom.csv.
- Scraping
- Use
Scraping_Nelson_Ahli.ipynbto fetch and save reviews intoulasan_classroom.csv.
- Preprocessing & Inference
- The inference notebook:
- Cleans and normalizes text
- Replaces English slang using a CSV dictionary fetched from GitHub
- Tokenizes, removes stopwords, and lemmatizes
- Transforms with TF‑IDF
- Predicts sentiment using Logistic Regression and DNN
- Outputs
- Console output shows the predicted sentiment for each model.
- NLTK lookups: If you see lookup errors for
stopwords,wordnet, orpunkt, run the download commands in the Installation section. - TensorFlow GPU: Not required; the DNN will run on CPU by default.
- Internet access: The slang dictionary is fetched over HTTP during preprocessing. If offline, cache it locally or replace with a local CSV.
- Path issues: If you keep artifacts in subfolders, ensure the notebook load paths point to the correct locations.
Maintained for the BFDL module - notebooks and models by Nelson Ahli.