Skip to content

Commit 97cd2d8

Browse files
committed
readme updated
1 parent 0371409 commit 97cd2d8

1 file changed

Lines changed: 80 additions & 82 deletions

File tree

README.md

Lines changed: 80 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,62 @@
11
# Leoplus AI – Conversational Sentiment Analysis Chatbot
22

3-
A production-ready chatbot built for the Leoplus AI internship assignment. This project implements **Tier 1 (mandatory)** and **Tier 2 (additional credit)** sentiment analysis, along with a lightweight **Rule-Based NLU system** for context-aware responses.
3+
A production-ready chatbot built for the **LiaPlus AI internship assignment**. This project provides:
4+
5+
* **Tier 1** (mandatory): Conversation-level sentiment analysis.
6+
* **Tier 2** (bonus): Statement-level sentiment analysis.
7+
8+
This updated version uses **VADER Sentiment Analyzer only**, ensuring lightweight, fast, and dependency‑safe execution.
49

510
---
611

712
## 📌 Features
813

914
### ✅ Tier 1 — Overall Conversation Sentiment (Mandatory)
1015

11-
At the end of the conversation, the chatbot generates:
16+
At the end of the interaction, the system generates:
1217

13-
* Overall sentiment *positive / neutral / negative*
18+
* Overall conversation sentiment (positive / neutral / negative)
1419
* Confidence score
15-
* Conversation summary
16-
* Mood shift detection (bonus feature)
20+
* Optional mood trend (improving / worsening / stable)
1721

18-
### ✅ Tier 2 — Message-Level Sentiment (Additional Credit)
22+
### ✅ Tier 2 — Per‑Message Sentiment (Bonus)
1923

20-
For **each user message**, the bot performs:
24+
For every user message:
2125

22-
* Sentiment detection
23-
* Confidence scoring
24-
* Sentiment-aware response tone
26+
* Sentiment is analyzed using **VADER**
27+
* Confidence is computed from compound score
28+
* Chatbot chooses a **tone‑appropriate** reply
2529

2630
Example:
2731

2832
```
2933
User: "Your service disappoints me"
3034
→ Sentiment: negative (confidence: 0.82)
31-
Bot: I'm sorry you're facing trouble. Let me help fix this.
35+
Bot: "I’m sorry youre facing trouble. Let me help fix this."
3236
```
3337

3438
---
3539

36-
## 📌 Rule-Based NLU (Context Understanding)
37-
38-
A lightweight NLU engine identifies user intent based on keywords.
40+
## 📌 Rule‑Based NLU (Context Awareness)
3941

40-
Supported intents:
42+
A small NLU classifier detects intent using keyword patterns.
4143

4244
| Intent | Example Keywords |
4345
| --------------- | ---------------------------- |
44-
| greeting | hi, hello |
46+
| greeting | hi, hello, hey |
4547
| farewell | bye, thanks |
4648
| refund | refund, money back |
4749
| delivery_issue | late, package, not delivered |
4850
| technical_issue | error, crash, not working |
49-
| billing_issue | charge, bill, invoice |
51+
| billing_issue | bill, charge, invoice |
5052
| account_issue | login, password |
5153
| general | fallback |
5254

53-
This enables **context-specific responses**, e.g.:
55+
This allows contextspecific replies:
5456

5557
```
56-
User: my package is late
57-
Bot: I'm sorry your package is delayed. Could you share your order ID?
58+
User: "my package is late"
59+
Bot: "I’m sorry your package is delayed. Could you share your order ID?"
5860
```
5961

6062
---
@@ -91,108 +93,108 @@ main.py
9193

9294
### 1️⃣ Create virtual environment
9395

94-
```bash
96+
```
9597
python -m venv venv
96-
source venv/bin/activate # Windows → venv\Scripts\activate
98+
```
99+
100+
Activate it:
101+
102+
```
103+
# Windows
104+
venv\Scripts\activate
105+
106+
# Linux / Mac
107+
source venv/bin/activate
97108
```
98109

99110
### 2️⃣ Install dependencies
100111

101-
```bash
112+
```
102113
pip install -r requirements.txt
103114
```
104115

105-
### 3️⃣ Run the chatbot
116+
### 3️⃣ Run the chatbot (CLI)
106117

