-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchatbots32.aiml
304 lines (266 loc) · 8.14 KB
/
chatbots32.aiml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<?xml version="1.0" encoding="ISO-8859-1"?>
<aiml>
<!-- Free software (c) 2001-2003 ALICE A.I. Foundation. -->
<!-- This program is open source code released under -->
<!-- the terms of the GNU General Public License -->
<!-- as published by the Free Software Foundation. -->
<!-- Complies with AIML 1.0 Tag Set Specification -->
<!-- as adopted by the ALICE A.I. Foundation. -->
<!-- chatbots32.aiml written by Steve Worswick (Square Bear) -->
<!-- Please contact [email protected] if you have queries about it -->
<!-- set up the database and include a catchall category -->
<category>
<pattern>XCHECKANIMAL *</pattern>
<template>
<think>
<set name="animal">UNKNOWN</set>
<set name="legs">UNKNOWN</set>
<set name="lives">UNKNOWN</set>
<set name="eats">UNKOWN</set>
<set name="says">UNKNOWN</set>
</think>
</template>
</category>
<category>
<pattern>XCHECKANIMAL DOG</pattern>
<template>
<think>
<set name="animal">dog</set>
<set name="legs">4</set>
<set name="lives">in a kennel</set>
<set name="eats">meat</set>
<set name="says">woof</set>
</think>
</template>
</category>
<category>
<pattern>XCHECKANIMAL CHICKEN</pattern>
<template>
<think>
<set name="animal">chicken</set>
<set name="legs">2</set>
<set name="lives">on a farm</set>
<set name="eats">corn</set>
<set name="says">cluck</set>
</think>
</template>
</category>
<category>
<pattern>XCHECKANIMAL GIRAFFE</pattern>
<template>
<think>
<set name="animal">giraffe</set>
<set name="legs">4</set>
<set name="lives">in Africa</set>
<set name="eats">leaves</set>
<set name="says">nothing</set>
</think>
</template>
</category>
<category>
<pattern>XCHECKANIMAL SPIDER</pattern>
<template>
<think>
<set name="animal">spider</set>
<set name="legs">8</set>
<set name="lives">in a web</set>
<set name="eats">flies</set>
<set name="says">nothing</set>
</think>
</template>
</category>
<category>
<pattern>XCHECKANIMAL COW</pattern>
<template>
<think>
<set name="animal">cow</set>
<set name="legs">4</set>
<set name="lives">on a farm</set>
<set name="eats">grass</set>
<set name="says">moo</set>
</think>
</template>
</category>
<!-- A simple query that accesses a row directly -->
<category>
<pattern>WHERE DOES A * LIVE</pattern>
<template>
<srai>XCHECKANIMAL <star index="1"/></srai>
<condition name="animal">
<li value="UNKNOWN">I haven't heard of a <star/>.</li>
<li> A <get name="animal"/> lives <get name="lives"/>.</li>
</condition>
</template>
</category>
<!-- A bit more complicated, setup a query and check for a fixed value -->
<category>
<pattern>WHICH ANIMAL HAS 2 LEGS</pattern>
<template>
<think>
<set name="list">Results:<br/></set>
<srai>XCHECKANIMAL DOG</srai>
<srai>XCHECKMATCH 2 LEGS</srai>
<srai>XCHECKANIMAL CHICKEN</srai>
<srai>XCHECKMATCH 2 LEGS</srai>
<srai>XCHECKANIMAL GIRAFFE</srai>
<srai>XCHECKMATCH 2 LEGS</srai>
<srai>XCHECKANIMAL SPIDER</srai>
<srai>XCHECKMATCH 2 LEGS</srai>
<srai>XCHECKANIMAL COW</srai>
<srai>XCHECKMATCH 2 LEGS</srai>
</think>
<get name="list"/>.
</template>
</category>
<category>
<pattern>XCHECKMATCH 2 LEGS</pattern>
<template>
<condition name="legs">
<li value="2">
<set name="list"><get name="list"/><br/><get name="animal"/></set>
</li>
</condition>
</template>
</category>
<!-- The main deal, search through the database and see what matches -->
<category>
<pattern>XSCANANIMALDATABASE</pattern>
<template>
<think>
<set name="list">Results:<br/></set>
<srai>XCHECKANIMAL DOG</srai>
<srai>XCHECKMATCH</srai>
<srai>XCHECKANIMAL CHICKEN</srai>
<srai>XCHECKMATCH</srai>
<srai>XCHECKANIMAL GIRAFFE</srai>
<srai>XCHECKMATCH</srai>
<srai>XCHECKANIMAL SPIDER</srai>
<srai>XCHECKMATCH</srai>
<srai>XCHECKANIMAL COW</srai>
<srai>XCHECKMATCH</srai>
</think>
<get name="list"/>
</template>
</category>
<!-- A query to test the database -->
<category>
<pattern>WHICH ANIMAL HAS * LEGS</pattern>
<template>
<think>
<set name="searchfor"><star/></set>
<learn>
<category>
<pattern>XCHECKMATCH</pattern>
<template>
<srai>BOTCOMPARE <get name="legs"/> XSPLIT <get name="searchfor"/></srai>
<condition name="match">
<li value="YES"><set name="list"><get name="list"/><br/>
<get name="animal"/></set></li>
</condition>
</template>
</category>
</learn>
</think>
<srai>XSCANANIMALDATABASE</srai>
</template>
</category>
<!-- This query searches for two items -->
<category>
<pattern>WHAT LIVES * AND SAYS *</pattern>
<template>
<think>
<set name="searchfor"><star/> <star index="2"/></set>
<learn>
<category>
<pattern>XCHECKMATCH</pattern>
<template>
<srai>BOTCOMPARE <get name="lives"/> <get name="says"/> XSPLIT <get name="searchfor"/></srai>
<condition name="match">
<li value="YES"><set name="list"><get name="list"/><br/>
<get name="animal"/></set></li>
</condition>
</template>
</category>
</learn>
</think>
<srai>XSCANANIMALDATABASE</srai>
</template>
</category>
<!-- We can include more than just the one column in the results -->
<category>
<pattern>HOW MANY LEGS HAS THE ANIMAL THAT EATS *</pattern>
<template>
<think>
<set name="searchfor"><star/></set>
<learn>
<category>
<pattern>XCHECKMATCH</pattern>
<template>
<srai>BOTCOMPARE <get name="eats"/> XSPLIT <get name="searchfor"/></srai>
<condition name="match">
<li value="YES"><set name="list"><get name="list"/><br/>
A <get name="animal"/> eats <get name="eats"/> and has <get name="legs"/> legs.
</set></li>
</condition>
</template>
</category>
</learn>
</think>
<srai>XSCANANIMALDATABASE</srai>
</template>
</category>
<!-- We can also return more than one row -->
<category>
<pattern>WHICH ANIMALS SAY *</pattern>
<template>
<think>
<set name="searchfor"><star/></set>
<learn>
<category>
<pattern>XCHECKMATCH</pattern>
<template>
<srai>BOTCOMPARE <get name="says"/> XSPLIT <get name="searchfor"/></srai>
<condition name="match">
<li value="YES"><set name="list"><get name="list"/><br/>
<get name="animal"/></set></li>
</condition>
</template>
</category>
</learn>
</think>
<srai>XSCANANIMALDATABASE</srai>
</template>
</category>
<!-- A query to compare 2 values in the table -->
<category>
<pattern>DOES A * HAVE MORE LEGS THAN A *</pattern>
<template>
<think>
<srai>XCHECKANIMAL <star/></srai>
<set name="legs1"><get name="legs"/></set>
<srai>XCHECKANIMAL <star index="2"/></srai>
<set name="legs2"><get name="legs"/></set>
<set name="checklegs"><get name="legs1"/> <get name="legs2"/></set>
</think>
<condition name="checklegs">
<li value="2 2">They both have 2 legs.</li>
<li value="2 4">A <star index="2"/> has more legs.</li>
<li value="2 8">A <star index="2"/> has 4 times as many legs.</li>
<li value="4 2">A <star/> has more legs.</li>
<li value="4 4">They both have 4 legs.</li>
<li value="4 8">A <star index="2"/> has twice as many legs.</li>
<li value="8 2">A <star index="2"/> has 4 times as many legs.</li>
<li value="8 4">A <star/> has twice as many legs.</li>
<li value="8 8">They both have 8 legs.</li>
<li value="UNKNOWN UNKNOWN">Sorry but I have never heard of either of those animals.</li>
<li value="2 UNKNOWN">Well, I have not heard of a <star index="2"/>. However, a <star/> only has 2 legs and so I guess a <star index="2"/> has more legs.</li>
<li value="4 UNKNOWN">Well, I have not heard of a <star index="2"/>. However, a <star/> has 4 legs and so I guess a <star/> has more legs.</li>
<li value="8 UNKNOWN">Well, I have not heard of a <star index="2"/>. However, a <star/> has 8 legs and so I guess a <star/> has more legs.</li>
<li value="UNKNOWN 2">Well, I have not heard of a <star/>. However, a <star index="2"/> only has 2 legs and so I guess a <star/> has more legs.</li>
<li value="UNKNOWN 4">Well, I have not heard of a <star/>. However, a <star index="2"/> has 4 legs and so I guess a <star index="2"/> has more legs.</li>
<li value="UNKNOWN 8">Well, I have not heard of a <star/>. However, a <star index="2"/> has 8 legs and so I guess a <star/> has more legs.</li>
<li>The one that runs fastest probably has more legs.</li>
</condition>
</template>
</category>
</aiml>