Reputation: 67
I have done a lot of research on how to create chat bots (the responding part) however I can't find a way to make it more advanced. For example, I keep seeing NLTK reflections but I want to know if there are more advanced methods in NLTK (or other modules) that allow me to create a learning bot, smart bot or even an AI but I am struggling in finding modules, tutorials or documentation that help with getting started and proceeding that way. Reflections don't always work well like responding in context unless you have many lines of code pre-written for content which is inefficient and may not always be accurate. Note: I don't want to be spoon fed, I just want to be pointed in the right direction of stuff that I can do and look at.
a solution would be e.g. user asks: "who is your favourite actor?"
bot replies with: "Brad Pitt"
(only though of Brad because of the ad astra advertisements xD)
Below is the code that I am trying to stay away from.
pairs = [
[
r"my name is (.*)",
["Hello %1, How are you today ?",]
],
[
r"what is your name ?",
["My name is Chatty and I'm a chatbot ?",]
],
[
r"how are you ?",
["I'm doing good\nHow about You ?",]
],
[
r"sorry (.*)",
["Its alright","Its OK, never mind",]
],
[
r"i'm (.*) doing good",
["Nice to hear that","Alright :)",]
]```
Upvotes: 0
Views: 598
Reputation: 645
The code you want to stay away from used to be the very beginning of cahtbots (Eliza: https://blog.infermedica.com/introduction-to-chatbots-in-healthcare/). A good starting point is a full dialogue system. You could use for example the trindikit for python, which is basically a dialogue manager. Furthermore, you need to implement some sort of common sense reasoning database (e.g. compare Erik T Mueller: Commonsense Reasoning - An event Calculus based approach). Normally, most chatbots are focussed on a specific domain (product questions, recommender etc.), so you need to fix exactly what intentions may provoke which speech acts, classify and model them accordingly (LSTM for calssification, Bayes for production). Upon all this you either have to build a surface realisation system or use canned text as templates, which is growing work when your domain expands more and more.
Upvotes: 0
Reputation: 4349
There are two main styles of conversational agents: retrieval and generative. The regex code you show can be thought of as a very simple retrieval model. More complicated retrieval models classify user input with a classifier (at this point, almost always a neural network). Generative models treat the input to output mapping as a machine translation problem, and use techniques from NMT, neural machine translation.
Some resources:
Upvotes: 2