我想创建一个聊天机器人,它可以根据他们的答案,沿着模板树向下移动,提出问题。我在编程领域经验不是很丰富,所以如果我的行话不正确,请原谅!
下面是一个例子。
我想根据用户对聊天机器人的输入编写自定义报告。让我们假设用户想要一些日常的、自定义的动机。
今天你感觉怎么样?根据用户输入,这被分类为:“好-坏-悲伤-高兴-兴奋”等……
根据哪一个模板,我们沿着“模板树”向下移动,所以如果用户写下“相当好”并且被归类为“好”,那么任何存在于“坏”类别下的模板都会被忽略。
然后,我们会问一些问题,比如“你叫什么名字?”,这些问题被存储为变量,一旦我们根据它们的输入找到正确的模板,就可以合并到文本模板中。
最好的构建平台是什么?它真的是一个聊天机器人吗?
非常感谢你的帮助!
我尝试过Pandorabots,但它似乎太线性了--因为在输入>响应模型中,没有太多的条件逻辑。我已经准备好研究和学习,所以任何关于哪种平台/方法的提示都会非常有帮助!
发布于 2019-04-01 16:44:48
Pandorabots使用AIML创建聊天机器人,您当然可以在其中执行条件逻辑。以下是一些可以解决您的请求的代码:
<?xml version="1.0" encoding="UTF-8"?>
<aiml version="2.0">
<category>
<pattern>HI</pattern>
<template>
Hi there. What is your name?
</template>
</category>
<category>
<pattern>*</pattern>
<that>WHAT IS YOUR NAME</that>
<template>
<think><set name="name"><star/></set></think>
How are you feeling today?
</template>
</category>
<category>
<pattern>*</pattern>
<that>HOW ARE YOU FEELING TODAY</that>
<template>
<think><set name="mood"><star/></set></think>
<condition name="mood">
<li value="good">That's great <get name="name"/>.</li>
<li value="bad">Sorry to hear that <get name="name"/>. Can I help?</li>
<li value="sad">Cheer up <get name="name"/>, it's a beautiful day!</li>
<li value="happy">Oh wow <get name="name"/>. I'm so pleased for you!</li>
<li value="excited">Amazing <get name="name"/>! What's happened?</li>
<li>The day is yours to command <get name="name"/>.</li>
</condition>
</template>
</category>
</aiml> 示例对话将如下所示:

使用pattern侧标签,您还可以使用Pandorabots将相似的答案分组在一起。创建名为“好”和“坏”的集合,其中包含应触发模板的所有情绪。"good“集合的示例:
[
["amazing"],
["good"],
["happy"],
["great"]
]然后使用这样的类别:
<category>
<pattern>I FEEL <set>good</set></pattern>
<template>Great to hear!</template>
</category>
<category>
<pattern>I FEEL <set>bad</set></pattern>
<template>Sorry to hear that. Can I help?</template>
</category>希望这能有所帮助。Pandorabots的能力远远超过输入-响应,我已经四次获得Loebner奖,因为我使用AIML和Pandorabots拥有世界上最具人性化的对话人工智能。
发布于 2019-03-31 00:56:10
既然你已经尝试过Program O on Github,那么我假设你熟悉XML和XML,这就是为什么我提出的程序O Pandorabots有一个功能调用,可以用来构建交互式的树状聊天。看看我下面的例子。不过,我猜你可能在研究中遇到过aiml。
<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>
<category>
<pattern>hi</pattern>
<template>How are you feeling today?</template>
</category>
<category>
<pattern>GOOD</pattern>
<that>How are you feeling today?</that>
<template>Nice, I like it that way.</template>
</category>
<category>
<pattern>BAD</pattern>
<that>How are you feeling today?</that>
<template>
<randon>
<li>Ok! I think you need an appointment with a doctor?</li
<li>How exactly are you feeling?</li>
</random>
</template>
</category>
<category>
<pattern>SAD_</pattern>
<that>How are you feeling today?</that>
<template>
<randon>
<li>Ok! what happened?</li
<li>how can i help?</li>
</random>
</template>
</category>
<category>
<pattern>HAPPY_</pattern>
<that>How are you feeling today?</that>
<template>
<randon>
<li>great! its good for you</li
<li>thats what up.</li>
</random>
</template>
</category>
</aiml>https://stackoverflow.com/questions/55433380
复制相似问题