您认为编程的重要模式/寺庙是什么?就像在聊天机器人中一样,每个聊天机器人都需要响应做什么?我刚刚开始制作 aiml 文件并需要一些帮助......

现在这是文件。

<aiml>

<category>
    <pattern>Hey</pattern>
    <template>Whats up?</template>
<category>

<category>
    <pattern>WHAT ARE YOU?</pattern>
    <template>I am a chatbot.</template>
<category>

<category>
    <pattern>DO YOU LIKE*</pattern>
    <template>Yes, I love <star/></template>
<category>

<category>
    <pattern>WHAT IS*</pattern>
    <template><star/>? is that what humans call what I did to your mom last night?</template>
<category>

<category>
    <pattern>WHEN WERE YOUR BORN*</pattern>
    <template>I was created in 2010.</template>
<category>

有帮助吗?

解决方案

好了,我会sugest访问这两个网站:

http://aitools.org/Free_AIML_sets (死链接)

http://www.alicebot.org/aiml/aaa/

他们有很多.aiml文件中包含无疑会增加知识,你的机器人种类吨。

另外,在第一个行:

<pattern>Hey</pattern>. 

这是不正确的。请记住,模式始终处于大写字母!所以做到这一点:

<pattern>HEY</pattern>

这也有在AIML图案NO标点符号。

其他提示

您可能要包括语音的可被简化或重定向到另一个类别基本/通用模式。下面是一些例子,手柄定义检索。

<category>
    <pattern>WHAT IS *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>DEFINE *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>WHAT IS A *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>DEFINE A *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>WHAT IS THE *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>DEFINE A *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>WHAT IS THE MEANING OF *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>DEFINE THE MEANING OF *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>WHAT IS THE DEFINITION OF *</pattern>
    <template>
        <sr/>
    </template>
</category>
<category>
    <pattern>DEFINE THE DEFINITION OF *</pattern>
    <template>
        <sr/>
    </template>
</category>

这涉及更多您的问题的代码更多有用AIML线将是这些:

<category>
    <pattern>HI *</pattern>
    <template>
        <srai>HI</srai>
    </template>
</category>
<category>
    <pattern>HELLO *</pattern>
    <template>
        <srai>HI</srai>
    </template>
</category>
<category>
    <pattern>ALOHA *</pattern>
    <template>
        <srai>HI</srai>
    </template>
</category>
<category>
    <pattern>HEY *</pattern>
    <template>
        <srai>HI</srai>
    </template>
</category>

www.alicebot.org 正在提供 超级机器人 其中包含前 10,000 个模式的 aaml 文件。然而,对于爱好者来说可能太贵了。

根据我自己的经验,您肯定需要对以下方面的模式做出回应:

  • 问候(嗨/你好)
  • 姓名(你是谁?)
  • 年龄(你多大了?)
  • 生日(你什么时候出生的?)
  • 性别/物种(你是什么?)
  • 健康(你好吗?)

如果您从头开始,当您尝试考虑用户可能提出问题的所有不同方式(例如机器人的名称)时,就会出现问题

  • 你叫什么名字?
  • 你叫什么?
  • 他们怎么称呼你?
  • 而你呢?
  • 我叫吉姆,你叫什么名字?
  • 等等,等等

我还可以指出,模式中的通配符应该与其他单词分开,以便解析器可以将它们作为输入字符串中的不同单词进行选取。

<pattern>WHEN WERE YOUR BORN *</pattern>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top