AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Chatbot127: Modelling database
 
 

Hi all,
I am making a chatbot as a semester project and i am keenly interested in it. I am trying to implement it using relational databases. All the chatbots i know have been implemented using files, xml or aiml(extension of xml i.e Artificial markup language) .
Now that i am doing it using databases i am having few problems. Main problem is modelling | structuring database. For now what i have thought is something like this:

Lets say i want to store keywords and responses. Lets say user say “hi” that is a keyword and it will be searched in database for keywords and corresponding response that might be “hiya” is displayed to user. This is the most simple thing we can do.
being one step forward i need to do something like this.
for example a list of similar keywords can have simialar responses like
“hi” “hello” “hey” can have any of “hi, how r u?” “hey, nice to meet you” .here we have 3 similar keywords and 2 responses to each keyword. response will be picked randomly for now. I want to ask how to implement it?

What i am thinking to do is creating a main keyword which have multiple responses. and managing a list of all keywords that ultimately point to the main similar keyword.
for example
————————————
main keywords table
—————————-
id keyword responses
1 hi       1
2   bye     2
————————————————
All keywords table
————————-
id keywords main keyword
1   hey       1
2   hello     1
3   hiya       1
4     hi       1
5   bye       2
6   goodbye   2

——————————-
responses table
————————————-
id responses
1 hey how are you
2 Bye!

now whenever user say “hey” it will be searched in a big list of all the keywords then it will point to main keyword and from their it will point to responses.

how to store similar responses?
Is it the right approach?
wont it make the system to complex and cluttered? because eventually there is going to be a lot of data.
Is there any good approach to handle this, or you can refer to some material available about chatbots using databases?

In attachment is a database diagram which i will be working upon. I am afraid to say here, but its totally noob:)

if i couldnt convey the message well, Kindly ask for further explanation. Your help will be duely appreciated.
Thanks in advance

Image Attachments
Capture.JPG
 

 
  [ # 1 ]

Depending on your experience with PHP, you may want to have a look at Program O, which, while it uses AIML files, stores them in a MySQL database. Just looking at the table structure that Program O uses may give you some ideas and/or inspiration for your own database.

[opinion]
Basically, if you’re going to be using a relational DB to store your bot’s responses, you’re also going to need to have tables for not only those responses, but also input patterns, past responses, and past inputs (or past patterns matched - for conversational context), as well. It would also help to have some sort of ontology, to assist with semantic interpretation of the input, and a “real world” knowledge base, to help with keeping the responses relevant and factually correct, but those two “features” may prove to be exceedingly challenging to implement. Lord knows I’ve not been able to do so successfully (though I’m not exactly the most proficient programmer here, by a LONG shot).
[/opinion]

As to the exact structure of said tables, there I can’t help you, since you can place the sum total of my knowledge of database structures into the navel of a gnat, and have it rattle around like a BB in a box of corn flakes. smile

 

 
  [ # 2 ]

First i must appreciate your sense of humor:)
secondly thanks for the reply.
i will take a look at program O and may find something useful. Another problem is I started using ASP.NET in C#. consequently MS SQL. So no php or mysql, however i will see if i can get some help there.

About your opinion i would like to say that input patterns are not really necessary for storing keywords and responses. I have my own reasons for that. Still i am not explaining those reasons as i myself not sure about that! (Dangling thoughts grin ) But i think i will find a nice way out! 
Then you talked about past responses and context handling, yes you are right that i have to make a table for these things as well!.

“It would also help to have some sort of ontology, to assist with semantic interpretation of the input, and a “real world” knowledge base, to help with keeping the responses relevant and factually correct, but those two “features” may prove to be exceedingly challenging to implement. Lord knows I’ve not been able to do so successfully”

After hearing this I am feeling that i stepped into red zone (chatbot programming). I always fear that how am i going to make chatbot atleast like ALAN, ALICE etc. sweet dreams.
thanks again for the information
& Your bot is nice.

 

 
  [ # 3 ]

Thanks for the compliment about Morti. I wish I had more time to devote to him.

In the Program O source files are several SQL files, including one that holds the actual table structure for the Program O database. That file is what you should probably look at most, as it’s what I was referring to, though the actual script is full of SQL queries that may also provide some insight.

What I was referring to by patterns in the input can more or less equate loosely with your usage of keywords, I think. The concepts are close enough in meaning to interchange, I think. smile

And don’t worry quite so much about adding an ontology at this stage. As I said, it would be helpful, but it’s certainly not essential. A great many chatbot technologies currently available don’t use them (with one notable exception, as in ChatScript). the same goes for having a knowledge base, as well. It’s great to have, but hardly a “deal breaker”. smile

 

 
  [ # 4 ]

I have downloaded Program O source code v 1.0.4. But i cant find what you mentioned i.e. server sql files including one that holds actual table structure!
Where are those files? and how can i see table structure? any free tool to view it graphically?
sorry for asking such dumb questions!

 

 
  [ # 5 ]

Silly me! I’ve been working on the development of version 2 of Program O so long that I got the two versions mixed up, and misremembered. The SQL file that I was referring to isn’t in the version 1.04 package. I’m sorry. Version 2 is not yet publicly available yet, but I can post the SQL file here without getting into trouble. smile

However, the statement about there being a number of SQL queries within the script that can provide some insight still holds true. smile

File Attachments
new.sql.txt  (File Size: 8KB - Downloads: 314)
 

 
  [ # 6 ]

Thanks to you very much for the file!
This file did some help.
& yeah your second statement is and was true.

 

 
  [ # 7 ]

Glad I could be of some help. Please be sure to keep us informed about your project. smile

 

 
  login or register to react
‹‹ A Financial Advisor Chatbot      MALDIX ››