Chatbot implementation with PyTorch.
- The implementation is done with a Feed Forward Neural net with 2 hidden layers.
mkdir myproject
$ cd myproject
$ python3 -m venv venvpip install nltkIf 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.pyThis will dump data.pth file. And then run
python chat.pyHave a look at intents.json. Just define a new tag, possible patterns, and possible responses for the chat bot.
{
"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?"
]
},
...
]
}