Jump to content

Classification Model:intents file and how it differs from set_pairs


Recommended Posts

Posted (edited)

Hi,

I am trying to built a chatbot. I found following link:

 

developer refinitive

 

I am following the above link, its creating a intents file, It has some fields with their values separated by colons.

"intents":[

 {

   "tag":"greeting",

   "patterns":["Hi there","How are you","Is anyone there?","Hello","Good day"],

   "responses":["Hello, thanks for asking","Good to see you again","Hi there, how can I help?"],

   "context":[""]},

One other link (https://www.pluralsight.com/guides/build-a-chatbot-with-python) shows set_pairs like:

 

Quote

set_pairs = [ [ r"my name is (.*)", ["Hello %1, How are you doing toda ], [ r"hi|hey|hello", ["Hello", "Hey there",] ],

 

What is the difference between intents file and set_pairs?

Zulfi.

Edited by zak100
Posted (edited)

It appears that set_pairs is a list of inputs and their respective outputs while intents is more of “one of these outputs should be returned if one of the inputs is given) Essentially you can randomize the intents outputs to seem more human (so you don’t get the same response every time.)

Edited by PoetheProgrammer
Posted (edited)

Hi,

Thanks.

God blesses you. 

What is the purpose of classification model and training? Kindly check the link at developer refinitive. What is the pupose of context? How we should be using it?

 

Zulfi.

Edited by zak100
Posted (edited)

FYI forum rules say we shouldn’t need to click links or watch videos to participate.

I’m not sure a model would be best here as that’ll get complex /fast/.  However it is possible to build a neural network that takes in input and maps to the given outputs.  How you would build such a model is a topic in of itself but you could start with just a RNN where you’ve mapped all English words to a given number and setup the input and output layers to take/output the binary representation of said numbers.  You could do a CNN but you’d need to allow each layer to take in and output entire sentences and unfortunately I think you would mostly get gibberish or overfitting.  Neither are desired.

it would be simpler to just build a simple “expert machine” since you have the data set available and you could trivially  map inputs to outputs provided within the set provided.  For instance when a user inputs “Hi there” you lookup in the data set what pattern it is in and then return one of the responses from that same node, I.e., “good to see you again!”

Edited by PoetheProgrammer
Posted

Hi,

Thanks for your response. Good ideas. I can try with that trivial approach.

 

God blesses you. Howver, I have to incorporate some AI technique.

 

Zulfi.

Posted (edited)

If it’s homework or something that absolutely required a stat model I would recommend a markov chain.  It’s about the simplest one that’ll work for you as you just train it to jump from one state or another (autocorrect used to be a markov chain until a few years ago) and can be implemented in a few dozen lines of code.  Neural nets are sexier but very difficult to get right with language unless you have a lot of time (the complexity compounds quickly.)

Edited by PoetheProgrammer
Posted

Hi,

You are right, I did a course of NN sometime but since then I hate them because they took lot of time in training and result was nothing. I don't believe I have skills to make them work properly. Please provide some link for Markov chain.

 

Zulfi. 

Posted

I haven’t used a markov chain in years so I don’t know a good tutorial but the first google result was a python library https://github.com/jsvine/markovify

May I ask what did you try in regards to neural networks?  There are lots of architectures of ANNs and things like a simple CNN will probably get you nowhere fast but RNNs will far exceed the capabilities of a markov chain.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.