In conversations, Context is king. This is a chatbot framework with a conversational model for an Ecommerce Website. The chatbot handles simple questions about hours of operation, reservation options, products in stock and so on. The chatbot also handles contextual responses such as inquiries about same-day deliveries and shipping.
- Training of the chatbot
- Chatbot running in the CLI
- Whatever you prefer (e.g.
conda
orvenv
)
mkdir myproject
$ cd myproject
$ python3 -m venv venv
- For Mac / Linux users:
. venv/bin/activate
- For Windows Users:
Use
conda base activate
or the code below:
venv\Scripts\activate
- For Installation of PyTorch see official website.
- You also need
nltk
:
pip install nltk
- If you get an error during the first run, you also need to install
nltk.tokenize.punkt
: - Run this once in your terminal:
$ python
>>> import nltk
>>> nltk.download('punkt')
- Run
python train.py
- This will dump data into the
data.pth
file. And then run
python chat.py
- Have a look at intents.json.
- You can customize it according to your own use case. Define a new
tag
, possiblepatterns
, and possibleresponses
for the chat bot. You have to re-run the training whenever this file is modified.
{
"intents": [
{
"tag": "greeting",
"patterns": [
"Hi",
"Hey",
"How are you",
"Is anyone there?",
"Hello",
"Good day"
],
"responses": [
"Hey :-)",
"Hello, thanks for visiting",
"Hi there, what can I do for you?",
"Hi there, how can I help?"
]
},
...
]
}
- You wanna contribute? Wow amazing. That's great to hear.
- After cloning & setting up the local project you can push the changes to your github fork and make a pull request.
git add .
git commit -m "feat: added new stuff"
git push YOUR_REPO_URL BRANCH_NAME