AIML - 通配符标签

AIML - Wild Card Tags

我正在编写以下 AIML 代码。

<aiml>
<category>
<pattern>test</pattern>
<template>This is a test to try the third possible input. Yes / No ? </br> 
</template>
</category>

<category>
<pattern>Yes</pattern>
<that>This is a test to try the third possible *</that>
<template>Hey!. You have typed YES!</template>
</category>

<category>
<pattern>No</pattern>
<that>This is a test to try the third possible *</that>
<template>Hey!. You have typed No!</template>
</category>

<category>
<pattern>*</pattern>
<that>This is a test to try the third possible *</that>
<template>BINGO!!!!</template>
</category>
</aiml>

当用户输入“是”或“否”以外的任何内容时,我希望看到 "Bingo!!!" 作为响应。

<pattern>*</pattern>

当我单独使用它时工作正常,但在这里不行。我哪里做错了?

一些 AIML 库要求 pattern 值是大写的(即使对于不强制它的实现来说,这也是一种很好的做法)。所以对我来说,以下代码按预期工作(在 PyAIML 下测试):

<aiml>
    <category>
        <pattern>TEST</pattern>
        <template>This is a test to try the third possible input. Yes / No ? <br /></template>
    </category>

    <category>
        <pattern>YES</pattern>
        <that>THIS IS A TEST TO TRY THE THIRD POSSIBLE *</that>
        <template>Hey!. You have typed YES!</template>
    </category>

    <category>
        <pattern>NO</pattern>
        <that>THIS IS A TEST TO TRY THE THIRD POSSIBLE *</that>
        <template>Hey!. You have typed No!</template>
    </category>

    <category>
        <pattern>*</pattern>
        <that>THIS IS A TEST TO TRY THE THIRD POSSIBLE *</that>
        <template>BINGO!!!!</template>
    </category>
</aiml>

输出:

> test
This is a test to try the third possible input. Yes / No ?
> yes
Hey!. You have typed YES!
> test
This is a test to try the third possible input. Yes / No ?
> no
Hey!. You have typed No!
> test 
This is a test to try the third possible input. Yes / No ?
> Foo
BINGO!!!!
> 

您也可以尝试使用 <topic> 而不是 <that> 标签,例如:

<aiml>
    <category>
        <pattern>TEST</pattern>
        <template>
            This is a test to try the third possible input. Yes / No ? <br />
             <think><set name="topic">THREE OPTIONS</set></think>
        </template>
    </category>

<topic name="THREE OPTIONS">
    <category>
        <pattern>YES</pattern>
        <template>Hey!. You have typed YES!</template>
    </category>

    <category>
        <pattern>NO</pattern>
        <template>Hey!. You have typed No!</template>
    </category>

    <category>
        <pattern>*</pattern>
        <template>BINGO!!!!</template>
    </category>
</topic>
</aiml>