Salam-o-Aalikum,
I am working on a chat bot, I have its Perl version but since I do not have any Perl base so I am having very much difficulty translating its code into ASP. However, I think what I am wanting might already be done by somebody.
What I want to do is, that I will have a text file with all the patterns of questions and their according replies. I want to define the question pattern in this way:
What do you (think|say|suggest) I should try for (dinner|breakfast|lunch) (today|in the evening)
I want to match the pattern, for instance if somebody writes "What do you say i should try for dinner today", then I want this to recognize it.
I do have a solution to this in my mind, but that is going to make the script too very slow! My idea is to loop through the string (which the user has entered) and find out all the parentheses and select first word from the first bracket and first word from the second and match it with all the words in the last bracket. Then take second word from the first bracket, first word from the second and match with all the words in the third.
But this procedure is going to make the reply very slow. Because this is just one reply, it might have more words in it, and the total number of replies could be a hundred thousand. So one loop will have to go at least 200 times just matching one answer. And Multiply that with hundred thousand.. well.. I don't think its a good way to do it.
Please enlighten me. I am very confused. Asalam-o-Aalikum.
------------- http://www.muhammadbinyusrat.com/blog/" rel="nofollow - Say to the believing men..
|