@@ -133,6 +133,92 @@ Both are still rule-based systems with no real understanding. The "beliefs" in P
133133
134134---
135135
136+ # How PARRY works: The algorithm
137+
138+ PARRY uses a ** state machine** with emotional variables:
139+
140+ ``` python
141+ class Parry :
142+ def __init__ (self ):
143+ self .anger = 5 # 0-20 scale
144+ self .fear = 8 # 0-20 scale
145+ self .mistrust = 10 # 0-15 scale
146+ ```
147+
148+ <div class =" note-box " data-title =" Processing steps " >
149+
150+ 1 . ** Match pattern** against input (like ELIZA)
151+ 2 . ** Update emotional state** based on topic
152+ 3 . ** Select response** influenced by anger/fear/mistrust levels
153+ 4 . ** Apply threshold rules** for extreme reactions
154+
155+ </div >
156+
157+ ---
158+ <!-- _class: scale-78 -->
159+
160+ # PARRY example: Step by step
161+
162+ ** Input:** "Tell me about the mafia"
163+
164+ <div style =" display : flex ; gap : 1em ;" >
165+ <div style =" flex : 1 ;" >
166+
167+ ** Step 1: Pattern Match**
168+ ```
169+ /\b(mafia|mob)\b/i → MATCH
170+ ```
171+
172+ ** Step 2: Emotional Update**
173+ ```
174+ fear += 4 → 8 → 12
175+ anger += 3 → 5 → 8
176+ mistrust += 3 → 10 → 13
177+ ```
178+
179+ </div >
180+ <div style =" flex : 1 ;" >
181+
182+ ** Step 3: Response Selection**
183+ High fear + high mistrust triggers paranoid responses:
184+
185+ ```
186+ "You know, they have their
187+ ways of getting to you."
188+ ```
189+
190+ ** Step 4: State Carried Forward**
191+ Next input processed with elevated emotional levels.
192+
193+ </div >
194+ </div >
195+
196+ ---
197+
198+ # PARRY's emotional dynamics
199+
200+ ```
201+ Low emotions → Cooperative responses
202+ "I used to gamble on horses."
203+ "I've been feeling tense."
204+
205+ Medium emotions → Guarded responses
206+ "I don't want to talk about that."
207+ "Why are you asking me this?"
208+
209+ High emotions → Paranoid/hostile responses
210+ "Are you one of THEM?"
211+ "You're trying to trick me!"
212+ ```
213+
214+ <div class =" warning-box " data-title =" Key insight " >
215+
216+ The emotional state creates ** coherent behavior over time** . ELIZA has no memory; PARRY's responses depend on conversation history.
217+
218+ </div >
219+
220+ ---
221+
136222# The Turing Test, revisited
137223
138224<div class =" note-box " data-title =" A famous experiment " >
@@ -199,6 +285,97 @@ This is the same decomposition/reassembly pattern as ELIZA, just in XML format w
199285
200286</div >
201287
288+ ---
289+ <!-- _class: scale-78 -->
290+
291+ # How ALICE works: The algorithm
292+
293+ ** AIML Processing Steps:**
294+
295+ 1 . ** Normalize input** : "Don't you think so?" → "DO NOT YOU THINK SO"
296+ 2 . ** Find matching pattern** : Search through 40,000+ patterns
297+ 3 . ** Extract wildcards** : ` * ` captures arbitrary text
298+ 4 . ** Process template** : May include conditionals, ` <srai> ` redirects
299+ 5 . ** Generate response** : Substitute captured text
300+
301+ <div class =" note-box " data-title =" Key difference from ELIZA " >
302+
303+ AIML supports ** recursive processing** via ` <srai> ` (Symbolic Reduction AI), allowing patterns to trigger other patterns.
304+
305+ </div >
306+
307+ ---
308+
309+ # ALICE example: Step by step
310+
311+ ** Input:** "My name is John and I like pizza"
312+
313+ <div style =" display : flex ; gap : 1em ;" >
314+ <div style =" flex : 1 ;" >
315+
316+ ** Step 1: Normalization**
317+ ```
318+ MY NAME IS JOHN AND I LIKE PIZZA
319+ ```
320+
321+ ** Step 2: Pattern Search**
322+ ``` xml
323+ <pattern >MY NAME IS *</pattern >
324+ → MATCHES with star = "JOHN AND I LIKE PIZZA"
325+ ```
326+
327+ </div >
328+ <div style =" flex : 1 ;" >
329+
330+ ** Step 3: Template Processing**
331+ ``` xml
332+ <template >
333+ Nice to meet you, <star />.
334+ <think ><set name =" name" >
335+ <star /></set ></think >
336+ </template >
337+ ```
338+
339+ ** Step 4: Response**
340+ "Nice to meet you, JOHN AND I LIKE PIZZA."
341+ (stores name="JOHN AND I LIKE PIZZA")
342+
343+ </div >
344+ </div >
345+
346+ ---
347+
348+ # AIML advanced features
349+
350+ ``` xml
351+ <!-- Symbolic Reduction (SRAI) -->
352+ <category >
353+ <pattern >HI THERE</pattern >
354+ <template ><srai >HELLO</srai ></template >
355+ </category >
356+
357+ <!-- Topic-based context -->
358+ <topic name =" MOVIES" >
359+ <category >
360+ <pattern >WHAT DO YOU LIKE</pattern >
361+ <template >I enjoy science fiction films.</template >
362+ </category >
363+ </topic >
364+
365+ <!-- That-based context (previous bot response) -->
366+ <category >
367+ <pattern >YES</pattern >
368+ <that >DO YOU LIKE MOVIES</that >
369+ <template >What is your favorite movie?</template >
370+ </category >
371+ ```
372+
373+ <div class =" warning-box " data-title =" Still rule-based " >
374+
375+ Despite these features, ALICE cannot generalize beyond its patterns. 40,000 rules still miss infinite valid inputs.
376+
377+ </div >
378+
202379---
203380
204381# Live demo
0 commit comments