How rakshithkanaje/instagram-sentiment-analyzer works
Project type and purpose
• This is a data-processing pipeline (an ETL-style backend application) for real-time Instagram sentiment analysis. It ingests data (posts by hashtag), transforms it (sentiment scoring), stores it, then trains and evaluates a machine-learning model.
File structure
• Top level:
• main.py – the orchestration script
• requirements.txt – dependency list
• models/ – directory containing the saved TensorFlow model
• README.md, LICENSE, .gitignore
• No frontend/UI; purely backend.
• Key external services/configs implied: MongoDB instance, Playwright browser.
Extract architectural insights from the README
• Ingestion: “Scrapes Instagram posts by hashtag using Playwright”
• Processing: “Analyzes image captions for sentiment using TextBlob”
• Storage: “Stores data in MongoDB”
• Training: “Trains an LSTM model on captions using TensorFlow/Keras”
• Visualization: “Plots training accuracy with Matplotlib”
• Model persistence: “Saves model and metrics to models/ and disk.”
Main components & their interactions
a. External Source – Instagram (via HTTP)
b. Ingestion Module – Playwright-based scraper
c. NLP Module – Text preprocessor + TextBlob sentiment analyzer
d. Data Store – MongoDB database (collection for raw posts, collection for scored posts, collection for training data)
e. Training Module – TensorFlow/Keras LSTM trainer
f. Visualization Module – Matplotlib plot generator
g. Model Store – files under models/ (HDF5) and metrics output
h. Orchestrator – main.py ties all steps together
Architectural patterns & design principles
• ETL pipeline: clear separation of Extract → Transform → Load
• Modular scripting: each step encapsulated in functions or classes, invoked by main.py
• Single process but could be refactored to microservices (one service per stage)
• Persist intermediate and final artifacts for reproducibility
Technology labels
• Scraper: Python + Playwright
• NLP: Python + TextBlob
• DB: MongoDB via PyMongo
• Trainer: Python + TensorFlow/Keras + scikit-learn (for data prep) + NumPy
• Plotter: Python + Matplotlib