A simple Python-based chatbot that answers frequently asked questions (FAQs) using natural language processing. ChatBuddy uses TF-IDF vectorization and cosine similarity to understand user queries and provide the most relevant answer from a predefined dataset. Includes some personality-driven responses to make the chat more interactive!
- Answers common FAQs from a customizable dataset
- Friendly, personality-driven responses for generic questions
- Vectorizes and matches user input using TF-IDF and cosine similarity
- Runs entirely in the terminal/command line
- Easy to extend with more Q&A pairs
- The bot uses a dictionary of questions and answers.
- User input is vectorized and compared to all questions using cosine similarity.
- The answer with the highest similarity is returned.
- If no question matches closely (similarity < 0.3), a default response is given.
馃 ChatBuddy is ready! Type 'exit' to quit.
You: How do I reset my password?
ChatBuddy: To reset your password, click on 'Forgot Password' and follow the instructions.
You: Tell me a joke
ChatBuddy: Why don鈥檛 robots ever panic? Because they鈥檝e got nerves of steel!
You: exit
ChatBuddy: Catch you later! 馃憢- Python 3.6 or higher
- Packages:
nltk,numpy,scikit-learn
-
Clone the repository or copy the code.
-
Install dependencies:
pip install nltk numpy scikit-learn
-
Run the script:
python chatbot.py
(Replace
chatbot.pywith your file name if different) -
First run will download NLTK data automatically.
- Add or edit question-answer pairs in the
faq_datadictionary to suit your needs. - Adjust the similarity threshold in
get_response()if needed.
- Built by [Arjun Trivedi]
- Uses NLTK for tokenization
- Vectorization and similarity by scikit-learn
Feel free to contribute or raise issues!