comparison lisp/play/doctor.el @ 47367:d8c0258cdf14

2002-09-10 Deepak Goel <deego@glue.umd.edu> * play/doctor.el (doc//): Rename from `//'. Update callers. (doc$): Rename from `$'. Update callers.
author John Paul Wallington <jpw@pobox.com>
date Tue, 10 Sep 2002 05:48:44 +0000
parents 8a11a2109567
children 73e46b26325e
comparison
equal deleted inserted replaced
47366:32c66a092ce6 47367:d8c0258cdf14
43 ;; for a discussion of why and how this file was censored, and the 43 ;; for a discussion of why and how this file was censored, and the
44 ;; political implications of the issue. 44 ;; political implications of the issue.
45 45
46 ;;; Code: 46 ;;; Code:
47 47
48 (defun // (x) x) 48 (defun doc// (x) x)
49 49
50 (defmacro $ (what) 50 (defmacro doc$ (what)
51 "quoted arg form of doctor-$" 51 "quoted arg form of doctor-$"
52 (list 'doctor-$ (list 'quote what))) 52 (list 'doctor-$ (list 'quote what)))
53 53
54 (defun doctor-$ (what) 54 (defun doctor-$ (what)
55 "Return the car of a list, rotating the list each time" 55 "Return the car of a list, rotating the list each time"
77 (use-local-map doctor-mode-map) 77 (use-local-map doctor-mode-map)
78 (setq major-mode 'doctor-mode) 78 (setq major-mode 'doctor-mode)
79 (setq mode-name "Doctor") 79 (setq mode-name "Doctor")
80 (turn-on-auto-fill) 80 (turn-on-auto-fill)
81 (doctor-type '(i am the psychotherapist \. 81 (doctor-type '(i am the psychotherapist \.
82 ($ please) ($ describe) your ($ problems) \. 82 (doc$ please) (doc$ describe) your (doc$ problems) \.
83 each time you are finished talking, type \R\E\T twice \.)) 83 each time you are finished talking, type \R\E\T twice \.))
84 (insert "\n")) 84 (insert "\n"))
85 85
86 (defun make-doctor-variables () 86 (defun make-doctor-variables ()
87 (make-local-variable 'typos) 87 (make-local-variable 'typos)
130 (something you remember about) 130 (something you remember about)
131 (your feelings toward) 131 (your feelings toward)
132 (some experiences you have had with) 132 (some experiences you have had with)
133 (how you feel about))) 133 (how you feel about)))
134 (make-local-variable 'fears) 134 (make-local-variable 'fears)
135 (setq fears '( (($ whysay) you are ($ afraidof) (// feared) \?) 135 (setq fears '( ((doc$ whysay) you are (doc$ afraidof) (doc// feared) \?)
136 (you seem terrified by (// feared) \.) 136 (you seem terrified by (doc// feared) \.)
137 (when did you first feel ($ afraidof) (// feared) \?) )) 137 (when did you first feel (doc$ afraidof) (doc// feared) \?) ))
138 (make-local-variable 'sure) 138 (make-local-variable 'sure)
139 (setq sure '((sure)(positive)(certain)(absolutely sure))) 139 (setq sure '((sure)(positive)(certain)(absolutely sure)))
140 (make-local-variable 'afraidof) 140 (make-local-variable 'afraidof)
141 (setq afraidof '( (afraid of) (frightened by) (scared of) )) 141 (setq afraidof '( (afraid of) (frightened by) (scared of) ))
142 (make-local-variable 'areyou) 142 (make-local-variable 'areyou)
147 (make-local-variable 'arerelated) 147 (make-local-variable 'arerelated)
148 (setq arerelated '((have something to do with)(are related to) 148 (setq arerelated '((have something to do with)(are related to)
149 (could have caused)(could be the reason for) (are caused by) 149 (could have caused)(could be the reason for) (are caused by)
150 (are because of))) 150 (are because of)))
151 (make-local-variable 'moods) 151 (make-local-variable 'moods)
152 (setq moods '( (($ areyou)(// found) often \?) 152 (setq moods '( ((doc$ areyou)(doc// found) often \?)
153 (what causes you to be (// found) \?) 153 (what causes you to be (doc// found) \?)
154 (($ whysay) you are (// found) \?) )) 154 ((doc$ whysay) you are (doc// found) \?) ))
155 (make-local-variable 'maybe) 155 (make-local-variable 'maybe)
156 (setq maybe 156 (setq maybe
157 '((maybe) 157 '((maybe)
158 (perhaps) 158 (perhaps)
159 (possibly))) 159 (possibly)))
164 (make-local-variable 'hello) 164 (make-local-variable 'hello)
165 (setq hello 165 (setq hello
166 '((how do you do \?) (hello \.) (howdy!) (hello \.) (hi \.) (hi there \.))) 166 '((how do you do \?) (hello \.) (howdy!) (hello \.) (hi \.) (hi there \.)))
167 (make-local-variable 'drnk) 167 (make-local-variable 'drnk)
168 (setq drnk 168 (setq drnk
169 '((do you drink a lot of (// found) \?) 169 '((do you drink a lot of (doc// found) \?)
170 (do you get drunk often \?) 170 (do you get drunk often \?)
171 (($ describe) your drinking habits \.) )) 171 ((doc$ describe) your drinking habits \.) ))
172 (make-local-variable 'drugs) 172 (make-local-variable 'drugs)
173 (setq drugs '( (do you use (// found) often \?)(($ areyou) 173 (setq drugs '( (do you use (doc// found) often \?)((doc$ areyou)
174 addicted to (// found) \?)(do you realize that drugs can 174 addicted to (doc// found) \?)(do you realize that drugs can
175 be very harmful \?)(($ maybe) you should try to quit using (// found) 175 be very harmful \?)((doc$ maybe) you should try to quit using (doc// found)
176 \.))) 176 \.)))
177 (make-local-variable 'whywant) 177 (make-local-variable 'whywant)
178 (setq whywant '( (($ whysay) (// subj) might ($ want) (// obj) \?) 178 (setq whywant '( ((doc$ whysay) (doc// subj) might (doc$ want) (doc// obj) \?)
179 (how does it feel to want \?) 179 (how does it feel to want \?)
180 (why should (// subj) get (// obj) \?) 180 (why should (doc// subj) get (doc// obj) \?)
181 (when did (// subj) first ($ want) (// obj) \?) 181 (when did (doc// subj) first (doc$ want) (doc// obj) \?)
182 (($ areyou) obsessed with (// obj) \?) 182 ((doc$ areyou) obsessed with (doc// obj) \?)
183 (why should i give (// obj) to (// subj) \?) 183 (why should i give (doc// obj) to (doc// subj) \?)
184 (have you ever gotten (// obj) \?) )) 184 (have you ever gotten (doc// obj) \?) ))
185 (make-local-variable 'canyou) 185 (make-local-variable 'canyou)
186 (setq canyou '((of course i can \.) 186 (setq canyou '((of course i can \.)
187 (why should i \?) 187 (why should i \?)
188 (what makes you think i would even want to \?) 188 (what makes you think i would even want to \?)
189 (i am the doctor\, i can do anything i damn please \.) 189 (i am the doctor\, i can do anything i damn please \.)
196 (make-local-variable 'want) 196 (make-local-variable 'want)
197 (setq want '( (want) (desire) (wish) (want) (hope) )) 197 (setq want '( (want) (desire) (wish) (want) (hope) ))
198 (make-local-variable 'shortlst) 198 (make-local-variable 'shortlst)
199 (setq shortlst 199 (setq shortlst
200 '((can you elaborate on that \?) 200 '((can you elaborate on that \?)
201 (($ please) continue \.) 201 ((doc$ please) continue \.)
202 (go on\, don\'t be afraid \.) 202 (go on\, don\'t be afraid \.)
203 (i need a little more detail please \.) 203 (i need a little more detail please \.)
204 (you\'re being a bit brief\, ($ please) go into detail \.) 204 (you\'re being a bit brief\, (doc$ please) go into detail \.)
205 (can you be more explicit \?) 205 (can you be more explicit \?)
206 (and \?) 206 (and \?)
207 (($ please) go into more detail \?) 207 ((doc$ please) go into more detail \?)
208 (you aren\'t being very talkative today\!) 208 (you aren\'t being very talkative today\!)
209 (is that all there is to it \?) 209 (is that all there is to it \?)
210 (why must you respond so briefly \?))) 210 (why must you respond so briefly \?)))
211 211
212 (make-local-variable 'famlst) 212 (make-local-variable 'famlst)
213 (setq famlst 213 (setq famlst
214 '((tell me ($ something) about (// owner) family \.) 214 '((tell me (doc$ something) about (doc// owner) family \.)
215 (you seem to dwell on (// owner) family \.) 215 (you seem to dwell on (doc// owner) family \.)
216 (($ areyou) hung up on (// owner) family \?))) 216 ((doc$ areyou) hung up on (doc// owner) family \?)))
217 (make-local-variable 'huhlst) 217 (make-local-variable 'huhlst)
218 (setq huhlst 218 (setq huhlst
219 '((($ whysay)(// sent) \?) 219 '(((doc$ whysay)(doc// sent) \?)
220 (is it because of ($ things) that you say (// sent) \?) )) 220 (is it because of (doc$ things) that you say (doc// sent) \?) ))
221 (make-local-variable 'longhuhlst) 221 (make-local-variable 'longhuhlst)
222 (setq longhuhlst 222 (setq longhuhlst
223 '((($ whysay) that \?) 223 '(((doc$ whysay) that \?)
224 (i don\'t understand \.) 224 (i don\'t understand \.)
225 (($ thlst)) 225 ((doc$ thlst))
226 (($ areyou) ($ afraidof) that \?))) 226 ((doc$ areyou) (doc$ afraidof) that \?)))
227 (make-local-variable 'feelings-about) 227 (make-local-variable 'feelings-about)
228 (setq feelings-about 228 (setq feelings-about
229 '((feelings about) 229 '((feelings about)
230 (apprehensions toward) 230 (apprehensions toward)
231 (thoughts on) 231 (thoughts on)
323 (did you ever regret) 323 (did you ever regret)
324 (are you sorry) 324 (are you sorry)
325 (are you satisfied with the fact that))) 325 (are you satisfied with the fact that)))
326 (make-local-variable 'machlst) 326 (make-local-variable 'machlst)
327 (setq machlst 327 (setq machlst
328 '((you have your mind on (// found) \, it seems \.) 328 '((you have your mind on (doc// found) \, it seems \.)
329 (you think too much about (// found) \.) 329 (you think too much about (doc// found) \.)
330 (you should try taking your mind off of (// found)\.) 330 (you should try taking your mind off of (doc// found)\.)
331 (are you a computer hacker \?))) 331 (are you a computer hacker \?)))
332 (make-local-variable 'qlist) 332 (make-local-variable 'qlist)
333 (setq qlist 333 (setq qlist
334 '((what do you think \?) 334 '((what do you think \?)
335 (i\'ll ask the questions\, if you don\'t mind!) 335 (i\'ll ask the questions\, if you don\'t mind!)
336 (i could ask the same thing myself \.) 336 (i could ask the same thing myself \.)
337 (($ please) allow me to do the questioning \.) 337 ((doc$ please) allow me to do the questioning \.)
338 (i have asked myself that question many times \.) 338 (i have asked myself that question many times \.)
339 (($ please) try to answer that question yourself \.))) 339 ((doc$ please) try to answer that question yourself \.)))
340 (make-local-variable 'foullst) 340 (make-local-variable 'foullst)
341 (setq foullst 341 (setq foullst
342 '((($ please) watch your tongue!) 342 '(((doc$ please) watch your tongue!)
343 (($ please) avoid such unwholesome thoughts \.) 343 ((doc$ please) avoid such unwholesome thoughts \.)
344 (($ please) get your mind out of the gutter \.) 344 ((doc$ please) get your mind out of the gutter \.)
345 (such lewdness is not appreciated \.))) 345 (such lewdness is not appreciated \.)))
346 (make-local-variable 'deathlst) 346 (make-local-variable 'deathlst)
347 (setq deathlst 347 (setq deathlst
348 '((this is not a healthy way of thinking \.) 348 '((this is not a healthy way of thinking \.)
349 (($ bother) you\, too\, may die someday \?) 349 ((doc$ bother) you\, too\, may die someday \?)
350 (i am worried by your obsession with this topic!) 350 (i am worried by your obsession with this topic!)
351 (did you watch a lot of crime and violence on television as a child \?)) 351 (did you watch a lot of crime and violence on television as a child \?))
352 ) 352 )
353 (make-local-variable 'sexlst) 353 (make-local-variable 'sexlst)
354 (setq sexlst 354 (setq sexlst
355 '((($ areyou) ($ afraidof) sex \?) 355 '(((doc$ areyou) (doc$ afraidof) sex \?)
356 (($ describe)($ something) about your sexual history \.) 356 ((doc$ describe)(doc$ something) about your sexual history \.)
357 (($ please)($ describe) your sex life \.\.\.) 357 ((doc$ please)(doc$ describe) your sex life \.\.\.)
358 (($ describe) your ($ feelings-about) your sexual partner \.) 358 ((doc$ describe) your (doc$ feelings-about) your sexual partner \.)
359 (($ describe) your most ($ random-adjective) sexual experience \.) 359 ((doc$ describe) your most (doc$ random-adjective) sexual experience \.)
360 (($ areyou) satisfied with (// lover) \.\.\. \?))) 360 ((doc$ areyou) satisfied with (doc// lover) \.\.\. \?)))
361 (make-local-variable 'neglst) 361 (make-local-variable 'neglst)
362 (setq neglst 362 (setq neglst
363 '((why not \?) 363 '((why not \?)
364 (($ bother) i ask that \?) 364 ((doc$ bother) i ask that \?)
365 (why not \?) 365 (why not \?)
366 (why not \?) 366 (why not \?)
367 (how come \?) 367 (how come \?)
368 (($ bother) i ask that \?))) 368 ((doc$ bother) i ask that \?)))
369 (make-local-variable 'beclst) 369 (make-local-variable 'beclst)
370 (setq beclst '( 370 (setq beclst '(
371 (is it because (// sent) that you came to me \?) 371 (is it because (doc// sent) that you came to me \?)
372 (($ bother)(// sent) \?) 372 ((doc$ bother)(doc// sent) \?)
373 (when did you first know that (// sent) \?) 373 (when did you first know that (doc// sent) \?)
374 (is the fact that (// sent) the real reason \?) 374 (is the fact that (doc// sent) the real reason \?)
375 (does the fact that (// sent) explain anything else \?) 375 (does the fact that (doc// sent) explain anything else \?)
376 (($ areyou)($ sure)(// sent) \? ) )) 376 ((doc$ areyou)(doc$ sure)(doc// sent) \? ) ))
377 (make-local-variable 'shortbeclst) 377 (make-local-variable 'shortbeclst)
378 (setq shortbeclst '( 378 (setq shortbeclst '(
379 (($ bother) i ask you that \?) 379 ((doc$ bother) i ask you that \?)
380 (that\'s not much of an answer!) 380 (that\'s not much of an answer!)
381 (($ inter) why won\'t you talk about it \?) 381 ((doc$ inter) why won\'t you talk about it \?)
382 (speak up!) 382 (speak up!)
383 (($ areyou) ($ afraidof) talking about it \?) 383 ((doc$ areyou) (doc$ afraidof) talking about it \?)
384 (don\'t be ($ afraidof) elaborating \.) 384 (don\'t be (doc$ afraidof) elaborating \.)
385 (($ please) go into more detail \.))) 385 ((doc$ please) go into more detail \.)))
386 (make-local-variable 'thlst) 386 (make-local-variable 'thlst)
387 (setq thlst '( 387 (setq thlst '(
388 (($ maybe)($ things)($ arerelated) this \.) 388 ((doc$ maybe)(doc$ things)(doc$ arerelated) this \.)
389 (is it because of ($ things) that you are going through all this \?) 389 (is it because of (doc$ things) that you are going through all this \?)
390 (how do you reconcile ($ things) \? ) 390 (how do you reconcile (doc$ things) \? )
391 (($ maybe) this ($ isrelated)($ things) \?) )) 391 ((doc$ maybe) this (doc$ isrelated)(doc$ things) \?) ))
392 (make-local-variable 'remlst) 392 (make-local-variable 'remlst)
393 (setq remlst '( (earlier you said ($ history) \?) 393 (setq remlst '( (earlier you said (doc$ history) \?)
394 (you mentioned that ($ history) \?) 394 (you mentioned that (doc$ history) \?)
395 (($ whysay)($ history) \? ) )) 395 ((doc$ whysay)(doc$ history) \? ) ))
396 (make-local-variable 'toklst) 396 (make-local-variable 'toklst)
397 (setq toklst 397 (setq toklst
398 '((is this how you relax \?) 398 '((is this how you relax \?)
399 (how long have you been smoking grass \?) 399 (how long have you been smoking grass \?)
400 (($ areyou) ($ afraidof) of being drawn to using harder stuff \?))) 400 ((doc$ areyou) (doc$ afraidof) of being drawn to using harder stuff \?)))
401 (make-local-variable 'states) 401 (make-local-variable 'states)
402 (setq states 402 (setq states
403 '((do you get (// found) often \?) 403 '((do you get (doc// found) often \?)
404 (do you enjoy being (// found) \?) 404 (do you enjoy being (doc// found) \?)
405 (what makes you (// found) \?) 405 (what makes you (doc// found) \?)
406 (how often ($ areyou)(// found) \?) 406 (how often (doc$ areyou)(doc// found) \?)
407 (when were you last (// found) \?))) 407 (when were you last (doc// found) \?)))
408 (make-local-variable 'replist) 408 (make-local-variable 'replist)
409 (setq replist 409 (setq replist
410 '((i . (you)) 410 '((i . (you))
411 (my . (your)) 411 (my . (your))
412 (me . (you)) 412 (me . (you))
456 (wouldn\'t . (would not)) 456 (wouldn\'t . (would not))
457 (won\'t . (will not)) 457 (won\'t . (will not))
458 (hasn\'t . (has not)))) 458 (hasn\'t . (has not))))
459 (make-local-variable 'stallmanlst) 459 (make-local-variable 'stallmanlst)
460 (setq stallmanlst '( 460 (setq stallmanlst '(
461 (($ describe) your ($ feelings-about) him \.) 461 ((doc$ describe) your (doc$ feelings-about) him \.)
462 (($ areyou) a friend of Stallman \?) 462 ((doc$ areyou) a friend of Stallman \?)
463 (($ bother) Stallman is ($ random-adjective) \?) 463 ((doc$ bother) Stallman is (doc$ random-adjective) \?)
464 (($ ibelieve) you are ($ afraidof) him \.))) 464 ((doc$ ibelieve) you are (doc$ afraidof) him \.)))
465 (make-local-variable 'schoollst) 465 (make-local-variable 'schoollst)
466 (setq schoollst '( 466 (setq schoollst '(
467 (($ describe) your (// found) \.) 467 ((doc$ describe) your (doc// found) \.)
468 (($ bother) your grades could ($ improve) \?) 468 ((doc$ bother) your grades could (doc$ improve) \?)
469 (($ areyou) ($ afraidof) (// found) \?) 469 ((doc$ areyou) (doc$ afraidof) (doc// found) \?)
470 (($ maybe) this ($ isrelated) to your attitude \.) 470 ((doc$ maybe) this (doc$ isrelated) to your attitude \.)
471 (($ areyou) absent often \?) 471 ((doc$ areyou) absent often \?)
472 (($ maybe) you should study ($ something) \.))) 472 ((doc$ maybe) you should study (doc$ something) \.)))
473 (make-local-variable 'improve) 473 (make-local-variable 'improve)
474 (setq improve '((improve) (be better) (be improved) (be higher))) 474 (setq improve '((improve) (be better) (be improved) (be higher)))
475 (make-local-variable 'elizalst) 475 (make-local-variable 'elizalst)
476 (setq elizalst '( 476 (setq elizalst '(
477 (($ areyou) ($ sure) \?) 477 ((doc$ areyou) (doc$ sure) \?)
478 (($ ibelieve) you have ($ problems) with (// found) \.) 478 ((doc$ ibelieve) you have (doc$ problems) with (doc// found) \.)
479 (($ whysay) (// sent) \?))) 479 ((doc$ whysay) (doc// sent) \?)))
480 (make-local-variable 'sportslst) 480 (make-local-variable 'sportslst)
481 (setq sportslst '( 481 (setq sportslst '(
482 (tell me ($ something) about (// found) \.) 482 (tell me (doc$ something) about (doc// found) \.)
483 (($ describe) ($ relation) (// found) \.) 483 ((doc$ describe) (doc$ relation) (doc// found) \.)
484 (do you find (// found) ($ random-adjective) \?))) 484 (do you find (doc// found) (doc$ random-adjective) \?)))
485 (make-local-variable 'mathlst) 485 (make-local-variable 'mathlst)
486 (setq mathlst '( 486 (setq mathlst '(
487 (($ describe) ($ something) about math \.) 487 ((doc$ describe) (doc$ something) about math \.)
488 (($ maybe) your ($ problems) ($ arerelated) (// found) \.) 488 ((doc$ maybe) your (doc$ problems) (doc$ arerelated) (doc// found) \.)
489 (i don\'t know much (// found) \, but ($ continue) 489 (i don\'t know much (doc// found) \, but (doc$ continue)
490 anyway \.))) 490 anyway \.)))
491 (make-local-variable 'zippylst) 491 (make-local-variable 'zippylst)
492 (setq zippylst '( 492 (setq zippylst '(
493 (($ areyou) Zippy \?) 493 ((doc$ areyou) Zippy \?)
494 (($ ibelieve) you have some serious ($ problems) \.) 494 ((doc$ ibelieve) you have some serious (doc$ problems) \.)
495 (($ bother) you are a pinhead \?))) 495 ((doc$ bother) you are a pinhead \?)))
496 (make-local-variable 'chatlst) 496 (make-local-variable 'chatlst)
497 (setq chatlst '( 497 (setq chatlst '(
498 (($ maybe) we could chat \.) 498 ((doc$ maybe) we could chat \.)
499 (($ please) ($ describe) ($ something) about chat mode \.) 499 ((doc$ please) (doc$ describe) (doc$ something) about chat mode \.)
500 (($ bother) our discussion is so ($ random-adjective) \?))) 500 ((doc$ bother) our discussion is so (doc$ random-adjective) \?)))
501 (make-local-variable 'abuselst) 501 (make-local-variable 'abuselst)
502 (setq abuselst '( 502 (setq abuselst '(
503 (($ please) try to be less abusive \.) 503 ((doc$ please) try to be less abusive \.)
504 (($ describe) why you call me (// found) \.) 504 ((doc$ describe) why you call me (doc// found) \.)
505 (i\'ve had enough of you!))) 505 (i\'ve had enough of you!)))
506 (make-local-variable 'abusewords) 506 (make-local-variable 'abusewords)
507 (setq abusewords '(boring bozo clown clumsy cretin dumb dummy 507 (setq abusewords '(boring bozo clown clumsy cretin dumb dummy
508 fool foolish gnerd gnurd idiot jerk 508 fool foolish gnerd gnurd idiot jerk
509 lose loser louse lousy luse luser 509 lose loser louse lousy luse luser
876 ;; Main processing function for sentences that have been read. 876 ;; Main processing function for sentences that have been read.
877 877
878 (defun doctor-doc (sent) 878 (defun doctor-doc (sent)
879 (cond 879 (cond
880 ((equal sent '(foo)) 880 ((equal sent '(foo))
881 (doctor-type '(bar! ($ please)($ continue) \.))) 881 (doctor-type '(bar! (doc$ please)(doc$ continue) \.)))
882 ((member sent howareyoulst) 882 ((member sent howareyoulst)
883 (doctor-type '(i\'m ok \. ($ describe) yourself \.))) 883 (doctor-type '(i\'m ok \. (doc$ describe) yourself \.)))
884 ((or (member sent '((good bye) (see you later) (i quit) (so long) 884 ((or (member sent '((good bye) (see you later) (i quit) (so long)
885 (go away) (get lost))) 885 (go away) (get lost)))
886 (memq (car sent) 886 (memq (car sent)
887 '(bye halt break quit done exit goodbye 887 '(bye halt break quit done exit goodbye
888 bye\, stop pause goodbye\, stop pause))) 888 bye\, stop pause goodbye\, stop pause)))
889 (doctor-type ($ bye))) 889 (doctor-type (doc$ bye)))
890 ((and (eq (car sent) 'you) 890 ((and (eq (car sent) 'you)
891 (memq (cadr sent) abusewords)) 891 (memq (cadr sent) abusewords))
892 (setq found (cadr sent)) 892 (setq found (cadr sent))
893 (doctor-type ($ abuselst))) 893 (doctor-type (doc$ abuselst)))
894 ((eq (car sent) 'whatmeans) 894 ((eq (car sent) 'whatmeans)
895 (doctor-def (cadr sent))) 895 (doctor-def (cadr sent)))
896 ((equal sent '(parse)) 896 ((equal sent '(parse))
897 (doctor-type (list 'subj '= subj ", " 897 (doctor-type (list 'subj '= subj ", "
898 'verb '= verb "\n" 898 'verb '= verb "\n"
902 ", " 902 ", "
903 'most 'recent 'possessive 903 'most 'recent 'possessive
904 'is owner "\n" 904 'is owner "\n"
905 'sentence 'used 'was 905 'sentence 'used 'was
906 "..." 906 "..."
907 '(// bak)))) 907 '(doc// bak))))
908 ((memq (car sent) '(do has have how when where who why)) 908 ((memq (car sent) '(do has have how when where who why))
909 (doctor-type ($ qlist))) 909 (doctor-type (doc$ qlist)))
910 ;; ((eq (car sent) 'forget) 910 ;; ((eq (car sent) 'forget)
911 ;; (set (cadr sent) nil) 911 ;; (set (cadr sent) nil)
912 ;; (doctor-type '(($ isee)($ please) 912 ;; (doctor-type '((doc$ isee)(doc$ please)
913 ;; ($ continue)\.))) 913 ;; (doc$ continue)\.)))
914 (t 914 (t
915 (if (doctor-defq sent) (doctor-define sent found)) 915 (if (doctor-defq sent) (doctor-define sent found))
916 (if (> (length sent) 12)(setq sent (doctor-shorten sent))) 916 (if (> (length sent) 12)(setq sent (doctor-shorten sent)))
917 (setq sent (doctor-correct-spelling (doctor-replace sent replist))) 917 (setq sent (doctor-correct-spelling (doctor-replace sent replist)))
918 (cond ((and (not (memq 'me sent))(not (memq 'i sent)) 918 (cond ((and (not (memq 'me sent))(not (memq 'i sent))
927 (if (memq 'am sent) 927 (if (memq 'am sent)
928 (setq sent (doctor-replace sent '((me . (i)))))) 928 (setq sent (doctor-replace sent '((me . (i))))))
929 (setq sent (doctor-fixup sent)) 929 (setq sent (doctor-fixup sent))
930 (if (and (eq (car sent) 'do) (eq (cadr sent) 'not)) 930 (if (and (eq (car sent) 'do) (eq (cadr sent) 'not))
931 (cond ((zerop (random 3)) 931 (cond ((zerop (random 3))
932 (doctor-type '(are you ($ afraidof) that \?))) 932 (doctor-type '(are you (doc$ afraidof) that \?)))
933 ((zerop (random 2)) 933 ((zerop (random 2))
934 (doctor-type '(don\'t tell me what to do \. i am the 934 (doctor-type '(don\'t tell me what to do \. i am the
935 psychiatrist here!)) 935 psychiatrist here!))
936 (doctor-rthing)) 936 (doctor-rthing))
937 (t 937 (t
938 (doctor-type '(($ whysay) that i shouldn\'t 938 (doctor-type '((doc$ whysay) that i shouldn\'t
939 (cddr sent) 939 (cddr sent)
940 \?)))) 940 \?))))
941 (doctor-go (doctor-wherego sent)))))))) 941 (doctor-go (doctor-wherego sent))))))))
942 942
943 ;; Things done to process sentences once read. 943 ;; Things done to process sentences once read.
1315 (cdr (or (assq x rlist) ; either find a replacement 1315 (cdr (or (assq x rlist) ; either find a replacement
1316 (list x x))))) ; or fake an identity mapping 1316 (list x x))))) ; or fake an identity mapping
1317 sent))) 1317 sent)))
1318 1318
1319 (defun doctor-wherego (sent) 1319 (defun doctor-wherego (sent)
1320 (cond ((null sent)($ whereoutp)) 1320 (cond ((null sent)(doc$ whereoutp))
1321 ((null (doctor-meaning (car sent))) 1321 ((null (doctor-meaning (car sent)))
1322 (doctor-wherego (cond ((zerop (random 2)) 1322 (doctor-wherego (cond ((zerop (random 2))
1323 (reverse (cdr sent))) 1323 (reverse (cdr sent)))
1324 (t (cdr sent))))) 1324 (t (cdr sent)))))
1325 (t 1325 (t
1417 (defun doctor-go (destination) 1417 (defun doctor-go (destination)
1418 "Call a `doctor-*' function." 1418 "Call a `doctor-*' function."
1419 (funcall (intern (concat "doctor-" (doctor-make-string destination))))) 1419 (funcall (intern (concat "doctor-" (doctor-make-string destination)))))
1420 1420
1421 (defun doctor-desire1 () 1421 (defun doctor-desire1 ()
1422 (doctor-go ($ whereoutp))) 1422 (doctor-go (doc$ whereoutp)))
1423 1423
1424 (defun doctor-huh () 1424 (defun doctor-huh ()
1425 (cond ((< (length sent) 9) (doctor-type ($ huhlst))) 1425 (cond ((< (length sent) 9) (doctor-type (doc$ huhlst)))
1426 (t (doctor-type ($ longhuhlst))))) 1426 (t (doctor-type (doc$ longhuhlst)))))
1427 1427
1428 (defun doctor-rthing () (doctor-type ($ thlst))) 1428 (defun doctor-rthing () (doctor-type (doc$ thlst)))
1429 1429
1430 (defun doctor-remem () (cond ((null history)(doctor-huh)) 1430 (defun doctor-remem () (cond ((null history)(doctor-huh))
1431 ((doctor-type ($ remlst))))) 1431 ((doctor-type (doc$ remlst)))))
1432 1432
1433 (defun doctor-howdy () 1433 (defun doctor-howdy ()
1434 (cond ((not howdyflag) 1434 (cond ((not howdyflag)
1435 (doctor-type '(($ hello) what brings you to see me \?)) 1435 (doctor-type '((doc$ hello) what brings you to see me \?))
1436 (setq howdyflag t)) 1436 (setq howdyflag t))
1437 (t 1437 (t
1438 (doctor-type '(($ ibelieve) we\'ve introduced ourselves already \.)) 1438 (doctor-type '((doc$ ibelieve) we\'ve introduced ourselves already \.))
1439 (doctor-type '(($ please) ($ describe) ($ things) \.))))) 1439 (doctor-type '((doc$ please) (doc$ describe) (doc$ things) \.)))))
1440 1440
1441 (defun doctor-when () 1441 (defun doctor-when ()
1442 (cond ((< (length (memq found sent)) 3)(doctor-short)) 1442 (cond ((< (length (memq found sent)) 3)(doctor-short))
1443 (t 1443 (t
1444 (setq sent (cdr (memq found sent))) 1444 (setq sent (cdr (memq found sent)))
1445 (setq sent (doctor-fixup sent)) 1445 (setq sent (doctor-fixup sent))
1446 (doctor-type '(($ whatwhen)(// sent) \?))))) 1446 (doctor-type '((doc$ whatwhen)(doc// sent) \?)))))
1447 1447
1448 (defun doctor-conj () 1448 (defun doctor-conj ()
1449 (cond ((< (length (memq found sent)) 4)(doctor-short)) 1449 (cond ((< (length (memq found sent)) 4)(doctor-short))
1450 (t 1450 (t
1451 (setq sent (cdr (memq found sent))) 1451 (setq sent (cdr (memq found sent)))
1452 (setq sent (doctor-fixup sent)) 1452 (setq sent (doctor-fixup sent))
1453 (cond ((eq (car sent) 'of) 1453 (cond ((eq (car sent) 'of)
1454 (doctor-type '(are you ($ sure) that is the real reason \?)) 1454 (doctor-type '(are you (doc$ sure) that is the real reason \?))
1455 (setq things (cons (cdr sent) things))) 1455 (setq things (cons (cdr sent) things)))
1456 (t 1456 (t
1457 (doctor-remember sent) 1457 (doctor-remember sent)
1458 (doctor-type ($ beclst))))))) 1458 (doctor-type (doc$ beclst)))))))
1459 1459
1460 (defun doctor-short () 1460 (defun doctor-short ()
1461 (cond ((= (car repetitive-shortness) (1- lincount)) 1461 (cond ((= (car repetitive-shortness) (1- lincount))
1462 (rplacd repetitive-shortness 1462 (rplacd repetitive-shortness
1463 (1+ (cdr repetitive-shortness)))) 1463 (1+ (cdr repetitive-shortness))))
1464 (t 1464 (t
1465 (rplacd repetitive-shortness 1))) 1465 (rplacd repetitive-shortness 1)))
1466 (rplaca repetitive-shortness lincount) 1466 (rplaca repetitive-shortness lincount)
1467 (cond ((> (cdr repetitive-shortness) 6) 1467 (cond ((> (cdr repetitive-shortness) 6)
1468 (cond ((not **mad**) 1468 (cond ((not **mad**)
1469 (doctor-type '(($ areyou) 1469 (doctor-type '((doc$ areyou)
1470 just trying to see what kind of things 1470 just trying to see what kind of things
1471 i have in my vocabulary \? please try to 1471 i have in my vocabulary \? please try to
1472 carry on a reasonable conversation!)) 1472 carry on a reasonable conversation!))
1473 (setq **mad** t)) 1473 (setq **mad** t))
1474 (t 1474 (t
1475 (doctor-type '(i give up \. you need a lesson in creative 1475 (doctor-type '(i give up \. you need a lesson in creative
1476 writing \.\.\.)) 1476 writing \.\.\.))
1477 ))) 1477 )))
1478 (t 1478 (t
1479 (cond ((equal sent (doctor-assm '(yes))) 1479 (cond ((equal sent (doctor-assm '(yes)))
1480 (doctor-type '(($ isee) ($ inter) ($ whysay) this is so \?))) 1480 (doctor-type '((doc$ isee) (doc$ inter) (doc$ whysay) this is so \?)))
1481 ((equal sent (doctor-assm '(because))) 1481 ((equal sent (doctor-assm '(because)))
1482 (doctor-type ($ shortbeclst))) 1482 (doctor-type (doc$ shortbeclst)))
1483 ((equal sent (doctor-assm '(no))) 1483 ((equal sent (doctor-assm '(no)))
1484 (doctor-type ($ neglst))) 1484 (doctor-type (doc$ neglst)))
1485 (t (doctor-type ($ shortlst))))))) 1485 (t (doctor-type (doc$ shortlst)))))))
1486 1486
1487 (defun doctor-alcohol () (doctor-type ($ drnk))) 1487 (defun doctor-alcohol () (doctor-type (doc$ drnk)))
1488 1488
1489 (defun doctor-desire () 1489 (defun doctor-desire ()
1490 (let ((foo (memq found sent))) 1490 (let ((foo (memq found sent)))
1491 (cond ((< (length foo) 2) 1491 (cond ((< (length foo) 2)
1492 (doctor-go (doctor-build (doctor-meaning found) 1))) 1492 (doctor-go (doctor-build (doctor-meaning found) 1)))
1493 ((memq (cadr foo) '(a an)) 1493 ((memq (cadr foo) '(a an))
1494 (rplacd foo (append '(to have) (cdr foo))) 1494 (rplacd foo (append '(to have) (cdr foo)))
1495 (doctor-svo sent found 1 nil) 1495 (doctor-svo sent found 1 nil)
1496 (doctor-remember (list subj 'would 'like obj)) 1496 (doctor-remember (list subj 'would 'like obj))
1497 (doctor-type ($ whywant))) 1497 (doctor-type (doc$ whywant)))
1498 ((not (eq (cadr foo) 'to)) 1498 ((not (eq (cadr foo) 'to))
1499 (doctor-go (doctor-build (doctor-meaning found) 1))) 1499 (doctor-go (doctor-build (doctor-meaning found) 1)))
1500 (t 1500 (t
1501 (doctor-svo sent found 1 nil) 1501 (doctor-svo sent found 1 nil)
1502 (doctor-remember (list subj 'would 'like obj)) 1502 (doctor-remember (list subj 'would 'like obj))
1503 (doctor-type ($ whywant)))))) 1503 (doctor-type (doc$ whywant))))))
1504 1504
1505 (defun doctor-drug () 1505 (defun doctor-drug ()
1506 (doctor-type ($ drugs)) 1506 (doctor-type (doc$ drugs))
1507 (doctor-remember (list 'you 'used found))) 1507 (doctor-remember (list 'you 'used found)))
1508 1508
1509 (defun doctor-toke () 1509 (defun doctor-toke ()
1510 (doctor-type ($ toklst))) 1510 (doctor-type (doc$ toklst)))
1511 1511
1512 (defun doctor-state () 1512 (defun doctor-state ()
1513 (doctor-type ($ states))(doctor-remember (list 'you 'were found))) 1513 (doctor-type (doc$ states))(doctor-remember (list 'you 'were found)))
1514 1514
1515 (defun doctor-mood () 1515 (defun doctor-mood ()
1516 (doctor-type ($ moods))(doctor-remember (list 'you 'felt found))) 1516 (doctor-type (doc$ moods))(doctor-remember (list 'you 'felt found)))
1517 1517
1518 (defun doctor-fear () 1518 (defun doctor-fear ()
1519 (setq feared (doctor-setprep sent found)) 1519 (setq feared (doctor-setprep sent found))
1520 (doctor-type ($ fears)) 1520 (doctor-type (doc$ fears))
1521 (doctor-remember (list 'you 'were 'afraid 'of feared))) 1521 (doctor-remember (list 'you 'were 'afraid 'of feared)))
1522 1522
1523 (defun doctor-hate () 1523 (defun doctor-hate ()
1524 (doctor-svo sent found 1 t) 1524 (doctor-svo sent found 1 t)
1525 (cond ((memq 'not sent) (doctor-forget) (doctor-huh)) 1525 (cond ((memq 'not sent) (doctor-forget) (doctor-huh))
1526 ((equal subj 'you) 1526 ((equal subj 'you)
1527 (doctor-type '(why do you (// verb)(// obj) \?))) 1527 (doctor-type '(why do you (doc// verb)(doc// obj) \?)))
1528 (t (doctor-type '(($ whysay)(list subj verb obj)))))) 1528 (t (doctor-type '((doc$ whysay)(list subj verb obj))))))
1529 1529
1530 (defun doctor-symptoms () 1530 (defun doctor-symptoms ()
1531 (doctor-type '(($ maybe) you should consult a doctor of medicine\, 1531 (doctor-type '((doc$ maybe) you should consult a doctor of medicine\,
1532 i am a psychiatrist \.))) 1532 i am a psychiatrist \.)))
1533 1533
1534 (defun doctor-hates () 1534 (defun doctor-hates ()
1535 (doctor-svo sent found 1 t) 1535 (doctor-svo sent found 1 t)
1536 (doctor-hates1)) 1536 (doctor-hates1))
1537 1537
1538 (defun doctor-hates1 () 1538 (defun doctor-hates1 ()
1539 (doctor-type '(($ whysay)(list subj verb obj) \?))) 1539 (doctor-type '((doc$ whysay)(list subj verb obj) \?)))
1540 1540
1541 (defun doctor-loves () 1541 (defun doctor-loves ()
1542 (doctor-svo sent found 1 t) 1542 (doctor-svo sent found 1 t)
1543 (doctor-qloves)) 1543 (doctor-qloves))
1544 1544
1545 (defun doctor-qloves () 1545 (defun doctor-qloves ()
1546 (doctor-type '(($ bother)(list subj verb obj) \?))) 1546 (doctor-type '((doc$ bother)(list subj verb obj) \?)))
1547 1547
1548 (defun doctor-love () 1548 (defun doctor-love ()
1549 (doctor-svo sent found 1 t) 1549 (doctor-svo sent found 1 t)
1550 (cond ((memq 'not sent) (doctor-forget) (doctor-huh)) 1550 (cond ((memq 'not sent) (doctor-forget) (doctor-huh))
1551 ((memq 'to sent) (doctor-hates1)) 1551 ((memq 'to sent) (doctor-hates1))
1556 (setq lover obj) 1556 (setq lover obj)
1557 (cond ((equal lover '(this person you love)) 1557 (cond ((equal lover '(this person you love))
1558 (setq lover '(your partner)) 1558 (setq lover '(your partner))
1559 (doctor-forget) 1559 (doctor-forget)
1560 (doctor-type '(with whom are you in love \?))) 1560 (doctor-type '(with whom are you in love \?)))
1561 ((doctor-type '(($ please) 1561 ((doctor-type '((doc$ please)
1562 ($ describe) 1562 (doc$ describe)
1563 ($ relation) 1563 (doc$ relation)
1564 (// lover) 1564 (doc// lover)
1565 \.))))) 1565 \.)))))
1566 ((equal subj 'i) 1566 ((equal subj 'i)
1567 (doctor-txtype '(we were discussing you!))) 1567 (doctor-txtype '(we were discussing you!)))
1568 (t (doctor-forget) 1568 (t (doctor-forget)
1569 (setq obj 'someone) 1569 (setq obj 'someone)
1570 (setq verb (doctor-build verb 's)) 1570 (setq verb (doctor-build verb 's))
1571 (doctor-qloves)))))) 1571 (doctor-qloves))))))
1572 1572
1573 (defun doctor-mach () 1573 (defun doctor-mach ()
1574 (setq found (doctor-plural found)) 1574 (setq found (doctor-plural found))
1575 (doctor-type ($ machlst))) 1575 (doctor-type (doc$ machlst)))
1576 1576
1577 (defun doctor-sexnoun () (doctor-sexverb)) 1577 (defun doctor-sexnoun () (doctor-sexverb))
1578 1578
1579 (defun doctor-sexverb () 1579 (defun doctor-sexverb ()
1580 (if (or (memq 'me sent)(memq 'myself sent)(memq 'i sent)) 1580 (if (or (memq 'me sent)(memq 'myself sent)(memq 'i sent))
1581 (doctor-foul) 1581 (doctor-foul)
1582 (doctor-type ($ sexlst)))) 1582 (doctor-type (doc$ sexlst))))
1583 1583
1584 (defun doctor-death () 1584 (defun doctor-death ()
1585 (cond (suicide-flag (doctor-type ($ deathlst))) 1585 (cond (suicide-flag (doctor-type (doc$ deathlst)))
1586 ((or (equal found 'suicide) 1586 ((or (equal found 'suicide)
1587 (and (or (equal found 'kill) 1587 (and (or (equal found 'kill)
1588 (equal found 'killing)) 1588 (equal found 'killing))
1589 (memq 'yourself sent))) 1589 (memq 'yourself sent)))
1590 (setq suicide-flag t) 1590 (setq suicide-flag t)
1592 want to contact the Samaritans via 1592 want to contact the Samaritans via
1593 E-mail: jo@samaritans.org or, at your option, 1593 E-mail: jo@samaritans.org or, at your option,
1594 anonymous E-mail: samaritans@anon.twwells.com\ \. 1594 anonymous E-mail: samaritans@anon.twwells.com\ \.
1595 or find a Befrienders crisis center at 1595 or find a Befrienders crisis center at
1596 http://www.befrienders.org/\ \. 1596 http://www.befrienders.org/\ \.
1597 ($ please) ($ continue) \.))) 1597 (doc$ please) (doc$ continue) \.)))
1598 (t (doctor-type ($ deathlst))))) 1598 (t (doctor-type (doc$ deathlst)))))
1599 1599
1600 (defun doctor-foul () 1600 (defun doctor-foul ()
1601 (doctor-type ($ foullst))) 1601 (doctor-type (doc$ foullst)))
1602 1602
1603 (defun doctor-family () 1603 (defun doctor-family ()
1604 (doctor-possess sent found) 1604 (doctor-possess sent found)
1605 (doctor-type ($ famlst))) 1605 (doctor-type (doc$ famlst)))
1606 1606
1607 ;; I did not add this -- rms. 1607 ;; I did not add this -- rms.
1608 ;; But he might have removed it. I put it back. --roland 1608 ;; But he might have removed it. I put it back. --roland
1609 (defun doctor-rms () 1609 (defun doctor-rms ()
1610 (cond (rms-flag (doctor-type ($ stallmanlst))) 1610 (cond (rms-flag (doctor-type (doc$ stallmanlst)))
1611 (t (setq rms-flag t) (doctor-type '(do you know Stallman \?))))) 1611 (t (setq rms-flag t) (doctor-type '(do you know Stallman \?)))))
1612 1612
1613 (defun doctor-school nil (doctor-type ($ schoollst))) 1613 (defun doctor-school nil (doctor-type (doc$ schoollst)))
1614 1614
1615 (defun doctor-eliza () 1615 (defun doctor-eliza ()
1616 (cond (eliza-flag (doctor-type ($ elizalst))) 1616 (cond (eliza-flag (doctor-type (doc$ elizalst)))
1617 (t (setq eliza-flag t) 1617 (t (setq eliza-flag t)
1618 (doctor-type '((// found) \? hah ! 1618 (doctor-type '((doc// found) \? hah !
1619 ($ please) ($ continue) \.))))) 1619 (doc$ please) (doc$ continue) \.)))))
1620 1620
1621 (defun doctor-sports () (doctor-type ($ sportslst))) 1621 (defun doctor-sports () (doctor-type (doc$ sportslst)))
1622 1622
1623 (defun doctor-math () (doctor-type ($ mathlst))) 1623 (defun doctor-math () (doctor-type (doc$ mathlst)))
1624 1624
1625 (defun doctor-zippy () 1625 (defun doctor-zippy ()
1626 (cond (zippy-flag (doctor-type ($ zippylst))) 1626 (cond (zippy-flag (doctor-type (doc$ zippylst)))
1627 (t (setq zippy-flag t) 1627 (t (setq zippy-flag t)
1628 (doctor-type '(yow! are we interactive yet \?))))) 1628 (doctor-type '(yow! are we interactive yet \?)))))
1629 1629
1630 1630
1631 (defun doctor-chat () (doctor-type ($ chatlst))) 1631 (defun doctor-chat () (doctor-type (doc$ chatlst)))
1632 1632
1633 (provide 'doctor) 1633 (provide 'doctor)
1634 1634
1635 ;;; doctor.el ends here 1635 ;;; doctor.el ends here