Reputation: 43013
Sample:
User: How old are you and where do you live ?
Alice: I'm 7 months old. I live on earth.
My try:
<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>
The above AIML code can only reply if I ask the two questions separately.
Upvotes: 1
Views: 205
Reputation: 905
You could also use wildcards to improve this. Now we can answer things like, "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>
Upvotes: 1
Reputation: 43013
By digging into AIML syntax, I finally found a solution with the <srai>
tag:
<?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>
Upvotes: 1