Self-Learn Bot is a Python-based interactive chatbot application that can answer user queries, learn from new inputs, and store knowledge locally on your device. The bot is fully offline, meaning all your interactions and data remain private and secure. It uses a local JSON knowledge base and a GUI built with CustomTkinter.
- Interactive GUI: Clean, modern interface for a smooth user experience.
- Offline Knowledge Base: All data is stored locally in
knowledge_base.json. - Self-Learning: Can learn new questions and answers during runtime.
- Smart Matching: Uses
difflib.get_close_matchesto find the closest known questions. - User-Friendly: Enter questions in the input field and get immediate responses.
- Secure & Private: Data is never sent to any external server.
The knowledge base is a JSON file with this structure:
{
"questions": [
{
"question": "hello",
"answer": "Hello"
},
{
"question": "How are you?",
"answer": "I'm good"
}
]
}For multiple-choice questions:
{
"question": "Including the bottom, how many sides are on a square-based pyramid?",
"A": "three",
"B": "four",
"C": "five",
"D": "six",
"answer": "C"
}The bot will store new questions automatically.
- Input Processing: Takes user input from the GUI.
- Best Match Search: Finds the closest question in the knowledge base using fuzzy matching.
- Response Generation: Shows the answer if found.
- Training Mode: If the question is new, prompts the user for the answer and saves it in
knowledge_base.json. - Persistence: All data is stored offline and can only be accessed through the bot.
- Python 3.10+
- CustomTkinter
- Pillow
- Standard Python library (
json,difflib)
- Add voice input and output.
- Enable categorization of questions for faster search.
- Add multi-language support.
- Improve the UI with dark/light theme switching.
- Everything is stored locally.
- No data is shared with external servers.
- Knowledge base is encrypted (optional feature in future versions).
Arya Ramachandran Email: your.email@example.com