How mansoorxcoder/sentiment works
Purpose and Runtime
SentiMeter is a client-side sentiment-analysis workbench. It accepts review text and simulated Amazon/Flipkart product URLs, presents positive/neutral/negative results, and compares four algorithm simulations. The deployable entry point is the Vite/React application at src/main.tsx, rooted in src/App.tsx; Node.js/Vite builds and serves it.
Application Shell and Navigation
The top-level app provides routed pages and shared layout/theme behavior. The principal user routes are the landing page, analysis experience, algorithm comparison, informational page, and fallback page:
• src/App.tsx
• src/components/Layout.tsx
• src/pages/Home.tsx
• src/pages/Analyze.tsx
• src/pages/Index.tsx
Sentiment Analysis Flow
The analysis page is the main interaction boundary: users submit raw review text or a supported product link, select an algorithm, and receive a classified sentiment and confidence. Browser-side logic performs the classification; there is no indicated dependency from this UI to a live ML service.
• src/pages/Analyze.tsx
• src/utils/sentimentAnalyzer.ts
• src/components/AlgorithmSelector.tsx
• src/components/SentimentResult.tsx
Algorithm Simulation Layer
Classification behavior and comparison metadata are centralized in frontend utility modules. The stated model options are Neural Network, SVM, Naïve Bayes, and Logistic Regression; results are rendered as an explanatory comparison rather than executing the archived Python model artifacts.
• src/utils/algorithms.ts
• src/utils/sentimentAnalyzer.ts
• src/components/AlgorithmComparison.tsx
Visualization and Presentation
Result and comparison views use reusable React components and charting/UI primitives. Styling is Tailwind-based with a component library under src/components/ui; global visual rules are in application CSS.
• src/components/AlgorithmComparison.tsx
• src/components/SentimentResult.tsx
• src/components/ui/chart.tsx
• src/index.css
Historical Python/ML Pipeline
SA/test preserves a separate, staged Python implementation: dataset combination/preprocessing, static model training/inference artifacts, dynamic prediction/web interface, dashboard visualization, and a containerized backend/frontend variant. It is architecturally distinct from the root React app, but supplies the repository’s real serialized classifiers and TF-IDF vectorizers.
• SA/test/01_Data_Preprocessing/data_preprocessing.py
• SA/test/02_Static_Implementation/static_implementation.py
• SA/test/03_Dynamic_Implementation/dynamic_prediction.py
• SA/test/BE_API/app/main.py
Data, Models, and Deployment Boundary
CSV review datasets feed the legacy preprocessing/training path; generated .pkl classifier/vectorizer assets are copied into both static and API-oriented locations. Docker Compose connects the legacy API and static frontend containers. The current React UI has no visible configured API contract to that service.
• SA/test/dataset/lappi.csv
• SA/test/models/tfidf_vectorizer.pkl
• SA/test/docker-compose.yml
• SA/test/BE_API/Dockerfile
Main entry points: App.tsx App routes · sentimentAnalyzer.ts Browser classifier · main.py Legacy prediction API · Analyze.tsx Analysis experience
Components 21
Current React Workbench
Browser-only Vite/React sentiment simulation.
- Vite / Node runtime · Builds and serves the client application.
src/main.tsx - App routes · Defines routed pages and shared application behavior.
src/App.tsx - Shared layout · Provides shared layout and theme behavior.
src/components/Layout.tsx - Landing page
src/pages/Home.tsx - Analysis experience · Accepts review text or supported product URLs and selected algorithms.
src/pages/Analyze.tsx - Comparison page · Presents algorithm comparison content.
src/pages/Index.tsx - Algorithm selector · Selects Neural Network, SVM, Naïve Bayes, or Logistic Regression.
src/components/AlgorithmSelector.tsx - Browser classifier · Classifies input locally with confidence; no live ML service dependency.
src/utils/sentimentAnalyzer.ts - Algorithm simulations · Centralizes simulation behavior and comparison metadata.
src/utils/algorithms.ts - Sentiment result · Renders positive, neutral, or negative classification and confidence.
src/components/SentimentResult.tsx - Algorithm comparison view · Explains and visualizes simulated algorithm differences.
src/components/AlgorithmComparison.tsx - Chart primitives
src/components/ui/chart.tsx - Global Tailwind styling
src/index.css
Historical Python/ML Pipeline
Separate preserved training, inference, and container path.
- Review CSV data · Source reviews for the legacy pipeline.
SA/test/dataset/lappi.csv - Dataset preprocessing · Combines and preprocesses review data.
SA/test/01_Data_Preprocessing/data_preprocessing.py - Static training / inference · Produces and uses legacy classifier artifacts.
SA/test/02_Static_Implementation/static_implementation.py - TF-IDF model assets · Legacy vectorizer and classifier assets copied to inference locations.
SA/test/models/tfidf_vectorizer.pkl - Dynamic prediction · Legacy dynamic prediction and web interface.
SA/test/03_Dynamic_Implementation/dynamic_prediction.py - Legacy prediction API · Containerized API-oriented inference service.
SA/test/BE_API/app/main.py - Legacy container deployment · Connects legacy API and static frontend containers.
SA/test/docker-compose.yml - API container image
SA/test/BE_API/Dockerfile
Connections 22
- Vite / Node runtime → App routes: mounts
- App routes → Shared layout: uses
- App routes → Landing page: routes to
- App routes → Analysis experience: routes to
- App routes → Comparison page: routes to
- Analysis experience → Algorithm selector: selects algorithm
- Analysis experience → Browser classifier: submits input
- Algorithm selector → Browser classifier: configures
- Browser classifier → Algorithm simulations: uses simulations
- Browser classifier → Sentiment result: returns result
- Comparison page → Algorithm comparison view: renders
- Algorithm simulations → Algorithm comparison view: supplies metadata
- Algorithm comparison view → Chart primitives: uses
- Global Tailwind styling → App routes: styles
- Review CSV data → Dataset preprocessing: feeds
- Dataset preprocessing → Static training / inference: prepares data
- Static training / inference → TF-IDF model assets: generates
- TF-IDF model assets → Dynamic prediction: loads
- TF-IDF model assets → Legacy prediction API: loads
- API container image → Legacy prediction API: packages
- Legacy container deployment → Legacy prediction API: orchestrates
- Browser classifier → Legacy prediction API: no configured API contract