A Simple ChatBot using Deep Learning Neural Network
I faced some issues during implementaiton of tfLearn using python 3.7
and it worked for me with python 3.65
Let's first import all the packages that you will need during this project.
- numpy is the fundamental package for scientific computing with Python.
- sklearn provides simple and efficient tools for data mining and data analysis.
- nltk is a package to work with human language data.
- tensorflow is an open source high level library, using data flow graphs to build models.
- tflearn is a deep learning library built on top of Tensorflow.
- Pickle it's pre-built python libraries used for
Saving
andloading
models. - json Refer to Documentation
import nltk
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()
import numpy as np
import tensorflow as tf
import tflearn
import random
import json
tf.reset_default_graph()
net = tflearn.input_data(shape=[None, len(training[0])]) # input layer,
net = tflearn.fully_connected(net, 8) # hidden layer
net = tflearn.fully_connected(net, 8) # hidden layer
net = tflearn.fully_connected(net, len(output[0]), activation="softmax") # activation function along with output
net = tflearn.regression(net)
model = tflearn.DNN(net)
git clone https://github.com/iNuman/ChatBot
- LinkedIn : https://www.linkedin.com/in/-inuman/
- Instagram : https://instagram.com/inoumn
- Facebook : https://www.facebook.com/iNuman51
Copyright (c) 2020 Numan Ali
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.