107-
```bash
118+
```
108119
python main.py
109120
```
110121

111-
### 4️⃣ End the conversation
112-
113-
Type:
122+
### 4️⃣ End the conversation with:
114123

115124
```
116125
quit
117126
exit
118127
bye
119128
```
120129

121-
You will see a final sentiment summary.
122-
123130
---
124131

125132
# 🧠 Sentiment Logic Explained
126133

127-
## ✔ Tier 2: Single Message Sentiment
134+
## ✔ Tier 2 (Statement‑Level)
128135

129-
Each message is cleaned and analyzed using:
136+
The system uses **VADER only**:
130137

131-
1. **Transformers (DistilBERT)** → main model
132-
2. **VADER** → fallback
133-
3. **Keyword polarity** → final fallback
138+
* `compound` score determines sentiment label
139+
* Confidence = absolute value of compound
134140

135-
Each prediction returns:
141+
| Compound Score Range | Meaning |
142+
| -------------------- | -------- |
143+
| ≥ 0.05 | Positive |
144+
| ≤ -0.05 | Negative |
145+
| Between | Neutral |
136146

137-
* label: positive / negative / neutral
138-
* confidence score
139-
* raw scores
147+
This ensures predictable, consistent behavior.
140148

141149
---
142150

143-
## ✔ Tier 1: Conversation-Level Sentiment
151+
## ✔ Tier 1 (ConversationLevel)
144152

145-
All user messages → aggregated using weighted average:
153+
At the end:
146154

147-
* Positive sentiment → +score
148-
* Negative → -score
149-
* Neutral → 0
155+
* All message compound scores are averaged
156+
* Higher confidence weights influence final sentiment
150157

151-
Weights depend on message length + confidence.
158+
Also computes:
152159

153-
Output includes:
154-
155-
* Overall sentiment
156-
* Confidence
157-
* Trend (improving/worsening/stable)
160+
* **Trend:** improving / worsening / stable
158161

159162
---
160163

161164
# 🟦 Technologies Used
162165

163-
### **NLP**
166+
### **Core NLP**
164167

165-
* Transformers (DistilBERT)
166-
* VADER sentiment analyzer
168+
* VADER (NLTK)
167169
* Rule-Based NLU
168-
* Text cleaning utilities
170+
* Text preprocessing utilities
169171

170-
### **Software Architecture**
172+
### **Architecture**
171173

172-
* Modular service-component design
174+
* Modular components
175+
* Service layer
176+
* Repository layer for saving conversations
173177
* Logging utilities
174-
* Repository layer
175-
* Conversation analytics
176178

177179
### **Testing**
178180

179-
* pytest
180-
* Unit tests for text cleaning, sentiment, and conversation handling
181+
* `pytest` for unit tests on:
182+
183+
* Text cleaner
184+
* Sentiment component
185+
* Conversation manager
181186

182187
---
183188

184189
# 🏆 Status of Tier 2 Implementation
185190

186-
| Feature | Status |
187-
| ----------------------------- | ----------------- |
188-
| Single-message sentiment | ✅ Completed |
189-
| Confidence scoring | ✅ Completed |
190-
| Per-message sentiment output | ✅ Completed |
191-
| Conversation flow integration | ✅ Completed |
192-
| Sentiment-aware tone | ✅ Completed |
193-
| Mood shift detection | ⭐ Bonus Completed |
194-
195-
Your bot **meets and exceeds** Tier 2 expectations.
191+
| Feature | Status |
192+
| --------------------- | ------------------------------- |
193+
| Per-message sentiment | ✅ Done |
194+
| Confidence scoring | ✅ Done |
195+
| Sentiment-aware tone | ✅ Done |
196+
| Mood trend analysis | ⭐ Bonus Done |
197+
| Transformers model | ❌ Removed (now uses VADER only) |
196198

197199
---
198200

@@ -203,7 +205,7 @@ Bot: Hello! I'm Leoplus Assistant. How can I help?
203205
204206
You: My package is not delivered yet.
205207
→ Sentiment: negative (0.81)
206-
Bot: I'm sorry your package is delayed. Could you share your order ID?
208+
Bot: Im sorry your package is delayed. Could you share your order ID?
207209
208210
You: Also the billing was wrong.
209211
→ Sentiment: negative (0.73)
@@ -218,18 +220,14 @@ Trend: worsening
218220

219221
---
220222

221-
# 🎯 Why This Project Is Strong for the Internship
222-
223-
* Professional architecture
224-
* Tier 1 & Tier 2 fully implemented
225-
* Clean and scalable codebase
226-
* Context-aware responses via Rule-Based NLU
227-
* Multiple fallback strategies for robustness
228-
* Clear documentation and readability
229-
* No unnecessary ML complexity
223+
# 🎯 Project characteristics
230224

231-
This showcases strong engineering fundamentals and practical NLP understanding.
225+
* Clean, modular, production-style architecture
226+
* Tier 1 + Tier 2 fully satisfied
227+
* Rule-Based NLU improves realism
228+
* Stable sentiment system using VADER
229+
* Clear documentation
230+
* Lightweight (no heavy ML models needed)
232231

233232
---
234233

235-
If you want additional sections (deployment, limitations, future work), I can add them too!

0 commit comments

Comments
 (0)