RJx334 commited on
Commit
4f0c5a0
Β·
verified Β·
1 Parent(s): fd7d296

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -31
README.md CHANGED
@@ -1,51 +1,87 @@
1
- # πŸ€– Context-Aware Thematic Chatbot
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- This is a simple yet intelligent rule-based chatbot that understands user queries by extracting **thematic roles** (like subject, object, and verb) and then finds the most relevant response using **string similarity**. It doesn't just match words β€” it understands structure.
 
 
 
 
 
4
 
5
  ---
6
 
7
- ## 🧠 How It Works
 
 
 
 
 
8
 
9
- The chatbot performs the following steps:
10
 
11
- 1. **Extract Thematic Roles**:
12
- - Uses `spaCy` to parse grammar.
13
- - Extracts `subject`, `object`, and `verb` from user input.
 
 
 
14
 
15
- 2. **Compare with Knowledge Base**:
16
- - A CSV file (`clean_basic_conversations.csv`) is used as the chatbot's memory.
17
- - Each known query is broken into thematic roles.
18
- - String similarity is calculated (using `difflib`) between roles.
19
 
20
- 3. **Return Best Match**:
21
- - The response for the closest matched query is returned if its similarity passes a threshold.
22
- - An explanation of how the bot arrived at the response is shown on the side.
 
 
23
 
24
  ---
25
 
26
- ## πŸ–₯ Interface
 
 
 
 
27
 
28
- - Built using **Gradio**.
29
- - Two-column layout:
30
- - Left: Chat interface
31
- - Right: "How I thought" explanation panel
 
 
 
 
32
 
33
  ---
34
 
35
- ## πŸ“ Files in This Project
 
 
 
 
 
36
 
37
- | File | Description |
38
- |--------------------------|---------------------------------------------|
39
- | `app.py` | Gradio interface for the chatbot |
40
- | `chatbot_logic.py` | Contains logic for thematic role extraction and matching |
41
- | `clean_basic_conversations.csv` | Knowledge base used by the chatbot |
42
- | `requirements.txt` | Required Python libraries |
43
- | `README.md` | Project documentation |
44
 
45
  ---
46
 
47
- ## πŸš€ Running Locally
 
 
48
 
49
- ```bash
50
- pip install -r requirements.txt
51
- python app.py
 
1
+ ---
2
+ title: Context-Aware Chatbot
3
+ emoji: 🧠
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 3.50.2
8
+ app_file: app.py
9
+ pinned: false
10
+ license: apache-2.0
11
+ ---
12
+
13
+ # πŸ€– Context-Aware Chatbot using Thematic Roles and Similarity Matching
14
 
15
+ This project is a simple yet intelligent chatbot that uses **Natural Language Processing (NLP)** to understand user input and reply contextually. It combines:
16
+
17
+ - 🧠 **Thematic Role Extraction** using `spaCy` (to identify subjects, objects, and verbs)
18
+ - πŸ” **String Similarity Matching** using `difflib` (to compare user input with a knowledge base)
19
+ - πŸ’¬ A custom **conversation dataset** with real-life queries and responses
20
+ - 🌐 A **Gradio interface** deployed on Hugging Face Spaces
21
 
22
  ---
23
 
24
+ ## πŸš€ Features
25
+ - Understands context using subject, object, and verb extraction
26
+ - Matches queries based on thematic roles rather than plain keywords
27
+ - Provides explanations for how the response was selected
28
+ - Interactive and beginner-friendly web interface
29
+ - Can be updated easily by editing the CSV knowledge base
30
 
31
+ ---
32
 
33
+ ## 🧩 How It Works
34
+ 1. The user types a sentence (e.g., "Who are you?")
35
+ 2. The chatbot extracts thematic roles (subject, object, verb)
36
+ 3. It compares these roles with each query in the CSV using string similarity
37
+ 4. If the similarity score crosses a threshold, it returns the best matching response
38
+ 5. If no match is found, it responds with a fallback message
39
 
40
+ ---
 
 
 
41
 
42
+ ## πŸ“‚ Files
43
+ - `app.py` – Main application file (Gradio interface + NLP logic)
44
+ - `clean_basic_conversations.csv` – Custom dataset of conversations
45
+ - `requirements.txt` – Python dependencies
46
+ - `README.md` – Project description and Hugging Face config
47
 
48
  ---
49
 
50
+ ## πŸ“¦ Installation (for local testing)
51
+ ```bash
52
+ pip install -r requirements.txt
53
+ python app.py
54
+ ```
55
 
56
+ ---
57
+
58
+ ## πŸ–Ό Example Conversation
59
+ **You:** Who created you?
60
+ **Bot:** I was created by two AIML students named Rohit and Ankur.
61
+
62
+ **You:** What do you do?
63
+ **Bot:** I help answer questions using simple natural language understanding.
64
 
65
  ---
66
 
67
+ ## 🧠 Technologies Used
68
+ - Python 3
69
+ - spaCy (NLP parsing)
70
+ - difflib (string similarity)
71
+ - pandas (data handling)
72
+ - Gradio (interface)
73
 
74
+ ---
75
+
76
+ ## πŸ“„ License
77
+ This project is released under the **MIT License**. You are free to use, modify, and distribute it for educational or research purposes.
 
 
 
78
 
79
  ---
80
 
81
+ ## πŸ‘¨πŸ»β€πŸ’» Created By
82
+ - Rohit Gomes
83
+ - Ankur Halder
84
 
85
+ ---
86
+
87
+ Enjoy chatting! πŸ€–