{"id":26806246,"url":"https://github.com/ap-dev-github/sentiment-analyzer-api","last_synced_at":"2025-08-26T20:09:16.565Z","repository":{"id":280699061,"uuid":"942862058","full_name":"ap-dev-github/sentiment-analyzer-api","owner":"ap-dev-github","description":"A lightweight, scalable, and serverless API for real-time sentiment analysis. Built using Flask, NLTK's SentimentIntensityAnalyzer, and deployed on AWS Lambda with the Serverless Framework, it efficiently classifies text as positive, negative, or neutral.","archived":false,"fork":false,"pushed_at":"2025-06-20T05:21:12.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T16:37:45.447Z","etag":null,"topics":["aws","aws-api-gateway","aws-lambda","bandit","cost-optimization","flake8","flask","isort","mypy","natural-language-processing","nltk-library","production-ready","prune","pytest","scalable-architecture","serverless"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ap-dev-github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-03-04T19:49:27.000Z","updated_at":"2025-06-20T05:21:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ce3e0a5-7d0d-4c6c-ad20-4dc0277c9ae2","html_url":"https://github.com/ap-dev-github/sentiment-analyzer-api","commit_stats":null,"previous_names":["ap-dev-github/sentiment-analyzer-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ap-dev-github/sentiment-analyzer-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fsentiment-analyzer-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fsentiment-analyzer-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fsentiment-analyzer-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fsentiment-analyzer-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ap-dev-github","download_url":"https://codeload.github.com/ap-dev-github/sentiment-analyzer-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fsentiment-analyzer-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272252537,"owners_count":24900675,"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","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["aws","aws-api-gateway","aws-lambda","bandit","cost-optimization","flake8","flask","isort","mypy","natural-language-processing","nltk-library","production-ready","prune","pytest","scalable-architecture","serverless"],"created_at":"2025-03-29T23:30:40.723Z","updated_at":"2025-08-26T20:09:16.549Z","avatar_url":"https://github.com/ap-dev-github.png","language":"Python","readme":"#  Sentiment Analyzer API\n\n## 📝 Overview\n\u003e The **Sentiment Analyzer API** intelligently processes text input via a **path parameter**, utilizing **NLTK's SentimentIntensityAnalyzer** to extract **negative, positive, and neutral scores**. Based on these values, it determines the **dominant emotion** and classifies the **sentiment in real time**.  \n\n\u003eDesigned for **efficiency and scalability**, this API **automatically tests and deploys** any code changes to **AWS Lambda** using the **Serverless Framework**. It seamlessly **balances load** with **AWS API Gateway**, ensuring **high availability and performance** under varying traffic loads.  \n\n\u003eWith its **serverless architecture**, the API **scales down to zero cost** when idle (**for Lambda alone**). When used with **API Gateway and S3**, operational costs can **reduce by up to 98%**, making it a **lightweight, cost-effective, and highly scalable** sentiment analysis solution.  \n \n## 🎯 Use Cases\n-  **Review Categorization**: Automatically classifies reviews as **Positive, Negative, or Neutral**.\n-  **Automated Customer Support**: Negative reviews trigger **AWS SNS notifications** to notify the **QA team** and send a **custom apology email** to the customer.\n- **Recommendation System**: Uses **positive reviews** to suggest the best-rated products or services.\n-  **Scalability \u0026 Serverless**: Designed to work **seamlessly** with **AWS Lambda**, ensuring **cost efficiency and  automatic scaling**.\n\n## 📊 Scalability Optimization \u0026 Cost Efficiency\n- Uses **AWS API Gateway** for **auto-scaling** and **load balancing** under high traffic.\n-  **Cold Start Prevention**: Removes unnecessary dependencies after testing to ensure **fast startup times**.\n- The API **scales down** to nearly **zero cost** for **up to 1 million requests/month** (including AWS services like **S3, EC2, DynamoDB**).\n\n## ⚙️ Deployment Pipeline (CI/CD)\nThe API is **fully serverless** and **automatically deploys** when updates are pushed to the repository.\n\n### 🏗 **GitHub Actions Workflow**\n🔹 **Triggers:**  \n   - 📌 Push to `main` or `dev` branches  \n🔹 **Deployment Jobs:**  \n   -  Sets up **Python 3.9**  \n   -  Installs dependencies  \n   -  Runs **security testing** using `run_checks.sh`  \n   -  Deploys the API to **AWS Lambda using Serverless Framework**  \n   -  Prunes old deployments, keeping only the last **two versions**  \n\n## 🔐 Security \u0026 Testing Pipeline\nEach deployment runs a **test script** that performs:  \n- ✅ **Unit Tests** (`pytest`) \n- 🔍 **Linting** (`flake8`)  \n- 🗂 **Import Organization** (`isort`)  \n- 📏 **Static Type Checking** (`mypy`)  \n- 🛡 **Security Scans** (`bandit`)  \n\n## 🚀 API Endpoints\n### 📡 1. Analyze Sentiment\n```http\nGET /analyze/\u003ctext\u003e\n```\n#### Parameters:\n| Parameter | Type   | Description               |\n|-----------|--------|---------------------------|\n| `text`    | string | Input text for sentiment analysis |\n\n#### Example Response:\n```json\n{\n  \"positive\": 0.8,\n  \"neutral\": 0.1,\n  \"negative\": 0.1,\n  \"dominant_sentiment\": \"Positive\"\n}\n```\n\n## Conclusion\nThe **Sentiment Analyzer API** is a **highly scalable**, **serverless** solution designed for **real-time sentiment analysis**. It is ideal for **customer feedback management**, **recommendation systems**, and **automated customer support workflows**.\n\n🚀 **Built with Flask | Serverless | AWS Lambda | GitHub Actions | Passion :)**\n## Developer and Maintainer\n\n# **Ayush Pandey**\n[🔗 Connect on LinkedIn](https://www.linkedin.com/in/linkedap/)  \n📧 **Email:** [ayushpandey.cs@gmail.com](mailto:ayushpandey.cs@gmail.com)  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fap-dev-github%2Fsentiment-analyzer-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fap-dev-github%2Fsentiment-analyzer-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fap-dev-github%2Fsentiment-analyzer-api/lists"}