user1868607
user1868607

Reputation: 2610

Meaning of * * in aiml file

I was given the following code in AIML:

<category>
 <pattern>TOP * *</pattern>
 <template><star index="1"/></template>
</category>

Which is supposed to give back the first element of a list of words. I know * is supposed to capture one or more words. What is the meaning of * *?

Upvotes: 1

Views: 200

Answers (2)

Pablo Villalba
Pablo Villalba

Reputation: 533

I know it's been a while since you asked this. I had a similar problem and found the XSPLITTER word (as any other, but works as a flag), what you can do (what I'm working in right now) is to filter the inputs and add the XSPLITTER word matching a regex in your interpreter. Or, even easier, in your very case, you can just edit the AIML file and replace your pattern with this:

<category>
    <pattern>TOP * IN *</pattern>
    <template><star index="1"/></template>
</category>

Not really sure if it makes sense as I don't know what you want to top and where, but as a starting point it can work.

Upvotes: 2

bottaio
bottaio

Reputation: 5093

As you mentioned * captures one or more words. First star would capture one word, rest would be captured by second one. Your template uses only first star thus first element of the list.

Upvotes: 3

Related Questions