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

Patterns with more than one star symbol (*) next to each other
 
 

Hi there,

I`ve seen patterns like CALL ME * * and even with more * without the separation by words, and it is hard to define which words really are for each star, for instance:

<category> CALL ME * * *</pattern>
<template><srai>RANDOM INTRO</srai> <star>.
<think><srai>SET GENDER FROM NAME <star></srai>
<set name=“name”><formal><star> <star index=“2”> <star index=“3”></formal></set>.
<set name=“firstname”><formal><star></formal></set>
<set name=“middlename”><formal><star index=“2”></formal></set>
<set name=“lastname”><formal><star index=“3”></formal></set>
</think></template>
</category>

In this case will it be just one word for each * ? ... like Call me Woods Betty Ann Caty, will be as:
Lastname - Woods
Middle Name - Betty
and for the third * it will be what`s left of the sentence, therefore, - First Name - Ann Caty

Is there a way to somehow define how much symbols are taken for the first, second, etc. star symbol? Or is it a bad style at all to use more than one asterix without separation by normal words or letters?

Thank you in advance.

Regards,
Inese

 

 
  [ # 1 ]

That all very much depends on what you’re using the chatbot for, actually. For normal conversations, only one wildcard between “separations” (or at the end of the pattern) is normally needed, but I know of an individual who uses their chatbots in Open Sim/Second Life for a wide variety of uses, and so has written a script that “pre-processes” the inputs to add command and bot information. One of his AIML categories looks like this:

<category>
  <
pattern>CMDLOGIN * * * * * * * * *</pattern>
  <
template>
    <
think>
      <
set name="name"><star index="1"/> <star index="2"/></set>
      <
set name="firstname"><star index="1"/></set>
      <
set name="lastname"><star index="2"/></set>
      <
set name="lastvisit"><get name="logindate"/></set>
      <
set name="lastvisityr"><get name="loginyear"/></set>
      <
set name="lastvisitmon"><get name="loginmonth"/></set>
      <
set name="lastvisitday"><get name="loginday"/></set>
      <
set name="lastvisithr"><get name="loginhour"/></set>
      <
set name="lastvisitampm"><get name="loginampm"/></set>
      <
set name="logindate"><date timez format="%x"/></set>
      <
set name="logintime"><date timez format="%X"/></set>
      <
set name="loginhour"><date timez format="%I"/></set>
      <
set name="loginmin"><date timez format="%M"/></set>
      <
set name="loginampm"><date timez format="%p"/></set>
      <
set name="loginmonth"><date timez format="%m"/></set>
      <
set name="loginday"><date timez format="%d"/></set>
      <
set name="loginyear"><date timez format="%Y"/></set>
      <
set name="temp">
        <
srai>GETNPCFIRSTVISIT</srai>
      </
set>
    </
think>
    <
condition>
      <
li name="temp" value="undefined">
        <
srai>CMDGREETNEW</srai>
      </
li>
      <
li>
        <
srai>CMDGREETRETURN</srai>
      </
li>
    </
condition>
  </
template>
</
category

As you can see, this guy puts the multiple wildcard concept to good use here, and this is a great example of how you could put something like this to use, if the circumstances are right. But as I mentioned earlier, for normal conversations, you don’t really need this. smile

 

 
  [ # 2 ]

But what if his name is Jean Paul Gaultier? His first name will be set to Jean and his surname to Paul. Always best to put a splitter in between the wildcards:

CMDLOGIN XSPLITTER XSPLITTER XSPLITTER XSPLITTER XSPLITTER XSPLITTER XSPLITTER XSPLITTER 

Be aware that using too many wildcards in one pattern will cause slowdown on the server, as it has to traverse many more branches in the graph to find the result.

In your example of “Call me Woods Betty Ann Caty”, the first name would be set to Woods, the middle name to Betty and the surname to Ann Caty.

 

 
  [ # 3 ]

In the example I gave, the information for the wildcard portion of the input is provided by the API, rather than the user, so if the user has “three names”, that’s handled by the API itself, and would probably just ignore the middle name, leaving just Jean for the first name, and Gaultier for the surname, but I didn’t write the API, so I don’t know for sure. And I’m well aware of the performance issues involved with the use of multiple wildcards, and I’m working on a way to improve this somewhat. Luckily, Program O doesn’t have to deal with quite as many users at one time as Program Z (AKA Pandorabots), so the issue isn’t as pressing right now. smile

 

 
  [ # 4 ]

I wondered about multiple wildcards. What if there’s more or less words than there are wildcards ?

 

 
  [ # 5 ]

If there are fewer words than wildcards, then the pattern doesn’t match. If there are more, the last wildcard contains the “overflow”. For example, CALL ME * * will match “call me a great guy”, and will result in the first wildcard containing the word “a”, while the second will contain “great guy”, but will not match “call me Dave”.

 

 
  [ # 6 ]

Thanks Dave. I will have to work on the search of my Graphmaster when I get some time to see how to deal with this.

 

 
  [ # 7 ]

Great! Thank you very much for your help smile

 

 
  login or register to react