A Flask-based web application that analyzes user comments using sentiment analysis, similarity detection, and AI-powered insights.
%%{init: {'theme': 'default', 'themeVariables': { 'fontSize': '16px'}, "securityLevel": "loose"}}%%
graph LR
A[CSV Upload] --> B[CommentCleaner]
B --> C[Data Processing]
C --> D{Analysis Type}
D -->|Sentiment Analysis| E[SentimentAnalyzer]
D -->|Similarity Check| F[Sentence Transformer]
D -->|Custom Query| G[LLM Analysis]
E --> H[Results Dashboard]
F --> I[Deduplicated Comments]
I --> G
G --> H
- CSV Upload: Process comment data from CSV files
- Sentiment Analysis: Analyze comment sentiment using TextBlob
- Similarity Detection: Remove duplicate or highly similar comments using sentence transformers
- AI-Powered Insights: Generate detailed insights and suggestions using LLM integration
- Interactive Query Interface: Ask specific questions about your comment data
- Clone the repository:
git clone https://github.com/yourusername/comment-analysis-tool.git
cd comment-analysis-tool- Install dependencies:
pip install -r requirements.txt- Create a
.envfile with your configuration:
OPENAI_API_KEY=your_api_key_here- Flask
- python-dotenv
- TextBlob
- sentence-transformers
- scikit-learn
- pandas
- numpy
- markdown
- Start the Flask server:
python app.py-
Navigate to
http://localhost:5000in your web browser -
Upload a CSV file containing a 'comment' column
-
Analyze your comments using the available features:
- View sentiment distribution
- Generate AI insights
- Ask specific questions about your data
Upload a CSV file containing comments for analysis.
Analyze uploaded comments with customizable parameters:
max_comments: Maximum number of comments to analyze (default: 1000)similarity_threshold: Threshold for detecting similar comments (default: 0.85)
Ask specific questions about your comment data.
├── app.py # Main Flask application
├── templates/
│ └── index.html # Frontend interface
├── requirements.txt # Python dependencies
└── .env # Environment variables
- Removes HTML tags and non-ASCII characters
- Ensures clean text input for analysis
- Calculates sentiment polarity using TextBlob
- Provides sentiment distribution statistics
- Removes similar comments using cosine similarity
- Generates AI-powered insights using LLM integration