Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Pattern matching in ASP
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Pattern matching in ASP

 Post Reply Post Reply
Author
neotrix View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 09 November 2003
Location: Pakistan
Status: Offline
Points: 433
Post Options Post Options   Thanks (0) Thanks(0)   Quote neotrix Quote  Post ReplyReply Direct Link To This Post Topic: Pattern matching in ASP
    Posted: 27 August 2007 at 12:06pm
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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.