chatbotaiml

AIML <sr /> Tag Pattern Matching


greetings stackoverflow community i am currently developing aiml chatbot and stumbled across a problem i want to know if my method of writing category is correct or not? or will it affect future categories.

here is the main category

<category>
<pattern>WHAT IS YOUR NAME</pattern>
<template>My name is chatbot</template>
</category>

method no 1

<category>
<pattern>TELL ME *</pattern>
<template><srai>WHAT IS <star/></srai></template>
</category>

method no 2

<category>
<pattern>TELL ME *</pattern>
<template><sr/></template>
</category>

i knew that both category methods would match "what is your name"

but what if user asks "tell me if you are comfortable with me or not" in this case this category would not match

<category>
<pattern>IF YOU ARE COMFARTABLE WITH ME
</pattern>
<template>Yes</template>
</category>
<category>
<pattern>TELL ME *</pattern>
<template><srai>WHAT IS <star/></srai></template>
</category>

but this category would match

<category>
<pattern>TELL ME *</pattern>
<template><sr/></template>
</category>

it would match both "what is *" and "if you are comfortable with me or not" but my real question will it affect future categories if i use

<sr /> 

tag for "tell me" instead of "what is". Will patterns fail to match if i write in this way? i want to know which method is correct.

What is the correct way to write "tell me" catgeory in order to Match "what is your name" and "if you are comfartable with me or not"


Solution

  • Your method 2 wouldn't really work, as something like TELL ME THE TIME would become THE TIME

    <category>
      <pattern>TELL ME *</pattern>
      <template><sr/></template>
    </category>
    

    I would say your method 1 is the best, as "Tell me..." usually means "What is...". For "Tell me if you are comfortable or not", I would make categories that shorten the input like this:

    <category>
      <pattern>TELL ME IF * ARE *</pattern>
      <template><srai>Are <star index="1"/> <star index="2"/></srai></template>
    </category>
    

    "Tell me if you are comfortable..." becomes "Are you comfortable..."