如何在一个话语中处理多个问题?
How to handle multiple questions within one utterance?
样本:
User: How old are you and where do you live ?
Alice: I'm 7 months old. I live on earth.
我的尝试:
<category>
<pattern>WHERE DO YOU LIVE</pattern>
<template>I live on earth.</template>
</category>
<category>
<pattern>HOW OLD ARE YOU</pattern>
<template>I'm 7 months old.</template>
</category>
以上AIML代码只有我分别问两个问题才能回复
通过深入研究 AIML syntax,我终于找到了带有 <srai>
标签的解决方案:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE inline_dtd[
<!ENTITY nbsp " ">
]>
<aiml version="2.0">
<category>
<pattern>WHERE DO YOU LIVE</pattern>
<template>I live on earth.</template>
</category>
<category>
<pattern>HOW OLD ARE YOU</pattern>
<template>I'm 7 months old.</template>
</category>
<category>
<pattern>HOW OLD ARE YOU AND WHERE DO YOU LIVE</pattern>
<template>
<srai>HOW OLD ARE YOU</srai>
<srai>WHERE DO YOU LIVE</srai>
</template>
</category>
</aiml>
您也可以使用通配符来改进这一点。现在我们可以回答诸如 "How are you and where is London"
<category>
<pattern>HOW _ AND WHERE *</pattern>
<template>
<srai>HOW <star/></srai>
<srai>WHERE <star index="2"/></srai>
</template>
</category>
样本:
User: How old are you and where do you live ?
Alice: I'm 7 months old. I live on earth.
我的尝试:
<category>
<pattern>WHERE DO YOU LIVE</pattern>
<template>I live on earth.</template>
</category>
<category>
<pattern>HOW OLD ARE YOU</pattern>
<template>I'm 7 months old.</template>
</category>
以上AIML代码只有我分别问两个问题才能回复
通过深入研究 AIML syntax,我终于找到了带有 <srai>
标签的解决方案:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE inline_dtd[
<!ENTITY nbsp " ">
]>
<aiml version="2.0">
<category>
<pattern>WHERE DO YOU LIVE</pattern>
<template>I live on earth.</template>
</category>
<category>
<pattern>HOW OLD ARE YOU</pattern>
<template>I'm 7 months old.</template>
</category>
<category>
<pattern>HOW OLD ARE YOU AND WHERE DO YOU LIVE</pattern>
<template>
<srai>HOW OLD ARE YOU</srai>
<srai>WHERE DO YOU LIVE</srai>
</template>
</category>
</aiml>
您也可以使用通配符来改进这一点。现在我们可以回答诸如 "How are you and where is London"
<category>
<pattern>HOW _ AND WHERE *</pattern>
<template>
<srai>HOW <star/></srai>
<srai>WHERE <star index="2"/></srai>
</template>
</category>