{"id":25213876,"url":"https://github.com/thinkphp/sentiment-analyser","last_synced_at":"2026-04-09T09:33:40.716Z","repository":{"id":276293875,"uuid":"928802302","full_name":"thinkphp/sentiment-analyser","owner":"thinkphp","description":"A full-stack web application that analyzes the sentiment of user-provided text, delivering insightful sentiment metrics and visualizations. The app utilizes Flask for building the backend API and Next.js for a responsive and dynamic frontend interface. It processes input text, classifies sentiments into positive, negative, or neutral categories, an","archived":false,"fork":false,"pushed_at":"2025-02-07T10:51:57.000Z","size":17540,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T11:33:46.294Z","etag":null,"topics":["backend","flask","frontend","nextjs","react","rest-api","sentiment-analysis","sentiment-classification","sentiment-polarity","tailwind"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinkphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-07T09:11:50.000Z","updated_at":"2025-02-07T10:52:01.000Z","dependencies_parsed_at":"2025-02-07T11:43:52.259Z","dependency_job_id":null,"html_url":"https://github.com/thinkphp/sentiment-analyser","commit_stats":null,"previous_names":["thinkphp/sentiment-analyser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fsentiment-analyser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fsentiment-analyser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fsentiment-analyser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fsentiment-analyser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkphp","download_url":"https://codeload.github.com/thinkphp/sentiment-analyser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247307692,"owners_count":20917528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","flask","frontend","nextjs","react","rest-api","sentiment-analysis","sentiment-classification","sentiment-polarity","tailwind"],"created_at":"2025-02-10T16:57:52.073Z","updated_at":"2025-12-30T23:07:48.726Z","avatar_url":"https://github.com/thinkphp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sentiment Analyzer\nA full-stack web application that analyzes the sentiment of user-provided text, delivering insightful sentiment metrics and visualizations. The app utilizes Flask for building the backend API and Next.js for a responsive and dynamic frontend interface. It processes input text, classifies sentiments into positive, negative, or neutral categories, and generates visual representations of the sentiment data to help users easily interpret the results. This project combines modern technologies to create an intuitive and powerful tool for text sentiment analysis.\n\n![https://github.com/thinkphp/sentiment-analyser/blob/main/Screenshot%20from%202025-02-07%2012-41-30.png?raw=true](https://github.com/thinkphp/sentiment-analyser/blob/main/Screenshot%20from%202025-02-07%2012-41-30.png?raw=true)\n\n![https://github.com/thinkphp/sentiment-analyser/blob/main/Screenshot%20from%202025-02-07%2012-42-03.png?raw=true](https://github.com/thinkphp/sentiment-analyser/blob/main/Screenshot%20from%202025-02-07%2012-42-03.png?raw=true)\n## Features\n\n- Real-time sentiment analysis of text input\n- Sentence-by-sentence breakdown of sentiment\n- Visual representation of sentiment metrics using charts\n- Polarity and subjectivity scoring\n- Color-coded sentiment categories\n- Responsive design\n\n## Tech Stack\n\n### Backend\n- Flask (Python web framework)\n- NLTK (Natural Language Processing)\n- TextBlob (Sentiment Analysis)\n- Flask-CORS (Cross-Origin Resource Sharing)\n\n### Frontend\n- Next.js 14 (React framework)\n- Tailwind CSS (Styling)\n- Recharts (Data visualization)\n- shadcn/ui (UI components)\n\n## Prerequisites\n\n- Python 3.8 or higher\n- Node.js 18 or higher\n- npm or yarn package manager\n\n## Installation\n\n### Backend Setup\n\n1. Create and activate a virtual environment:\n```bash\n# Create virtual environment\npython -m venv venv\n\n# Activate virtual environment\n# On Windows\nvenv\\Scripts\\activate\n# On macOS/Linux\nsource venv/bin/activate\n```\n\n2. Install backend dependencies:\n```bash\npip install flask flask-cors textblob nltk\n```\n\n3. Navigate to the backend directory and run the Flask server:\n```bash\npython app.py\n```\n\nThe backend API will be available at `http://localhost:5000`.\n\n### Frontend Setup\n\n1. Navigate to the frontend directory and install dependencies:\n```bash\nnpm install\n# or\nyarn install\n```\n\n2. Install required shadcn/ui components:\n```bash\nnpx shadcn-ui@latest add card\nnpx shadcn-ui@latest add badge\n```\n\n3. Run the development server:\n```bash\nnpm run dev\n# or\nyarn dev\n```\n\nThe frontend application will be available at `http://localhost:3000`.\n\n## Project Structure\n\n```\nsentiment-analyzer/\n├── backend/\n│   ├── venv/\n│   ├── app.py\n│   └── requirements.txt\n└── frontend/\n    ├── components/\n    │   └── SentimentAnalyzer.js\n    ├── app/\n    │   └── page.js\n    └── package.json\n```\n\n## API Endpoints\n\n### POST /api/analyze-sentiment\n\nAnalyzes the sentiment of provided text.\n\n#### Request Body\n```json\n{\n  \"text\": \"String of text to analyze\"\n}\n```\n\n#### Response Format\n```json\n{\n  \"sentence_analysis\": [\n    {\n      \"sentence\": \"Original sentence\",\n      \"polarity\": 0.0,\n      \"subjectivity\": 0.0,\n      \"category\": \"Positive/Negative/Neutral\"\n    }\n  ],\n  \"overall_analysis\": {\n    \"polarity\": 0.0,\n    \"subjectivity\": 0.0,\n    \"category\": \"Positive/Negative/Neutral\"\n  }\n}\n```\n\n## Usage\n\n1. Start both the backend and frontend servers\n2. Open your browser to `http://localhost:3000`\n3. Enter text in the textarea\n4. Click \"Analyze Sentiment\" to see the analysis results\n5. View the overall sentiment and per-sentence breakdown\n6. Check the chart for sentiment trends across sentences\n\n## Development\n\n### Backend Development\n\n- The Flask application uses CORS to allow cross-origin requests from the frontend\n- Sentiment analysis is performed using TextBlob\n- NLTK is used for sentence tokenization\n- Error handling is implemented for various edge cases\n\n### Frontend Development\n\n- The application uses the App Router in Next.js\n- Components are built using shadcn/ui for consistent styling\n- Recharts is used for data visualization\n- Responsive design is implemented using Tailwind CSS\n\n## Error Handling\n\nThe application includes error handling for:\n- Empty text submissions\n- Invalid JSON requests\n- Server connection issues\n- NLTK resource availability\n- Edge cases in sentiment analysis\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fsentiment-analyser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkphp%2Fsentiment-analyser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fsentiment-analyser/lists"}