A modern sentiment analysis system that combines Morphological Sentence Pattern (MSP) model with Convolutional Neural Networks (CNN) for improved accuracy and efficiency.
- Real-time sentiment analysis
- MSP-based text preprocessing
- CNN-based sentiment classification
- Part-of-Speech (POS) tagging
- Batch text processing
- Modern web interface
- API documentation with Swagger UI
- Python 3.11+
- FastAPI
- TensorFlow
- NLTK
- Pydantic v2
- Uvicorn
- Next.js 14
- React 19
- TypeScript
- Tailwind CSS
- Shadcn UI
- Radix UI
sentiment-analysis/
├── backend/
│ ├── api/
│ │ ├── routes/
│ │ │ └── sentiment.py
│ │ └── main.py
│ ├── models/
│ │ └── neural_networks/
│ │ ├── cnn_model.py
│ │ └── msp_model.py
│ ├── services/
│ │ └── sentiment_service.py
│ ├── tests/
│ │ └── conftest.py
│ └── requirements.txt
├── frontend/
│ ├── app/
│ │ ├── page.tsx
│ │ └── layout.tsx
│ ├── components/
│ │ ├── ui/
│ │ └── features/
│ ├── lib/
│ │ └── api/
│ │ └── client.ts
│ └── package.json
└── docs/
└── api/
└── README.md
-
Create and activate virtual environment:
cd backend python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the server:
uvicorn main:app --reload
The API will be available at http://localhost:8000
with Swagger documentation at http://localhost:8000/docs
.
-
Install dependencies:
cd frontend pnpm install
-
Start the development server:
pnpm dev
The frontend will be available at http://localhost:3000
.
This project is configured for deployment on Vercel with the following setup:
-
Frontend Deployment:
- The frontend will be automatically deployed as a Next.js application
- API routes are proxied to the backend
-
Backend Deployment:
- The backend is deployed as serverless functions
- Python 3.11 runtime is used
-
Environment Variables:
- Set
NEXT_PUBLIC_API_URL
to your backend URL in Vercel dashboard - Update the backend URL in
frontend/next.config.mjs
after deployment
- Set
-
Deployment Steps:
# Install Vercel CLI npm i -g vercel # Deploy to Vercel vercel # Follow the prompts and set up your project
-
Post-Deployment:
- Update the backend URL in
frontend/next.config.mjs
with your actual backend domain - Set environment variables in Vercel dashboard
- Redeploy if necessary
- Update the backend URL in
POST /api/analyze
- Analyze single textPOST /api/batch
- Analyze multiple textsGET /health
- Health check endpoint
- Use Python 3.11 or higher
- Follow PEP 8 style guide
- Write unit tests for new features
- Update API documentation
- Use TypeScript for type safety
- Follow component-based architecture
- Implement responsive design
- Add error handling
cd backend
pytest
cd frontend
pnpm test
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - see LICENSE file for details
- K. Borad