How tuhintech1278/ai-sentiment-classifier works
The product is a local Flask sentiment-classification web app. A user submits text through the page; the Flask handler preprocesses it, applies the fitted TF-IDF representation and logistic-regression model, then renders the predicted class. The repository also includes a separate script for training, evaluating, and trying the classifier on sample sentences. The web and script implementations are shown separately because their wiring is distinct. The README documents the three sentiment classes and web workflow; sampled source confirms the implementation details.
Main entry points: app.py Flask application · index.html Input and result page · sentiment_classifier.py Training and evaluation · sentiment_dataset.csv Sentiment dataset
Components 9
Web interface
- Flask application
app.py - Input and result page
templates/index.html
Classification pipeline
- Sentiment dataset
sentiment_dataset.csv - Load and train model
app.py - Text preprocessing
app.py - TF-IDF vectorizer
app.py - Logistic regression
app.py
Model analysis
- Training and evaluation
sentiment_classifier.py
Other components
- User
Connections 13
- User → Input and result page: enters text
- Input and result page → Flask application: submits form
- Flask application → Input and result page: renders result
- Flask application → Text preprocessing: cleans input
- Flask application → TF-IDF vectorizer: transforms input
- Flask application → Logistic regression: predicts class
- Flask application → Load and train model: initializes
- Load and train model → Sentiment dataset: reads rows
- Load and train model → Text preprocessing: cleans training text
- Load and train model → TF-IDF vectorizer: fits features
- Load and train model → Logistic regression: fits model
- Training and evaluation → Sentiment dataset: reads rows
- Training and evaluation → Text preprocessing: uses same steps