Search code examples
xmlpattern-matchingaiml

AIML: List of choices is not finding matching pattern


I am attempting to build the example file that is listed here. https://docs.bmc.com/docs/display/public/BVA9/Sample.aiml+file

I was able to write out the file (I think correctly) here. https://gist.github.com/pemby/679571f9eb9a413faa72811bbbe85621

Running the file I think it is failing the first pattern match.

<category>
<pattern>CMP</pattern>
<template>
    Which password do you want to change?<br/>
    1) Lotus password.<br/>
    2) Sgate password. <br/>
    3) NT/PC password.<br/>
    Enter yoour choice-1/2/3.
</template>

Then fails here...

<category>
    <pattern>1</pattern>
    <that>* Enter your choice-1/2/3.</that>
    <template>
    <think>
    <set name="option1">1</set>
    </think>
    <srai>ACMP</srai>  
    </template>
</category>

Solution

  • You have a typo of "yoour" in your first category. Also you need to add </category> at the end of your first category. You are checking for the wrong value of <that> in your second category (the documentation you are learning from is incorrect). I've posted the correct and working version of your code.

    <category>
        <pattern>CMP</pattern>
        <template>
            Which password do you want to change?<br/>
            1) Lotus password.<br/>
            2) Sgate password. <br/>
            3) NT/PC password.<br/>
            Enter your choice-1/2/3.
        </template>
    </category>
    
    <category>
        <pattern>1</pattern>
        <that>ENTER YOUR CHOICE *</that>
        <template>
            <think>
                <set name="option1">1</set>
            </think>
            <srai>ACMP</srai>  
        </template>
    </category>