operator
operator

Reputation: 257

Aiml 1.0 - * pattern


I was wondering how can I create the AIML that matches this conversation:

User: What's my name?
Bot:  Right now I don't know. Tell me, what's your name?
User: Gandalf.
Bot:  Hello Gandalf.

So I tried to use this two categories.

<category>
    <pattern>WHAT'S MY NAME?</pattern>
    <template>
        <condition name="name_set" value="S"> <get name="name"/></condition>
        <condition name="name_set" value="">Right now I don't know.Tell me, what's your name?</condition>
    </template>
</category>
<category>
    <pattern>*</pattern>
    <that>Right now I don't know.Tell me, what's your name?</that>
    <template><think><set name="name"><star/></set><set name="name_set">S</set></think>Hello <srai>WHAT'S MY NAME?</srai>.</template>
</category>

But instead of choosing this last defined pattern, my bot is constantly answering the default answer, setted in another category using the * pattern but no that tag. What I'm doing wrong?

Bonus question: Probably you've noticed that I'm using a name_set global variable to see if I stored the name of the user: empty means NO, S means YES. I'm using this escamotage because in Program-O bot the AIML validator hasn't allowed me to use the exists attribute. If anyone know something more to fix the problem or has got any suggestion to give, please be my guest.

Thank you.

Upvotes: 1

Views: 497

Answers (1)

A. Kootstra
A. Kootstra

Reputation: 6971

It seems to me that the <that> in the category is incorrect. If I'm correct that refers to the final sentence of your bot's output. Then this would probably work better for you.

<category>
    <pattern>*</pattern>
    <that>Tell me *</that>
    <template>
      <think>
       <set name="name"><star/></set>
       <set name="name_set">S</set>
      </think>
      Hello <srai>WHAT'S MY NAME?</srai>.
    </template>
</category>

Upvotes: 1

Related Questions