No project description provided
Project description
JanexBot - Question-Answer Chatbot
JanexBot is a simple prototype chatbot that interacts with users by asking and answering questions based on a provided database of questions and answers. The chatbot utilizes spaCy for natural language processing and similarity calculations.
Getting Started
Follow these instructions to set up and use JanexBot:
Prerequisites
- Python 3.x
- Required Python libraries:
spacy
,numpy
Installation
-
Clone or download this repository to your local machine.
-
Install the required Python libraries:
pip install spacy numpy
Download the spaCy language model (English) by running:
python -m spacy download en_core_web_sm
Create your chatbot script
from JanexBot import *
def main():
chatbot = JanexBot("database.json", "en_core_web_sm")
question = chatbot.ask_question(None)
print(f"Chatbot: {question}")
while True:
answer = input("You: ")
IsQuestion = chatbot.CheckForQuestion(answer)
if IsQuestion:
answer = chatbot.give_answer(answer)
print(f"Chatbot: {answer}")
else:
question = chatbot.ask_question(answer)
print(f"Chatbot: {question}")
chatbot.save_answer(answer)
if __name__ == "__main__":
main()
Usage
Place your question-answer data in a JSON file named database.json in the same directory as the script.
Run the chatbot script.
The chatbot will start interacting with you. It will provide prompts and respond to your input.
When asked a question, you can answer, and the chatbot will try to find the most relevant question based on your answer.
You can exit the chatbot by interrupting the script (e.g., pressing Ctrl+C).
Data Format
Ensure your database.json file follows this format:
{
"prompts": [
{
"question": "What is the capital of France?",
"question_vectors": [0.1, 0.2, 0.3, ...],
"answers": ["The capital of France is Paris."]
},
// Add more prompts as needed
]
}
Notes
The provided code is a prototype.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file JanexBot-0.0.4.tar.gz
.
File metadata
- Download URL: JanexBot-0.0.4.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f7395fe047ec9f705ba8157efc5000e0f5d63376c495fc4a9d6674974045079 |
|
MD5 | 9b35e758730ee8a880e533928be31cd3 |
|
BLAKE2b-256 | 31c340e01a20f6d22cc53d6a5ce05326ba765749b91972641bda010c39fefc19 |