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..

_ and * clarification
 
 
  [ # 16 ]

One more, I think I know this one, but need to check.

Two patterns again…

_ KEYWORDA _
_ KEYWORDA KEYWORDB KEYWORDC _ 

If the input is :

FOO KEYWORDA BAR

Then it must hit the first one I think.

And if the input is :

FOO KEYWORDA KEYWORDB KEYWORDC BAR

It must hit the second one.

I found this a little counter intuitive because it looks like ‘KEYWORDB KEYWORDC’ are overriding the _ wildcard in the first pattern if you see what I mean ?

BTW, this forum is much faster now, even previews work, well done to the team smile

 

 
  [ # 17 ]
Roger Davie - Jul 18, 2014:

BTW, this forum is much faster now, even previews work, well done to the team smile

Yeah, the new version is much better than the previous one. I rather like it. smile

Roger Davie - Jul 18, 2014:

Two patterns again…
_ KEYWORDA _
_ KEYWORDA KEYWORDB KEYWORDC _

If the input is :

  FOO KEYWORDA BAR

Then it must hit the first one I think.

And if the input is :

  FOO KEYWORDA KEYWORDB KEYWORDC BAR

It must hit the second one.

I found this a little counter intuitive because it looks like ‘KEYWORDB KEYWORDC’ are overriding the _ wildcard in the first pattern if you see what I mean ?

Well, given the fact that the underscore wildcard supersedes even a direct match, and also given that the input is searched left to right, the input “FOO KEYWORDA KEYWORDB KEYWORDC BAR” will be matched by the first pattern ( _ KEYWORDA _ ) instead of the second. This may sound counter-intuitive based on the example given, but that’s just the nature of the beast, I’m afraid. One of the “minor” bugs that Program O has is that in the described circumstance, Program O (version 2) will score the second pattern higher than the first because of the number of direct match words in the input. This is another reason why I’m trying to wrap my head around the GraphMaster concept, and researching ways to implement it for version 3. :-\

 

 
  [ # 18 ]

Ah, so I need to go back a step then.

So that’s the accepted behaviour for an AIML interpreter ?  That the wild card in that first example trumps the second pattern ?

Hmm, okay, I can do that. I actually did have that working the way you describe but I thought it was wrong. It’s a minor fix to reverse it.

Yes I am working on the Graphmaster thing for the past couple of days. It’s going quite well, I’ll send you something once I have done a lot more testing.

So just to clear it up further ... if we replace the _ wildcards with the * wildcards, it will function the opposite way.

KEYWORDA *
KEYWORDA KEYWORDB KEYWORDC 

FOO KEYWORDA BAR

Should match the first pattern.  And…

FOO KEYWORDA KEYWORDB KEYWORDC BAR

Should match the second pattern because keywords have greater precedence than * wildcards.

Am I on the right track ? smile

 

 
  [ # 19 ]

P.S. Thanks for introducing me to the Graphmaster Dave. It’s very elegant. I like that it will only return one hit out of hundreds (nay thousands) of possibilities (if you have written your AIML right anyway).

No need for messy scoring. smile

 

 
  [ # 20 ]

You are, indeed, my friend. Carry on. cheese

 

 
  [ # 21 ]

Sorry cross posted :/

 

 
  [ # 22 ]
Roger Davie - Jul 18, 2014:

P.S. Thanks for introducing me to the Graphmaster Dave. It’s very elegant. I like that it will only return one hit out of hundreds of possibilities. No need for messy scoring.

No worries, Mate! smile Except that my development on this is currently stalled (I think I’m missing something vital, causing the confusion). I’m half tempted to call you up to hash it out. wink

I will say this, though. Given the literally thousands of potential AIML categories involved, the GraphMaster is something that cannot be created “on the fly”, each time a user types something in. At least, not so far as I’ve been able to determine. One of the hurdles I’m working on getting past is how to generate and store the object, and how to “call” it with each volley. My research is still very much in the early stages, I’m afraid. downer

 

 
  [ # 23 ]

I’ve heavily documented my code so far so that we can work it out between us. I think I would have a hard time discussing things in person at the moment though, I’m still working it out. Give me some time to get more of it understood.

My code has a little debugging output too, makes it easier to understand, especially with all the recursion that is going on !

I agree with your notion that we cannot create the Graphmaster on the fly. I anticipated this. I haven’t put it into practive yet as I’m still working on the parsing routine, but I have an idea…

The way I decided to do it was by using a big multi dimensional array. Into the array the patterns are injected. So it’s basically an associative array, with words marking the nodes. I traverse the array as per the words in the nodes compared to the words in the input. If the AIML is written properly with no duplicates and shadows you should get only one result.

In fact by it’s nature duplicates would be overwritten anyway. There is a useful side-effect there - and that’s at the time the Graphmaster is created you can check for things like duplicates and throw an error message to a log or something.

As for storing the Graphmaster itself, I thought to serialise the array and then write it to file. So at each volley you wouldn’t need to recreate the Graphmaster - instead you read in the file and unserialise it back into an array form - all ready to use.

It should use a lot less memory than a database or the raw AIML files. Since one node can represent all the patterns that start with one certain word - I mean the word only need be represented once. Since databases use the file system anyway I can’t see this being a bad decision yet.

It’s very interesting to work on.

 

 
  [ # 24 ]

Got stuck. Not sure if my interpreter is working right. I get stuck with these _ wildcards.

Okay I have these patterns :

_ KEYWORDA KEYWORDB KEYWORDC
KEYWORDA _ KEYWORDB KEYWORDC _ 

If I enter the string :

KEYWORDA FOO KEYWORDB KEYWORDC BAR

Will/Should there ever be a match with the second pattern ?

Because the first pattern starts with _ my code is quitting there once it finds that KEYWORDA is not matched in that first pattern there. I did program it that way, but I am not sure of how these two patterns should be handled.

 

 
  [ # 25 ]

Scrap that - I think the penny just dropped with the _ wildcard.

Clearly it’s desirable to to hit that second pattern. I have amended my algorithm to cater to it.

 

 
  [ # 26 ]

It’s also worth noting that the underscore wildcard should be used very sparingly in regular AIML, mainly due to the fact that it’s so powerful, and can easily be misused. However, while testing for proper functionality with a new interpreter, it’s good to create as many “edge cases” as possible to test against. smile

 

 
  [ # 27 ]

Yes - I can see why you and Steve say that about the _ wilcard. I can see it can potentially wipe out whole segments of script.

I was trying to check all eventualities as you say, just to be sure, even thought they would probably never get used. I always try to be thorough when error testing any code I make. smile

 

 
  [ # 28 ]

That’s a good practice, really, and something I need to drill into my unusually thick skull at times. cheese

 

 < 1 2
2 of 2
 
  login or register to react