A beautiful, real-time web application for analyzing sentiment in news articles about AI and technology. Built with Node.js, Express, and modern web technologies.
- 🔍 News Fetching: Fetch latest news articles from Google News based on customizable queries
- 💭 Sentiment Analysis: Real-time sentiment analysis using advanced NLP algorithms
- 📊 Data Visualization: Interactive charts showing sentiment distribution, keyword trends, and historical patterns
- ⏰ Real-time Updates: Auto-update feature to continuously monitor sentiment trends
- 🔮 Trend Prediction: Generate predictions based on historical sentiment data
- 📱 Responsive Design: Beautiful UI that works on all devices
- Sentiment Summary Cards: Quick overview of positive, neutral, and negative sentiments
- Sentiment Distribution Chart: Donut chart showing sentiment breakdown
- Top Keywords: Horizontal bar chart of trending topics
- Sentiment Over Time: Line chart tracking sentiment history with prediction capability
- News Articles Display: Live feed of analyzed articles with sentiment labels
- Node.js (v14 or higher)
- npm or yarn
- Install dependencies:
npm install- Start the server:
npm start- Open your browser and navigate to:
http://localhost:3000
For auto-restart on file changes:
npm run dev- Enter a Search Query: Type your search term (e.g., "AI OR artificial intelligence")
- Set Number of Articles: Choose how many articles to analyze (5-50)
- Click "Fetch & Analyze": The system will:
- Fetch latest news articles
- Perform sentiment analysis on each article
- Display visualizations and statistics
- Start Auto-Update: Click "Start Auto-Update" button
- Monitor Trends: The dashboard will automatically fetch and analyze news every 60 seconds
- Stop When Done: Click "Stop Auto-Update" to stop the monitoring
- Accumulate History: Build up sentiment history by running multiple analyses
- Click "Generate Prediction": Get forecasted sentiment trends based on historical data
- View Results: See predicted sentiment as a red dashed line on the history chart
Click "Clear History" button to reset all sentiment tracking data.
src/services/newsFetcher.js: Handles fetching news from Google News RSS feedssrc/services/sentimentAnalyzer.js: Performs sentiment analysis using the Sentiment librarysrc/services/keywordExtractor.js: Extracts trending keywords from article titles
GET /api/news- Fetch news articlesPOST /api/analyze- Analyze sentiment of articlesPOST /api/keywords- Extract keywords from articlesGET /api/history- Get sentiment historyPOST /api/history/add- Add to historyDELETE /api/history- Clear historyGET /api/health- Server health check
public/index.html: Modern, responsive UI with Tailwind CSSpublic/js/dashboard.js: Dashboard logic with Chart.js visualizations
- Positive Sentiment: Green gradients (#10b981)
- Neutral Sentiment: Yellow/Amber (#f59e0b)
- Negative Sentiment: Red/Pink (#ef4444)
- Primary: Purple to Blue gradient (#667eea to #764ba2)
- Hover effects on all cards
- Real-time chart updates
- Smooth transitions and animations
- Responsive grid layouts
- Live status indicators
- Backend: Node.js, Express
- Frontend: HTML5, Tailwind CSS, Vanilla JavaScript
- Charts: Chart.js
- Sentiment Analysis: sentiment (Node.js library)
- Web Scraping: axios, cheerio
- Scheduling: node-cron (for future enhancements)
- Range: -1 to +1
- Positive (> 0): Article has positive sentiment
- Neutral (~ 0): Article has neutral sentiment
- Negative (< 0): Article has negative sentiment
- Shows percentage of articles in each sentiment category
- Total always equals 100%
- Overall sentiment score across all articles
- Visual representation with emoji and colored circle
- Market Research: Track public sentiment about products or brands
- Trend Monitoring: Monitor sentiment shifts over time
- Competitive Analysis: Compare sentiment across different topics
- Educational: Learn about NLP and sentiment analysis
- News Aggregation: Curate news based on sentiment
- Export data to CSV/JSON
- Email alerts for sentiment changes
- Support for multiple languages
- Advanced prediction models using Prophet or ML algorithms
- Custom sentiment dictionary
- Social media integration
- Comparative analysis across multiple queries
MIT License - Feel free to use and modify!
Built with ❤️ using:
- Express.js
- Chart.js
- Tailwind CSS
- Sentiment.js
- Cheerio
- Axios
Note: The application uses mock data for news articles in development. For production use, you may need to configure proper RSS feed access or use official news APIs.