Goal
Create an interactive dashboard that analyzes text sentiment (positive/negative/neutral) from:
✔ User input
✔ Tweets
✔ Reviews
✔ Uploaded CSV files
Displays visual charts (pie chart, bar chart, timeline).
🧠 What the Project Will Do
The dashboard can:
✔ Accept text input
✔ Analyze sentiment in real-time
✔ Upload a CSV of comments
✔ Process each comment using NLP
✔ Show counts of Positive, Neutral, Negative
✔ Show sentiment distribution graph
✔ Show average sentiment score
✔ Show word cloud (optional)
🧰 Tech Stack
- Python
- TextBlob / NLTK / Transformers
- Streamlit (dashboard)
- Matplotlib / Plotly
- Pandas
📁 Folder Structure
SentimentDashboard/
│── app.py
│── requirements.txt
│── sample_reviews.csv
📦 requirements.txt
streamlit
pandas
textblob
matplotlib
wordcloud
Install all:
pip install -r requirements.txt
or manually:
pip install streamlit textblob pandas matplotlib wordcloud
python -m textblob.download_corpora
🧩 Full Working Sentiment Dashboard Code (app.py)
import streamlit as st
import pandas as pd
from textblob import TextBlob
import matplotlib.pyplot as plt
st.title("Sentiment Analysis Dashboard")
st.write("Analyze text sentiment in real-time")
def analyze_sentiment(text):
score = TextBlob(text).sentiment.polarity
if score > 0:
return "Positive", score
elif score < 0:
return "Negative", score
else:
return "Neutral", score
# --- Option 1: Single Text Input ---
st.header("Single Text Sentiment")
user_text = st.text_area("Enter text")
if st.button("Analyze"):
sentiment, score = analyze_sentiment(user_text)
st.success(f"Sentiment: {sentiment} (Score: {score})")
# --- Option 2: CSV Upload ---
st.header("CSV Sentiment Analysis")
file = st.file_uploader("Upload CSV with 'text' column", type=['csv'])
if file is not None:
df = pd.read_csv(file)
df["Sentiment"] = df["text"].apply(lambda x: analyze_sentiment(x)[0])
df["Score"] = df["text"].apply(lambda x: analyze_sentiment(x)[1])
st.write(df)
# Count sentiment values
counts = df["Sentiment"].value_counts()
# Plot
st.subheader("Sentiment Distribution")
fig, ax = plt.subplots()
ax.pie(counts, labels=counts.index, autopct="%1.1f%%")
st.pyplot(fig)
▶ Run the Dashboard
streamlit run app.py
Opens in browser:
http://localhost:8501
📊 Features in Dashboard
1. Sentiment Analyzer
- Positive
- Negative
- Neutral
- Shows sentiment score (-1 to +1)
2. CSV Analysis
Upload file like:
text
"Great product"
"Very bad service"
"Okay, not good not bad"
Dashboard shows:
- Table with sentiment
- Pie chart
- Score distribution
3. Graphs
Optional additions:
⭐ Bar chart
⭐ Word cloud
⭐ Sentiment over time

Leave a Reply