I have been using AIML to make chatbot. I am unable to find multiple patterns in same category. How can we use OR clause in the pattern?
Asked
Active
Viewed 2,331 times
2 Answers
0
In AIML version 2, you can do this using sets or maps. Basically you define the set which is a list of one or more members, then you can refer to it in the pattern. Imagine you had a set with the names of the countries of the world, you could code this:
<category>
<pattern>IS <set>countries</set> A COUNTRY</pattern>
<template>
Yes, <star/> is a country.
</template>
</category>
<category>
<pattern>IS * A COUNTRY</pattern>
<template>
I never heard of a country called <star/>.
</template>
</category>
This works because the set is higher priority than the star in AIML version 2. So if you typed IS GERMANY A COUNTRY it would reply "Yes, Germany is a country". But if you typed IS EREWHON A COUNTRY it would reply "I never heard of a country called Erewhon".

Ubercoder
- 711
- 8
- 24
0
No, currently AIML supports only single pattern in a category. However, you may define multiple pattern and redirect them to original one by using 'srai' tag like:
<category><pattern># USA # Capital #</pattern><template>Capital of USA is DC.</template></category>
<category><pattern># Capital # USA #</pattern><template><srai># USA # Capital #</srai></template></category>

Hamza Idrees
- 89
- 7