Add 2012 to FSF copyright years for Emacs files
[bpt/emacs.git] / lisp / play / doctor.el
CommitLineData
55535639 1;;; doctor.el --- psychological help for frustrated users
c0274f38 2
acaf905b 3;; Copyright (C) 1985, 1987, 1994, 1996, 2000-2012
95df8112 4;; Free Software Foundation, Inc.
9750e079 5
e5167999 6;; Maintainer: FSF
e5167999
ER
7;; Keywords: games
8
6679505f
JB
9;; This file is part of GNU Emacs.
10
b1fc2b50 11;; GNU Emacs is free software: you can redistribute it and/or modify
6679505f 12;; it under the terms of the GNU General Public License as published by
b1fc2b50
GM
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
6679505f
JB
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
b1fc2b50 22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
6679505f 23
e41b2db1
ER
24;;; Commentary:
25
26;; The single entry point `doctor', simulates a Rogerian analyst using
27;; phrase-production techniques similar to the classic ELIZA demonstration
28;; of pseudo-AI.
29
e5167999 30;;; Code:
6679505f 31
869c4186
GM
32(defvar doctor--**mad**)
33(defvar doctor--*print-space*)
34(defvar doctor--*print-upcase*)
35(defvar doctor--abuselst)
36(defvar doctor--abusewords)
37(defvar doctor--afraidof)
38(defvar doctor--arerelated)
39(defvar doctor--areyou)
40(defvar doctor--bak)
41(defvar doctor--beclst)
42(defvar doctor--bother)
43(defvar doctor--bye)
44(defvar doctor--canyou) ; unused?
45(defvar doctor--chatlst)
46(defvar doctor--continue)
47(defvar doctor--deathlst)
48(defvar doctor--describe)
49(defvar doctor--drnk)
50(defvar doctor--drugs)
51(defvar doctor--eliza-flag)
52(defvar doctor--elizalst)
53(defvar doctor--famlst)
54(defvar doctor--feared)
55(defvar doctor--fears)
56(defvar doctor--feelings-about)
57(defvar doctor--foullst)
58(defvar doctor-found)
59(defvar doctor--hello)
60(defvar doctor--history)
61(defvar doctor--howareyoulst)
62(defvar doctor--howdyflag)
63(defvar doctor--huhlst)
64(defvar doctor--ibelieve)
65(defvar doctor--improve)
66(defvar doctor--inter)
67(defvar doctor--isee)
68(defvar doctor--isrelated)
69(defvar doctor--lincount)
70(defvar doctor--longhuhlst)
71(defvar doctor--lover)
72(defvar doctor--machlst)
73(defvar doctor--mathlst)
74(defvar doctor--maybe)
75(defvar doctor--moods)
76(defvar doctor--neglst)
77(defvar doctor-obj)
78(defvar doctor-object)
79(defvar doctor-owner)
80(defvar doctor--please)
81(defvar doctor--problems)
82(defvar doctor--qlist)
83(defvar doctor--random-adjective)
84(defvar doctor--relation)
85(defvar doctor--remlst)
86(defvar doctor--repetitive-shortness)
87(defvar doctor--replist)
88(defvar doctor--rms-flag)
89(defvar doctor--schoollst)
90(defvar doctor-sent)
91(defvar doctor--sexlst)
92(defvar doctor--shortbeclst)
93(defvar doctor--shortlst)
94(defvar doctor--something)
95(defvar doctor--sportslst)
96(defvar doctor--stallmanlst)
97(defvar doctor--states)
98(defvar doctor-subj)
99(defvar doctor--suicide-flag)
100(defvar doctor--sure)
101(defvar doctor--thing)
102(defvar doctor--things)
103(defvar doctor--thlst)
104(defvar doctor--toklst)
105(defvar doctor--typos)
106(defvar doctor-verb)
107(defvar doctor--want)
108(defvar doctor--whatwhen)
109(defvar doctor--whereoutp)
110(defvar doctor--whysay)
111(defvar doctor--whywant)
112(defvar doctor--zippy-flag)
113(defvar doctor--zippylst)
6f08431c 114
a3e58c1a 115(defun doc// (x) x)
6679505f 116
a3e58c1a 117(defmacro doc$ (what)
58d468b4 118 "Quoted arg form of doctor-$."
869c4186 119 `(doctor-$ ',what))
6679505f
JB
120
121(defun doctor-$ (what)
58d468b4 122 "Return the car of a list, rotating the list each time."
6679505f
JB
123 (let* ((vv (symbol-value what))
124 (first (car vv))
125 (ww (append (cdr vv) (list first))))
126 (set what ww)
127 first))
128\f
9d6f699a 129(defvar doctor-mode-map
0ff22356
SM
130 (let ((map (make-sparse-keymap)))
131 (define-key map "\n" 'doctor-read-print)
132 (define-key map "\r" 'doctor-ret-or-read)
133 map))
134
2aa8e74a 135(define-derived-mode doctor-mode text-mode "Doctor"
6679505f
JB
136 "Major mode for running the Doctor (Eliza) program.
137Like Text mode with Auto Fill mode
138except that RET when point is after a newline, or LFD at any time,
139reads the sentence before point, and prints the Doctor's answer."
6679505f 140 (make-doctor-variables)
6679505f
JB
141 (turn-on-auto-fill)
142 (doctor-type '(i am the psychotherapist \.
869c4186 143 (doc$ doctor--please) (doc$ doctor--describe) your (doc$ doctor--problems) \.
689743a2 144 each time you are finished talking\, type \R\E\T twice \.))
6679505f
JB
145 (insert "\n"))
146
147(defun make-doctor-variables ()
869c4186
GM
148 (set (make-local-variable 'doctor--typos)
149 (mapcar (lambda (x)
150 (put (car x) 'doctor-correction (cadr x))
151 (put (cadr x) 'doctor-expansion (car (cddr x)))
152 (car x))
153 '((theyll they\'ll (they will))
154 (theyre they\'re (they are))
155 (hes he\'s (he is))
156 (he7s he\'s (he is))
157 (im i\'m (you are))
158 (i7m i\'m (you are))
159 (isa is\ a (is a))
160 (thier their (their))
161 (dont don\'t (do not))
162 (don7t don\'t (do not))
163 (you7re you\'re (i am))
164 (you7ve you\'ve (i have))
165 (you7ll you\'ll (i will)))))
73d56dbd 166 (set (make-local-variable 'doctor-sent) nil)
869c4186
GM
167 (set (make-local-variable 'doctor-found) nil)
168 (set (make-local-variable 'doctor-owner) nil)
169 (set (make-local-variable 'doctor--history) nil)
170 (set (make-local-variable 'doctor--inter) '((well\,)
171 (hmmm \.\.\.\ so\,)
172 (so)
173 (\.\.\.and)
174 (then)))
175 (set (make-local-variable 'doctor--continue) '((continue)
176 (proceed)
177 (go on)
178 (keep going)))
179 (set (make-local-variable 'doctor--relation)
180 '((your relationship with)
181 (something you remember about)
182 (your feelings toward)
183 (some experiences you have had with)
184 (how you feel about)))
185 (set (make-local-variable 'doctor--fears)
186 '(((doc$ doctor--whysay) you are (doc$ doctor--afraidof) (doc// doctor--feared) \?)
187 (you seem terrified by (doc// doctor--feared) \.)
188 (when did you first feel (doc$ doctor--afraidof) (doc// doctor--feared) \?)))
189 (set (make-local-variable 'doctor--sure) '((sure)
190 (positive)
191 (certain)
192 (absolutely sure)))
193 (set (make-local-variable 'doctor--afraidof) '((afraid of)
194 (frightened by)
195 (scared of)))
196 (set (make-local-variable 'doctor--areyou) '((are you)
197 (have you been)
198 (have you been)))
199 (set (make-local-variable 'doctor--isrelated)
200 '((has something to do with)
201 (is related to)
202 (could be the reason for)
203 (is caused by)
204 (is because of)))
205 (set (make-local-variable 'doctor--arerelated) '((have something to do with)
206 (are related to)
207 (could have caused)
208 (could be the reason for)
209 (are caused by)
210 (are because of)))
211 (set (make-local-variable 'doctor--moods)
212 '(((doc$ doctor--areyou) (doc// doctor-found) often \?)
213 (what causes you to be (doc// doctor-found) \?)
214 ((doc$ doctor--whysay) you are (doc// doctor-found) \?)))
215 (set (make-local-variable 'doctor--maybe) '((maybe)
216 (perhaps)
217 (possibly)))
218 (set (make-local-variable 'doctor--whatwhen) '((what happened when)
219 (what would happen if)))
220 (set (make-local-variable 'doctor--hello) '((how do you do \?)
221 (hello \.)
222 (howdy!)
223 (hello \.)
224 (hi \.)
225 (hi there \.)))
226 (set (make-local-variable 'doctor--drnk)
227 '((do you drink a lot of (doc// doctor-found) \?)
228 (do you get drunk often \?)
229 ((doc$ doctor--describe) your drinking habits \.)))
230 (set (make-local-variable 'doctor--drugs)
231 '((do you use (doc// doctor-found) often \?)
232 ((doc$ doctor--areyou) addicted to (doc// doctor-found) \?)
233 (do you realize that drugs can be very harmful \?)
234 ((doc$ doctor--maybe) you should try to quit using (doc// doctor-found) \.)))
235 (set (make-local-variable 'doctor--whywant)
236 '(((doc$ doctor--whysay) (doc// doctor-subj) might (doc$ doctor--want) (doc// doctor-obj) \?)
237 (how does it feel to want \?)
238 (why should (doc// doctor-subj) get (doc// doctor-obj) \?)
239 (when did (doc// doctor-subj) first (doc$ doctor--want) (doc// doctor-obj) \?)
240 ((doc$ doctor--areyou) obsessed with (doc// doctor-obj) \?)
241 (why should i give (doc// doctor-obj) to (doc// doctor-subj) \?)
242 (have you ever gotten (doc// doctor-obj) \?)))
243 (set (make-local-variable 'doctor--canyou)
244 '((of course i can \.)
245 (why should i \?)
246 (what makes you think i would even want to \?)
247 (i am the doctor\, i can do anything i damn please \.)
248 (not really\, it\'s not up to me \.)
249 (depends\, how important is it \?)
250 (i could\, but i don\'t think it would be a wise thing to do \.)
251 (can you \?)
252 (maybe i can\, maybe i can\'t \.\.\.)
253 (i don\'t think i should do that \.)))
254 (set (make-local-variable 'doctor--want) '((want) (desire) (wish) (want) (hope)))
255 (set (make-local-variable 'doctor--shortlst)
256 '((can you elaborate on that \?)
257 ((doc$ doctor--please) continue \.)
258 (go on\, don\'t be afraid \.)
259 (i need a little more detail please \.)
260 (you\'re being a bit brief\, (doc$ doctor--please) go into detail \.)
261 (can you be more explicit \?)
262 (and \?)
263 ((doc$ doctor--please) go into more detail \?)
264 (you aren\'t being very talkative today\!)
265 (is that all there is to it \?)
266 (why must you respond so briefly \?)))
267 (set (make-local-variable 'doctor--famlst)
268 '((tell me (doc$ doctor--something) about (doc// doctor-owner) family \.)
269 (you seem to dwell on (doc// doctor-owner) family \.)
270 ((doc$ doctor--areyou) hung up on (doc// doctor-owner) family \?)))
271 (set (make-local-variable 'doctor--huhlst)
121656e9 272 '(((doc$ doctor--whysay) (doc// doctor-sent) \?)
869c4186
GM
273 (is it because of (doc$ doctor--things) that you say (doc// doctor-sent) \?)))
274 (set (make-local-variable 'doctor--longhuhlst)
275 '(((doc$ doctor--whysay) that \?)
276 (i don\'t understand \.)
277 ((doc$ doctor--thlst))
278 ((doc$ doctor--areyou) (doc$ doctor--afraidof) that \?)))
279 (set (make-local-variable 'doctor--feelings-about) '((feelings about)
280 (apprehensions toward)
281 (thoughts on)
282 (emotions toward)))
283 (set (make-local-variable 'doctor--random-adjective)
284 '((vivid)
285 (emotionally stimulating)
286 (exciting)
287 (boring)
288 (interesting)
289 (recent)
290 (random) ; how can we omit this?
291 (unusual)
292 (shocking)
293 (embarrassing)))
294 (set (make-local-variable 'doctor--whysay) '((why do you say)
295 (what makes you believe)
296 (are you sure that)
297 (do you really think)
298 (what makes you think)))
299 (set (make-local-variable 'doctor--isee) '((i see \.\.\.)
300 (yes\,)
301 (i understand \.)
302 (oh \.) ))
303 (set (make-local-variable 'doctor--please) '((please\,)
304 (i would appreciate it if you would)
305 (perhaps you could)
306 (please\,)
307 (would you please)
308 (why don\'t you)
309 (could you)))
310 (set (make-local-variable 'doctor--bye)
311 '((my secretary will send you a bill \.)
312 (bye bye \.)
313 (see ya \.)
314 (ok\, talk to you some other time \.)
315 (talk to you later \.)
316 (ok\, have fun \.)
317 (ciao \.)))
318 (set (make-local-variable 'doctor--something) '((something)
319 (more)
320 (how you feel)))
321 (set (make-local-variable 'doctor--thing) '((your life)
322 (your sex life)))
323 (set (make-local-variable 'doctor--things) '((your plans)
324 (the people you hang around with)
325 (problems at school)
326 (any hobbies you have)
327 (hangups you have)
328 (your inhibitions)
329 (some problems in your childhood)
330 (some problems at home)))
331 (set (make-local-variable 'doctor--describe) '((describe)
332 (tell me about)
333 (talk about)
334 (discuss)
335 (tell me more about)
336 (elaborate on)))
337 (set (make-local-variable 'doctor--ibelieve)
338 '((i believe) (i think) (i have a feeling) (it seems to me that)
339 (it looks like)))
340 (set (make-local-variable 'doctor--problems) '((problems)
341 (inhibitions)
342 (hangups)
343 (difficulties)
344 (anxieties)
345 (frustrations)))
346 (set (make-local-variable 'doctor--bother) '((does it bother you that)
347 (are you annoyed that)
348 (did you ever regret)
349 (are you sorry)
350 (are you satisfied with the fact that)))
351 (set (make-local-variable 'doctor--machlst)
352 '((you have your mind on (doc// doctor-found) \, it seems \.)
353 (you think too much about (doc// doctor-found) \.)
354 (you should try taking your mind off of (doc// doctor-found)\.)
355 (are you a computer hacker \?)))
356 (set (make-local-variable 'doctor--qlist)
357 '((what do you think \?)
358 (i\'ll ask the questions\, if you don\'t mind!)
359 (i could ask the same thing myself \.)
360 ((doc$ doctor--please) allow me to do the questioning \.)
361 (i have asked myself that question many times \.)
362 ((doc$ doctor--please) try to answer that question yourself \.)))
363 (set (make-local-variable 'doctor--foullst)
364 '(((doc$ doctor--please) watch your tongue!)
365 ((doc$ doctor--please) avoid such unwholesome thoughts \.)
366 ((doc$ doctor--please) get your mind out of the gutter \.)
367 (such lewdness is not appreciated \.)))
368 (set (make-local-variable 'doctor--deathlst)
369 '((this is not a healthy way of thinking \.)
370 ((doc$ doctor--bother) you\, too\, may die someday \?)
371 (i am worried by your obsession with this topic!)
372 (did you watch a lot of crime and violence on television as a child \?)))
373 (set (make-local-variable 'doctor--sexlst)
374 '(((doc$ doctor--areyou) (doc$ doctor--afraidof) sex \?)
121656e9
JB
375 ((doc$ doctor--describe) (doc$ doctor--something) about your sexual history \.)
376 ((doc$ doctor--please) (doc$ doctor--describe) your sex life \.\.\.)
869c4186
GM
377 ((doc$ doctor--describe) your (doc$ doctor--feelings-about) your sexual partner \.)
378 ((doc$ doctor--describe) your most (doc$ doctor--random-adjective) sexual experience \.)
379 ((doc$ doctor--areyou) satisfied with (doc// doctor--lover) \.\.\. \?)))
380 (set (make-local-variable 'doctor--neglst) '((why not \?)
381 ((doc$ doctor--bother) i ask that \?)
382 (why not \?)
383 (why not \?)
384 (how come \?)
385 ((doc$ doctor--bother) i ask that \?)))
386 (set (make-local-variable 'doctor--beclst)
387 '((is it because (doc// doctor-sent) that you came to me \?)
121656e9 388 ((doc$ doctor--bother) (doc// doctor-sent) \?)
869c4186
GM
389 (when did you first know that (doc// doctor-sent) \?)
390 (is the fact that (doc// doctor-sent) the real reason \?)
391 (does the fact that (doc// doctor-sent) explain anything else \?)
121656e9 392 ((doc$ doctor--areyou) (doc$ doctor--sure) (doc// doctor-sent) \? )))
869c4186
GM
393 (set (make-local-variable 'doctor--shortbeclst)
394 '(((doc$ doctor--bother) i ask you that \?)
395 (that\'s not much of an answer!)
396 ((doc$ doctor--inter) why won\'t you talk about it \?)
397 (speak up!)
398 ((doc$ doctor--areyou) (doc$ doctor--afraidof) talking about it \?)
399 (don\'t be (doc$ doctor--afraidof) elaborating \.)
400 ((doc$ doctor--please) go into more detail \.)))
401 (set (make-local-variable 'doctor--thlst)
121656e9
JB
402 '(((doc$ doctor--maybe) (doc$ doctor--thing) (doc$ doctor--isrelated) this \.)
403 ((doc$ doctor--maybe) (doc$ doctor--things) (doc$ doctor--arerelated) this \.)
869c4186
GM
404 (is it because of (doc$ doctor--things) that you are going through all this \?)
405 (how do you reconcile (doc$ doctor--things) \? )
121656e9 406 ((doc$ doctor--maybe) this (doc$ doctor--isrelated) (doc$ doctor--things) \?)))
869c4186
GM
407 (set (make-local-variable 'doctor--remlst)
408 '((earlier you said (doc$ doctor--history) \?)
409 (you mentioned that (doc$ doctor--history) \?)
121656e9 410 ((doc$ doctor--whysay) (doc$ doctor--history) \? )))
869c4186
GM
411 (set (make-local-variable 'doctor--toklst)
412 '((is this how you relax \?)
413 (how long have you been smoking grass \?)
414 ((doc$ doctor--areyou) (doc$ doctor--afraidof) of being drawn to using harder stuff \?)))
415 (set (make-local-variable 'doctor--states)
416 '((do you get (doc// doctor-found) often \?)
417 (do you enjoy being (doc// doctor-found) \?)
418 (what makes you (doc// doctor-found) \?)
121656e9 419 (how often (doc$ doctor--areyou) (doc// doctor-found) \?)
869c4186
GM
420 (when were you last (doc// doctor-found) \?)))
421 (set (make-local-variable 'doctor--replist) '((i . (you))
422 (my . (your))
423 (me . (you))
424 (you . (me))
425 (your . (my))
426 (mine . (yours))
427 (yours . (mine))
428 (our . (your))
429 (ours . (yours))
430 (we . (you))
431 (dunno . (do not know))
432 ;; (yes . ())
433 (no\, . ())
434 (yes\, . ())
435 (ya . (i))
436 (aint . (am not))
437 (wanna . (want to))
438 (gimme . (give me))
439 (gotta . (have to))
440 (gonna . (going to))
441 (never . (not ever))
442 (doesn\'t . (does not))
443 (don\'t . (do not))
444 (aren\'t . (are not))
445 (isn\'t . (is not))
446 (won\'t . (will not))
447 (can\'t . (cannot))
448 (haven\'t . (have not))
449 (i\'m . (you are))
450 (ourselves . (yourselves))
451 (myself . (yourself))
452 (yourself . (myself))
453 (you\'re . (i am))
454 (you\'ve . (i have))
455 (i\'ve . (you have))
456 (i\'ll . (you will))
457 (you\'ll . (i shall))
458 (i\'d . (you would))
459 (you\'d . (i would))
460 (here . (there))
461 (please . ())
462 (eh\, . ())
463 (eh . ())
464 (oh\, . ())
465 (oh . ())
466 (shouldn\'t . (should not))
467 (wouldn\'t . (would not))
468 (won\'t . (will not))
469 (hasn\'t . (has not))))
470 (set (make-local-variable 'doctor--stallmanlst)
471 '(((doc$ doctor--describe) your (doc$ doctor--feelings-about) him \.)
472 ((doc$ doctor--areyou) a friend of Stallman \?)
473 ((doc$ doctor--bother) Stallman is (doc$ doctor--random-adjective) \?)
474 ((doc$ doctor--ibelieve) you are (doc$ doctor--afraidof) him \.)))
475 (set (make-local-variable 'doctor--schoollst)
476 '(((doc$ doctor--describe) your (doc// doctor-found) \.)
477 ((doc$ doctor--bother) your grades could (doc$ doctor--improve) \?)
478 ((doc$ doctor--areyou) (doc$ doctor--afraidof) (doc// doctor-found) \?)
479 ((doc$ doctor--maybe) this (doc$ doctor--isrelated) to your attitude \.)
480 ((doc$ doctor--areyou) absent often \?)
481 ((doc$ doctor--maybe) you should study (doc$ doctor--something) \.)))
482 (set (make-local-variable 'doctor--improve)
483 '((improve) (be better) (be improved) (be higher)))
484 (set (make-local-variable 'doctor--elizalst)
485 '(((doc$ doctor--areyou) (doc$ doctor--sure) \?)
486 ((doc$ doctor--ibelieve) you have (doc$ doctor--problems) with (doc// doctor-found) \.)
487 ((doc$ doctor--whysay) (doc// doctor-sent) \?)))
488 (set (make-local-variable 'doctor--sportslst)
489 '((tell me (doc$ doctor--something) about (doc// doctor-found) \.)
490 ((doc$ doctor--describe) (doc$ doctor--relation) (doc// doctor-found) \.)
491 (do you find (doc// doctor-found) (doc$ doctor--random-adjective) \?)))
492 (set (make-local-variable 'doctor--mathlst)
493 '(((doc$ doctor--describe) (doc$ doctor--something) about math \.)
494 ((doc$ doctor--maybe) your (doc$ doctor--problems) (doc$ doctor--arerelated) (doc// doctor-found) \.)
495 (i don\'t know much (doc// doctor-found) \, but (doc$ doctor--continue)
496 anyway \.)))
497 (set (make-local-variable 'doctor--zippylst)
498 '(((doc$ doctor--areyou) Zippy \?)
499 ((doc$ doctor--ibelieve) you have some serious (doc$ doctor--problems) \.)
500 ((doc$ doctor--bother) you are a pinhead \?)))
501 (set (make-local-variable 'doctor--chatlst)
502 '(((doc$ doctor--maybe) we could chat \.)
503 ((doc$ doctor--please) (doc$ doctor--describe) (doc$ doctor--something) about chat mode \.)
504 ((doc$ doctor--bother) our discussion is so (doc$ doctor--random-adjective) \?)))
505 (set (make-local-variable 'doctor--abuselst)
506 '(((doc$ doctor--please) try to be less abusive \.)
507 ((doc$ doctor--describe) why you call me (doc// doctor-found) \.)
508 (i\'ve had enough of you!)))
509 (set (make-local-variable 'doctor--abusewords)
510 '(boring bozo clown clumsy cretin dumb dummy
511 fool foolish gnerd gnurd idiot jerk
512 lose loser louse lousy luse luser
513 moron nerd nurd oaf oafish reek
514 stink stupid tool toolish twit))
515 (set (make-local-variable 'doctor--howareyoulst)
516 '((how are you) (hows it going) (hows it going eh)
517 (how\'s it going) (how\'s it going eh) (how goes it)
518 (whats up) (whats new) (what\'s up) (what\'s new)
519 (howre you) (how\'re you) (how\'s everything)
520 (how is everything) (how do you do)
521 (how\'s it hanging) (que pasa)
522 (how are you doing) (what do you say)))
523 (set (make-local-variable 'doctor--whereoutp) '(huh remem rthing))
524 (set (make-local-variable 'doctor-subj) nil)
525 (set (make-local-variable 'doctor-verb) nil)
526 (set (make-local-variable 'doctor-obj) nil)
527 (set (make-local-variable 'doctor--feared) nil)
528 (set (make-local-variable 'doctor--repetitive-shortness) '(0 . 0))
529 (set (make-local-variable 'doctor--**mad**) nil)
530 (set (make-local-variable 'doctor--rms-flag) nil)
531 (set (make-local-variable 'doctor--eliza-flag) nil)
532 (set (make-local-variable 'doctor--zippy-flag) nil)
533 (set (make-local-variable 'doctor--suicide-flag) nil)
534 (set (make-local-variable 'doctor--lover) '(your partner))
535 (set (make-local-variable 'doctor--bak) nil)
536 (set (make-local-variable 'doctor--lincount) 0)
537 (set (make-local-variable 'doctor--*print-upcase*) nil)
538 (set (make-local-variable 'doctor--*print-space*) nil)
539 (set (make-local-variable 'doctor--howdyflag) nil)
540 (set (make-local-variable 'doctor-object) nil))
6679505f
JB
541\f
542;; Define equivalence classes of words that get treated alike.
543
544(defun doctor-meaning (x) (get x 'doctor-meaning))
545
546(defmacro doctor-put-meaning (symb val)
869c4186
GM
547 "Store the base meaning of a word on the property list."
548 `(put ',symb 'doctor-meaning ,val))
6679505f
JB
549
550(doctor-put-meaning howdy 'howdy)
551(doctor-put-meaning hi 'howdy)
552(doctor-put-meaning greetings 'howdy)
553(doctor-put-meaning hello 'howdy)
554(doctor-put-meaning tops20 'mach)
555(doctor-put-meaning tops-20 'mach)
556(doctor-put-meaning tops 'mach)
557(doctor-put-meaning pdp11 'mach)
558(doctor-put-meaning computer 'mach)
559(doctor-put-meaning unix 'mach)
560(doctor-put-meaning machine 'mach)
561(doctor-put-meaning computers 'mach)
562(doctor-put-meaning machines 'mach)
563(doctor-put-meaning pdp11s 'mach)
564(doctor-put-meaning foo 'mach)
565(doctor-put-meaning foobar 'mach)
566(doctor-put-meaning multics 'mach)
567(doctor-put-meaning macsyma 'mach)
568(doctor-put-meaning teletype 'mach)
569(doctor-put-meaning la36 'mach)
570(doctor-put-meaning vt52 'mach)
571(doctor-put-meaning zork 'mach)
572(doctor-put-meaning trek 'mach)
573(doctor-put-meaning startrek 'mach)
574(doctor-put-meaning advent 'mach)
575(doctor-put-meaning pdp 'mach)
576(doctor-put-meaning dec 'mach)
577(doctor-put-meaning commodore 'mach)
578(doctor-put-meaning vic 'mach)
579(doctor-put-meaning bbs 'mach)
580(doctor-put-meaning modem 'mach)
581(doctor-put-meaning baud 'mach)
582(doctor-put-meaning macintosh 'mach)
583(doctor-put-meaning vax 'mach)
584(doctor-put-meaning vms 'mach)
585(doctor-put-meaning ibm 'mach)
586(doctor-put-meaning pc 'mach)
587(doctor-put-meaning bitching 'foul)
da4e5ca9 588(doctor-put-meaning shit 'foul)
6679505f
JB
589(doctor-put-meaning bastard 'foul)
590(doctor-put-meaning damn 'foul)
591(doctor-put-meaning damned 'foul)
592(doctor-put-meaning hell 'foul)
593(doctor-put-meaning suck 'foul)
594(doctor-put-meaning sucking 'foul)
595(doctor-put-meaning sux 'foul)
596(doctor-put-meaning ass 'foul)
597(doctor-put-meaning whore 'foul)
598(doctor-put-meaning bitch 'foul)
599(doctor-put-meaning asshole 'foul)
600(doctor-put-meaning shrink 'foul)
601(doctor-put-meaning pot 'toke)
602(doctor-put-meaning grass 'toke)
603(doctor-put-meaning weed 'toke)
604(doctor-put-meaning marijuana 'toke)
605(doctor-put-meaning acapulco 'toke)
606(doctor-put-meaning columbian 'toke)
607(doctor-put-meaning tokin 'toke)
608(doctor-put-meaning joint 'toke)
609(doctor-put-meaning toke 'toke)
610(doctor-put-meaning toking 'toke)
611(doctor-put-meaning tokin\' 'toke)
612(doctor-put-meaning toked 'toke)
613(doctor-put-meaning roach 'toke)
614(doctor-put-meaning pills 'drug)
615(doctor-put-meaning dope 'drug)
616(doctor-put-meaning acid 'drug)
617(doctor-put-meaning lsd 'drug)
618(doctor-put-meaning speed 'drug)
619(doctor-put-meaning heroin 'drug)
620(doctor-put-meaning hash 'drug)
621(doctor-put-meaning cocaine 'drug)
622(doctor-put-meaning uppers 'drug)
623(doctor-put-meaning downers 'drug)
624(doctor-put-meaning loves 'loves)
625(doctor-put-meaning love 'love)
626(doctor-put-meaning loved 'love)
627(doctor-put-meaning hates 'hates)
628(doctor-put-meaning dislikes 'hates)
629(doctor-put-meaning hate 'hate)
630(doctor-put-meaning hated 'hate)
631(doctor-put-meaning dislike 'hate)
632(doctor-put-meaning stoned 'state)
633(doctor-put-meaning drunk 'state)
634(doctor-put-meaning drunken 'state)
635(doctor-put-meaning high 'state)
636(doctor-put-meaning horny 'state)
637(doctor-put-meaning blasted 'state)
638(doctor-put-meaning happy 'state)
639(doctor-put-meaning paranoid 'state)
640(doctor-put-meaning wish 'desire)
641(doctor-put-meaning wishes 'desire)
642(doctor-put-meaning want 'desire)
643(doctor-put-meaning desire 'desire)
644(doctor-put-meaning like 'desire)
645(doctor-put-meaning hope 'desire)
646(doctor-put-meaning hopes 'desire)
647(doctor-put-meaning desires 'desire)
648(doctor-put-meaning wants 'desire)
649(doctor-put-meaning desires 'desire)
650(doctor-put-meaning likes 'desire)
651(doctor-put-meaning needs 'desire)
652(doctor-put-meaning need 'desire)
653(doctor-put-meaning frustrated 'mood)
654(doctor-put-meaning depressed 'mood)
655(doctor-put-meaning annoyed 'mood)
656(doctor-put-meaning upset 'mood)
657(doctor-put-meaning unhappy 'mood)
658(doctor-put-meaning excited 'mood)
659(doctor-put-meaning worried 'mood)
660(doctor-put-meaning lonely 'mood)
661(doctor-put-meaning angry 'mood)
662(doctor-put-meaning mad 'mood)
da4e5ca9 663(doctor-put-meaning pissed 'mood)
6679505f
JB
664(doctor-put-meaning jealous 'mood)
665(doctor-put-meaning afraid 'fear)
666(doctor-put-meaning terrified 'fear)
667(doctor-put-meaning fear 'fear)
668(doctor-put-meaning scared 'fear)
669(doctor-put-meaning frightened 'fear)
670(doctor-put-meaning virginity 'sexnoun)
671(doctor-put-meaning virgins 'sexnoun)
672(doctor-put-meaning virgin 'sexnoun)
673(doctor-put-meaning cock 'sexnoun)
674(doctor-put-meaning cocks 'sexnoun)
675(doctor-put-meaning dick 'sexnoun)
676(doctor-put-meaning dicks 'sexnoun)
da4e5ca9
RS
677(doctor-put-meaning cunt 'sexnoun)
678(doctor-put-meaning cunts 'sexnoun)
6679505f
JB
679(doctor-put-meaning prostitute 'sexnoun)
680(doctor-put-meaning condom 'sexnoun)
681(doctor-put-meaning sex 'sexnoun)
682(doctor-put-meaning rapes 'sexnoun)
683(doctor-put-meaning wife 'family)
684(doctor-put-meaning family 'family)
685(doctor-put-meaning brothers 'family)
686(doctor-put-meaning sisters 'family)
687(doctor-put-meaning parent 'family)
688(doctor-put-meaning parents 'family)
689(doctor-put-meaning brother 'family)
690(doctor-put-meaning sister 'family)
691(doctor-put-meaning father 'family)
692(doctor-put-meaning mother 'family)
693(doctor-put-meaning husband 'family)
694(doctor-put-meaning siblings 'family)
695(doctor-put-meaning grandmother 'family)
696(doctor-put-meaning grandfather 'family)
697(doctor-put-meaning maternal 'family)
698(doctor-put-meaning paternal 'family)
699(doctor-put-meaning stab 'death)
700(doctor-put-meaning murder 'death)
701(doctor-put-meaning murders 'death)
702(doctor-put-meaning suicide 'death)
703(doctor-put-meaning suicides 'death)
704(doctor-put-meaning kill 'death)
705(doctor-put-meaning kills 'death)
f535f6b2 706(doctor-put-meaning killing 'death)
6679505f
JB
707(doctor-put-meaning die 'death)
708(doctor-put-meaning dies 'death)
709(doctor-put-meaning died 'death)
710(doctor-put-meaning dead 'death)
711(doctor-put-meaning death 'death)
712(doctor-put-meaning deaths 'death)
713(doctor-put-meaning pain 'symptoms)
714(doctor-put-meaning ache 'symptoms)
715(doctor-put-meaning fever 'symptoms)
716(doctor-put-meaning sore 'symptoms)
717(doctor-put-meaning aching 'symptoms)
718(doctor-put-meaning stomachache 'symptoms)
719(doctor-put-meaning headache 'symptoms)
720(doctor-put-meaning hurts 'symptoms)
721(doctor-put-meaning disease 'symptoms)
722(doctor-put-meaning virus 'symptoms)
723(doctor-put-meaning vomit 'symptoms)
724(doctor-put-meaning vomiting 'symptoms)
725(doctor-put-meaning barf 'symptoms)
726(doctor-put-meaning toothache 'symptoms)
727(doctor-put-meaning hurt 'symptoms)
728(doctor-put-meaning rum 'alcohol)
729(doctor-put-meaning gin 'alcohol)
730(doctor-put-meaning vodka 'alcohol)
731(doctor-put-meaning alcohol 'alcohol)
732(doctor-put-meaning bourbon 'alcohol)
733(doctor-put-meaning beer 'alcohol)
734(doctor-put-meaning wine 'alcohol)
735(doctor-put-meaning whiskey 'alcohol)
736(doctor-put-meaning scotch 'alcohol)
da4e5ca9
RS
737(doctor-put-meaning fuck 'sexverb)
738(doctor-put-meaning fucked 'sexverb)
6679505f
JB
739(doctor-put-meaning screw 'sexverb)
740(doctor-put-meaning screwing 'sexverb)
da4e5ca9 741(doctor-put-meaning fucking 'sexverb)
6679505f
JB
742(doctor-put-meaning rape 'sexverb)
743(doctor-put-meaning raped 'sexverb)
744(doctor-put-meaning kiss 'sexverb)
745(doctor-put-meaning kissing 'sexverb)
746(doctor-put-meaning kisses 'sexverb)
747(doctor-put-meaning screws 'sexverb)
da4e5ca9 748(doctor-put-meaning fucks 'sexverb)
6679505f
JB
749(doctor-put-meaning because 'conj)
750(doctor-put-meaning but 'conj)
751(doctor-put-meaning however 'conj)
752(doctor-put-meaning besides 'conj)
753(doctor-put-meaning anyway 'conj)
754(doctor-put-meaning that 'conj)
755(doctor-put-meaning except 'conj)
756(doctor-put-meaning why 'conj)
757(doctor-put-meaning how 'conj)
758(doctor-put-meaning until 'when)
759(doctor-put-meaning when 'when)
760(doctor-put-meaning whenever 'when)
761(doctor-put-meaning while 'when)
762(doctor-put-meaning since 'when)
763(doctor-put-meaning rms 'rms)
764(doctor-put-meaning stallman 'rms)
765(doctor-put-meaning school 'school)
766(doctor-put-meaning schools 'school)
767(doctor-put-meaning skool 'school)
768(doctor-put-meaning grade 'school)
769(doctor-put-meaning grades 'school)
770(doctor-put-meaning teacher 'school)
771(doctor-put-meaning teachers 'school)
772(doctor-put-meaning classes 'school)
773(doctor-put-meaning professor 'school)
774(doctor-put-meaning prof 'school)
775(doctor-put-meaning profs 'school)
776(doctor-put-meaning professors 'school)
777(doctor-put-meaning mit 'school)
778(doctor-put-meaning emacs 'eliza)
779(doctor-put-meaning eliza 'eliza)
780(doctor-put-meaning liza 'eliza)
781(doctor-put-meaning elisa 'eliza)
782(doctor-put-meaning weizenbaum 'eliza)
783(doctor-put-meaning doktor 'eliza)
eb8c3be9 784(doctor-put-meaning athletics 'sports)
6679505f
JB
785(doctor-put-meaning baseball 'sports)
786(doctor-put-meaning basketball 'sports)
787(doctor-put-meaning football 'sports)
788(doctor-put-meaning frisbee 'sports)
789(doctor-put-meaning gym 'sports)
790(doctor-put-meaning gymnastics 'sports)
791(doctor-put-meaning hockey 'sports)
792(doctor-put-meaning lacrosse 'sports)
793(doctor-put-meaning soccer 'sports)
794(doctor-put-meaning softball 'sports)
795(doctor-put-meaning sports 'sports)
796(doctor-put-meaning swimming 'sports)
797(doctor-put-meaning swim 'sports)
798(doctor-put-meaning tennis 'sports)
799(doctor-put-meaning volleyball 'sports)
800(doctor-put-meaning math 'math)
801(doctor-put-meaning mathematics 'math)
802(doctor-put-meaning mathematical 'math)
803(doctor-put-meaning theorem 'math)
804(doctor-put-meaning axiom 'math)
805(doctor-put-meaning lemma 'math)
806(doctor-put-meaning algebra 'math)
807(doctor-put-meaning algebraic 'math)
808(doctor-put-meaning trig 'math)
809(doctor-put-meaning trigonometry 'math)
810(doctor-put-meaning trigonometric 'math)
811(doctor-put-meaning geometry 'math)
812(doctor-put-meaning geometric 'math)
813(doctor-put-meaning calculus 'math)
814(doctor-put-meaning arithmetic 'math)
815(doctor-put-meaning zippy 'zippy)
816(doctor-put-meaning zippy 'zippy)
817(doctor-put-meaning pinhead 'zippy)
818(doctor-put-meaning chat 'chat)
819\f
820;;;###autoload
821(defun doctor ()
822 "Switch to *doctor* buffer and start giving psychotherapy."
823 (interactive)
824 (switch-to-buffer "*doctor*")
825 (doctor-mode))
826
827(defun doctor-ret-or-read (arg)
828 "Insert a newline if preceding character is not a newline.
829Otherwise call the Doctor to parse preceding sentence."
830 (interactive "*p")
831 (if (= (preceding-char) ?\n)
832 (doctor-read-print)
833 (newline arg)))
834
835(defun doctor-read-print nil
58d468b4 836 "Top level loop."
6679505f
JB
837 (interactive)
838 (let ((sent (doctor-readin)))
839 (insert "\n")
869c4186 840 (setq doctor--lincount (1+ doctor--lincount))
6679505f
JB
841 (doctor-doc sent)
842 (insert "\n")
869c4186 843 (setq doctor--bak sent)))
6679505f
JB
844
845(defun doctor-readin nil
846 "Read a sentence. Return it as a list of words."
847 (let (sentence)
848 (backward-sentence 1)
849 (while (not (eobp))
850 (setq sentence (append sentence (list (doctor-read-token)))))
851 sentence))
852
853(defun doctor-read-token ()
58d468b4 854 "Read one word from buffer."
6679505f
JB
855 (prog1 (intern (downcase (buffer-substring (point)
856 (progn
857 (forward-word 1)
858 (point)))))
859 (re-search-forward "\\Sw*")))
860\f
861;; Main processing function for sentences that have been read.
862
121656e9 863(defun doctor-doc (sent)
6679505f 864 (cond
121656e9
JB
865 ((equal sent '(foo))
866 (doctor-type '(bar! (doc$ doctor--please) (doc$ doctor--continue) \.)))
867 ((member sent doctor--howareyoulst)
869c4186 868 (doctor-type '(i\'m ok \. (doc$ doctor--describe) yourself \.)))
121656e9 869 ((or (member sent '((good bye) (see you later) (i quit) (so long)
6679505f 870 (go away) (get lost)))
121656e9 871 (memq (car sent)
a1506d29 872 '(bye halt break quit done exit goodbye
6679505f 873 bye\, stop pause goodbye\, stop pause)))
869c4186 874 (doctor-type (doc$ doctor--bye)))
121656e9
JB
875 ((and (eq (car sent) 'you)
876 (memq (cadr sent) doctor--abusewords))
877 (setq doctor-found (cadr sent))
869c4186 878 (doctor-type (doc$ doctor--abuselst)))
121656e9
JB
879 ((eq (car sent) 'whatmeans)
880 (doctor-def (cadr sent)))
881 ((equal sent '(parse))
869c4186
GM
882 (doctor-type (list 'subj '= doctor-subj ", "
883 'verb '= doctor-verb "\n"
884 'object 'phrase '= doctor-obj ","
885 'noun 'form '= doctor-object "\n"
886 'current 'keyword 'is doctor-found
6679505f
JB
887 ", "
888 'most 'recent 'possessive
869c4186 889 'is doctor-owner "\n"
6679505f
JB
890 'sentence 'used 'was
891 "..."
869c4186 892 '(doc// doctor--bak))))
121656e9 893 ((memq (car sent) '(are is do has have how when where who why))
869c4186 894 (doctor-type (doc$ doctor--qlist)))
121656e9
JB
895 ;; ((eq (car sent) 'forget)
896 ;; (set (cadr sent) nil)
897 ;; (doctor-type '((doc$ doctor--isee) (doc$ doctor--please)
869c4186 898 ;; (doc$ doctor--continue)\.)))
6679505f 899 (t
121656e9
JB
900 (if (doctor-defq sent) (doctor-define sent doctor-found))
901 (if (> (length sent) 12) (setq sent (doctor-shorten sent)))
902 (setq sent (doctor-correct-spelling (doctor-replace sent doctor--replist)))
903 (cond ((and (not (memq 'me sent)) (not (memq 'i sent))
904 (memq 'am sent))
905 (setq sent (doctor-replace sent '((am . (are)))))))
906 (cond ((equal (car sent) 'yow) (doctor-zippy))
907 ((< (length sent) 2)
908 (cond ((eq (doctor-meaning (car sent)) 'howdy)
6679505f
JB
909 (doctor-howdy))
910 (t (doctor-short))))
911 (t
121656e9
JB
912 (if (memq 'am sent)
913 (setq sent (doctor-replace sent '((me . (i))))))
914 (setq sent (doctor-fixup sent))
915 (if (and (eq (car sent) 'do) (eq (cadr sent) 'not))
6679505f 916 (cond ((zerop (random 3))
869c4186 917 (doctor-type '(are you (doc$ doctor--afraidof) that \?)))
6679505f
JB
918 ((zerop (random 2))
919 (doctor-type '(don\'t tell me what to do \. i am the
a8bccd82 920 doctor here!))
6679505f
JB
921 (doctor-rthing))
922 (t
869c4186 923 (doctor-type '((doc$ doctor--whysay) that i shouldn\'t
121656e9 924 (cddr sent)
6679505f 925 \?))))
121656e9 926 (doctor-go (doctor-wherego sent))))))))
6679505f
JB
927\f
928;; Things done to process sentences once read.
929
930(defun doctor-correct-spelling (sent)
931 "Correct the spelling and expand each word in sentence."
932 (if sent
7382bcae 933 (apply 'append (mapcar (lambda (word)
869c4186
GM
934 (if (memq word doctor--typos)
935 (get (get word 'doctor-correction)
936 'doctor-expansion)
6679505f
JB
937 (list word)))
938 sent))))
939
940(defun doctor-shorten (sent)
eb8c3be9 941 "Make a sentence manageably short using a few hacks."
6679505f 942 (let (foo
27664fbe 943 (retval sent)
6679505f
JB
944 (temp '(because but however besides anyway until
945 while that except why how)))
946 (while temp
947 (setq foo (memq (car temp) sent))
948 (if (and foo
949 (> (length foo) 3))
27664fbe
RS
950 (setq retval (doctor-fixup foo)
951 temp nil)
6679505f
JB
952 (setq temp (cdr temp))))
953 retval))
954
955(defun doctor-define (sent found)
956 (doctor-svo sent found 1 nil)
957 (and
869c4186
GM
958 (doctor-nounp doctor-subj)
959 (not (doctor-pronounp doctor-subj))
960 doctor-subj
961 (doctor-meaning doctor-object)
962 (put doctor-subj 'doctor-meaning (doctor-meaning doctor-object))
6679505f
JB
963 t))
964
965(defun doctor-defq (sent)
869c4186
GM
966 "Set global var DOCTOR-FOUND to first keyword found in sentence SENT."
967 (setq doctor-found nil)
6679505f
JB
968 (let ((temp '(means applies mean refers refer related
969 similar defined associated linked like same)))
970 (while temp
971 (if (memq (car temp) sent)
869c4186 972 (setq doctor-found (car temp)
6679505f
JB
973 temp nil)
974 (setq temp (cdr temp)))))
869c4186 975 doctor-found)
6679505f
JB
976
977(defun doctor-def (x)
869c4186
GM
978 (doctor-type (list 'the 'word x 'means (doctor-meaning x) 'to 'me))
979 nil)
6679505f
JB
980
981(defun doctor-forget ()
982 "Delete the last element of the history list."
869c4186 983 (setq doctor--history (reverse (cdr (reverse doctor--history)))))
6679505f
JB
984
985(defun doctor-query (x)
986 "Prompt for a line of input from the minibuffer until a noun or verb is seen.
987Put dialogue in buffer."
988 (let (a
989 (prompt (concat (doctor-make-string x)
990 " what \? "))
991 retval)
992 (while (not retval)
993 (while (not a)
994 (insert ?\n
995 prompt
996 (read-string prompt)
997 ?\n)
998 (setq a (doctor-readin)))
999 (while (and a (not retval))
1000 (cond ((doctor-nounp (car a))
1001 (setq retval (car a)))
1002 ((doctor-verbp (car a))
1003 (setq retval (doctor-build
1004 (doctor-build x " ")
1005 (car a))))
1006 ((setq a (cdr a))))))
1007 retval))
1008
1009(defun doctor-subjsearch (sent key type)
1010 "Search for the subject of a sentence SENT, looking for the noun closest
869c4186 1011to and preceding KEY by at least TYPE words. Set global variable doctor-subj to
6679505f
JB
1012the subject noun, and return the portion of the sentence following it."
1013 (let ((i (- (length sent) (length (memq key sent)) type)))
1014 (while (and (> i -1) (not (doctor-nounp (nth i sent))))
1015 (setq i (1- i)))
1016 (cond ((> i -1)
869c4186 1017 (setq doctor-subj (nth i sent))
6679505f
JB
1018 (nthcdr (1+ i) sent))
1019 (t
869c4186 1020 (setq doctor-subj 'you)
6679505f
JB
1021 nil))))
1022
1023(defun doctor-nounp (x)
58d468b4 1024 "Return t if the symbol argument is a noun."
6679505f
JB
1025 (or (doctor-pronounp x)
1026 (not (or (doctor-verbp x)
1027 (equal x 'not)
1028 (doctor-prepp x)
1029 (doctor-modifierp x) )) ))
1030
1031(defun doctor-pronounp (x)
58d468b4 1032 "Return t if the symbol argument is a pronoun."
6679505f
JB
1033 (memq x '(
1034 i me mine myself
1035 we us ours ourselves ourself
1036 you yours yourself yourselves
1037 he him himself she hers herself
1038 it that those this these things thing
1039 they them themselves theirs
1040 anybody everybody somebody
1041 anyone everyone someone
1042 anything something everything)))
1043
0ff22356
SM
1044(dolist (x
1045 '(abort aborted aborts ask asked asks am
1046 applied applies apply are associate
1047 associated ate
1048 be became become becomes becoming
1049 been being believe believed believes
1050 bit bite bites bore bored bores boring bought buy buys buying
1051 call called calling calls came can caught catch come
1052 contract contracted contracts control controlled controls
1053 could croak croaks croaked cut cuts
1054 dare dared define defines dial dialed dials did die died dies
1055 dislike disliked
1056 dislikes do does drank drink drinks drinking
1057 drive drives driving drove dying
1058 eat eating eats expand expanded expands
1059 expect expected expects expel expels expelled
1060 explain explained explains
1061 fart farts feel feels felt fight fights find finds finding
1062 forget forgets forgot fought found
1063 fuck fucked fucking fucks
1064 gave get gets getting give gives go goes going gone got gotten
1065 had harm harms has hate hated hates have having
1066 hear heard hears hearing help helped helping helps
1067 hit hits hope hoped hopes hurt hurts
1068 implies imply is
1069 join joined joins jump jumped jumps
1070 keep keeping keeps kept
1071 kill killed killing kills kiss kissed kisses kissing
1072 knew know knows
1073 laid lay lays let lets lie lied lies like liked likes
1074 liking listen listens
1075 login look looked looking looks
1076 lose losing lost
1077 love loved loves loving
1078 luse lusing lust lusts
1079 made make makes making may mean means meant might
1080 move moved moves moving must
1081 need needed needs
1082 order ordered orders ought
1083 paid pay pays pick picked picking picks
1084 placed placing prefer prefers put puts
1085 ran rape raped rapes
1086 read reading reads recall receive received receives
1087 refer refered referred refers
1088 relate related relates remember remembered remembers
1089 romp romped romps run running runs
1090 said sang sat saw say says
1091 screw screwed screwing screws scrod see sees seem seemed
1092 seems seen sell selling sells
1093 send sendind sends sent shall shoot shot should
1094 sing sings sit sits sitting sold studied study
1095 take takes taking talk talked talking talks tell tells telling
1096 think thinks
1097 thought told took tooled touch touched touches touching
1098 transfer transferred transfers transmit transmits transmitted
1099 type types types typing
1100 walk walked walking walks want wanted wants was watch
1101 watched watching went were will wish would work worked works
1102 write writes writing wrote use used uses using))
1103 (put x 'doctor-sentence-type 'verb))
6679505f
JB
1104
1105(defun doctor-verbp (x) (if (symbolp x)
1106 (eq (get x 'doctor-sentence-type) 'verb)))
1107
1108(defun doctor-plural (x)
1109 "Form the plural of the word argument."
1110 (let ((foo (doctor-make-string x)))
1111 (cond ((string-equal (substring foo -1) "s")
1112 (cond ((string-equal (substring foo -2 -1) "s")
1113 (intern (concat foo "es")))
1114 (t x)))
1115 ((string-equal (substring foo -1) "y")
1116 (intern (concat (substring foo 0 -1)
1117 "ies")))
1118 (t (intern (concat foo "s"))))))
1119
1120(defun doctor-setprep (sent key)
1121 (let ((val)
1122 (foo (memq key sent)))
454473ea
JPW
1123 (cond ((doctor-prepp (cadr foo))
1124 (setq val (doctor-getnoun (cddr foo)))
6679505f
JB
1125 (cond (val val)
1126 (t 'something)))
454473ea
JPW
1127 ((doctor-articlep (cadr foo))
1128 (setq val (doctor-getnoun (cddr foo)))
1129 (cond (val (doctor-build (doctor-build (cadr foo) " ") val))
6679505f
JB
1130 (t 'something)))
1131 (t 'something))))
1132
1133(defun doctor-getnoun (x)
121656e9
JB
1134 (cond ((null x) (setq doctor-object 'something))
1135 ((atom x) (setq doctor-object x))
6679505f 1136 ((eq (length x) 1)
869c4186
GM
1137 (setq doctor-object (cond
1138 ((doctor-nounp (setq doctor-object (car x))) doctor-object)
1139 (t (doctor-query doctor-object)))))
6679505f
JB
1140 ((eq (car x) 'to)
1141 (doctor-build 'to\ (doctor-getnoun (cdr x))))
1142 ((doctor-prepp (car x))
1143 (doctor-getnoun (cdr x)))
1144 ((not (doctor-nounp (car x)))
1145 (doctor-build (doctor-build (cdr (assq (car x)
1146 (append
1147 '((a . this)
1148 (some . this)
1149 (one . that))
1150 (list
1151 (cons
1152 (car x) (car x))))))
1153 " ")
1154 (doctor-getnoun (cdr x))))
869c4186 1155 (t (setq doctor-object (car x))
daa6ddb5
RS
1156 (doctor-build (doctor-build (car x) " ") (doctor-getnoun (cdr x))))
1157 ))
6679505f
JB
1158
1159(defun doctor-modifierp (x)
1160 (or (doctor-adjectivep x)
1161 (doctor-adverbp x)
1162 (doctor-othermodifierp x)))
1163
1164(defun doctor-adjectivep (x)
1165 (or (numberp x)
1166 (doctor-nmbrp x)
1167 (doctor-articlep x)
1168 (doctor-colorp x)
1169 (doctor-sizep x)
1170 (doctor-possessivepronounp x)))
1171
1172(defun doctor-adverbp (xx)
b8797e1f
RS
1173 (let ((xxstr (doctor-make-string xx)))
1174 (and (>= (length xxstr) 2)
f8ad4950
GM
1175 (string-equal (substring (doctor-make-string xx) -2) "ly")
1176 (not (memq xx '(family fly jelly rally))))))
6679505f
JB
1177
1178(defun doctor-articlep (x)
1179 (memq x '(the a an)))
1180
1181(defun doctor-nmbrp (x)
1182 (memq x '(one two three four five six seven eight nine ten
1183 eleven twelve thirteen fourteen fifteen
1184 sixteen seventeen eighteen nineteen
1185 twenty thirty forty fifty sixty seventy eighty ninety
1186 hundred thousand million billion
1187 half quarter
1188 first second third fourth fifth
eb8c3be9 1189 sixth seventh eighth ninth tenth)))
a1506d29 1190
6679505f
JB
1191(defun doctor-colorp (x)
1192 (memq x '(beige black blue brown crimson
1193 gray grey green
1194 orange pink purple red tan tawny
1195 violet white yellow)))
1196
1197(defun doctor-sizep (x)
1198 (memq x '(big large tall fat wide thick
1199 small petite short thin skinny)))
1200
1201(defun doctor-possessivepronounp (x)
1202 (memq x '(my your his her our their)))
1203
1204(defun doctor-othermodifierp (x)
1205 (memq x '(all also always amusing any anyway associated awesome
1206 bad beautiful best better but certain clear
1207 ever every fantastic fun funny
0f668406 1208 good great grody gross however if ignorant
6679505f
JB
1209 less linked losing lusing many more much
1210 never nice obnoxious often poor pretty real related rich
1211 similar some stupid super superb
1212 terrible terrific too total tubular ugly very)))
1213
1214(defun doctor-prepp (x)
1215 (memq x '(about above after around as at
1216 before beneath behind beside between by
1217 for from in inside into
1218 like near next of on onto over
1219 same through thru to toward towards
1220 under underneath with without)))
1221
1222(defun doctor-remember (thing)
869c4186
GM
1223 (cond ((null doctor--history)
1224 (setq doctor--history (list thing)))
1225 (t (setq doctor--history (append doctor--history (list thing))))))
6679505f
JB
1226
1227(defun doctor-type (x)
1228 (setq x (doctor-fix-2 x))
1229 (doctor-txtype (doctor-assm x)))
1230
1231(defun doctor-fixup (sent)
1232 (setq sent (append
1233 (cdr
1234 (assq (car sent)
1235 (append
1236 '((me i)
1237 (him he)
1238 (her she)
1239 (them they)
1240 (okay)
1241 (well)
1242 (sigh)
1243 (hmm)
1244 (hmmm)
1245 (hmmmm)
1246 (hmmmmm)
1247 (gee)
1248 (sure)
1249 (great)
1250 (oh)
1251 (fine)
1252 (ok)
1253 (no))
1254 (list (list (car sent)
1255 (car sent))))))
1256 (cdr sent)))
1257 (doctor-fix-2 sent))
1258
1259(defun doctor-fix-2 (sent)
1260 (let ((foo sent))
1261 (while foo
1262 (if (and (eq (car foo) 'me)
454473ea 1263 (doctor-verbp (cadr foo)))
6679505f
JB
1264 (rplaca foo 'i)
1265 (cond ((eq (car foo) 'you)
454473ea 1266 (cond ((memq (cadr foo) '(am be been is))
6679505f 1267 (rplaca (cdr foo) 'are))
454473ea 1268 ((memq (cadr foo) '(has))
6679505f 1269 (rplaca (cdr foo) 'have))
454473ea 1270 ((memq (cadr foo) '(was))
6679505f
JB
1271 (rplaca (cdr foo) 'were))))
1272 ((equal (car foo) 'i)
454473ea 1273 (cond ((memq (cadr foo) '(are is be been))
6679505f 1274 (rplaca (cdr foo) 'am))
454473ea 1275 ((memq (cadr foo) '(were))
6679505f 1276 (rplaca (cdr foo) 'was))
454473ea 1277 ((memq (cadr foo) '(has))
6679505f
JB
1278 (rplaca (cdr foo) 'have))))
1279 ((and (doctor-verbp (car foo))
454473ea
JPW
1280 (eq (cadr foo) 'i)
1281 (not (doctor-verbp (car (cddr foo)))))
6679505f
JB
1282 (rplaca (cdr foo) 'me))
1283 ((and (eq (car foo) 'a)
1284 (doctor-vowelp (string-to-char
454473ea 1285 (doctor-make-string (cadr foo)))))
6679505f
JB
1286 (rplaca foo 'an))
1287 ((and (eq (car foo) 'an)
1288 (not (doctor-vowelp (string-to-char
454473ea 1289 (doctor-make-string (cadr foo))))))
6679505f
JB
1290 (rplaca foo 'a)))
1291 (setq foo (cdr foo))))
1292 sent))
1293
1294(defun doctor-vowelp (x)
1295 (memq x '(?a ?e ?i ?o ?u)))
1296
1297(defun doctor-replace (sent rlist)
1298 "Replace any element of SENT that is the car of a replacement
1299element pair in RLIST."
1300 (apply 'append
1301 (mapcar
6679505f
JB
1302 (lambda (x)
1303 (cdr (or (assq x rlist) ; either find a replacement
869c4186
GM
1304 (list x x)))) ; or fake an identity mapping
1305 sent)))
6679505f
JB
1306
1307(defun doctor-wherego (sent)
121656e9 1308 (cond ((null sent) (doc$ doctor--whereoutp))
6679505f
JB
1309 ((null (doctor-meaning (car sent)))
1310 (doctor-wherego (cond ((zerop (random 2))
1311 (reverse (cdr sent)))
1312 (t (cdr sent)))))
1313 (t
869c4186 1314 (setq doctor-found (car sent))
6679505f
JB
1315 (doctor-meaning (car sent)))))
1316
1317(defun doctor-svo (sent key type mem)
1318 "Find subject, verb and object in sentence SENT with focus on word KEY.
1319TYPE is number of words preceding KEY to start looking for subject.
1320MEM is t if results are to be put on Doctor's memory stack.
869c4186
GM
1321Return in the global variables DOCTOR-SUBJ, DOCTOR-VERB, DOCTOR-OBJECT,
1322and DOCTOR-OBJ."
4746118a 1323 (let ((foo (doctor-subjsearch sent key type)))
6679505f
JB
1324 (or foo
1325 (setq foo sent
1326 mem nil))
1327 (while (and (null (doctor-verbp (car foo))) (cdr foo))
1328 (setq foo (cdr foo)))
869c4186
GM
1329 (setq doctor-verb (car foo))
1330 (setq doctor-obj (doctor-getnoun (cdr foo)))
121656e9
JB
1331 (cond ((eq doctor-object 'i) (setq doctor-object 'me))
1332 ((eq doctor-subj 'me) (setq doctor-subj 'i)))
869c4186 1333 (cond (mem (doctor-remember (list doctor-subj doctor-verb doctor-obj))))))
6679505f
JB
1334
1335(defun doctor-possess (sent key)
1336 "Set possessive in SENT for keyword KEY.
869c4186 1337Hack on previous word, setting global variable DOCTOR-OWNER to correct result."
6679505f
JB
1338 (let* ((i (- (length sent) (length (memq key sent)) 1))
1339 (prev (if (< i 0) 'your
1340 (nth i sent))))
869c4186
GM
1341 (setq doctor-owner
1342 (if (or (doctor-possessivepronounp prev)
1343 (string-equal "s"
1344 (substring (doctor-make-string prev)
1345 -1)))
1346 prev
1347 'your))))
6679505f
JB
1348\f
1349;; Output of replies.
1350
1351(defun doctor-txtype (ans)
1352 "Output to buffer a list of symbols or strings as a sentence."
869c4186 1353 (setq doctor--*print-upcase* t doctor--*print-space* nil)
0ff22356 1354 (mapc 'doctor-type-symbol ans)
6679505f
JB
1355 (insert "\n"))
1356
1357(defun doctor-type-symbol (word)
1358 "Output a symbol to the buffer with some fancy case and spacing hacks."
1359 (setq word (doctor-make-string word))
1360 (if (string-equal word "i") (setq word "I"))
869c4186
GM
1361 (when doctor--*print-upcase*
1362 (setq word (capitalize word))
1363 (if doctor--*print-space* (insert " ")))
6679505f 1364 (cond ((or (string-match "^[.,;:?! ]" word)
869c4186 1365 (not doctor--*print-space*))
6679505f 1366 (insert word))
6f08431c 1367 (t (insert ?\s word)))
a1982090
RS
1368 (and auto-fill-function
1369 (> (current-column) fill-column)
1370 (apply auto-fill-function nil))
869c4186
GM
1371 (setq doctor--*print-upcase* (string-match "[.?!]$" word)
1372 doctor--*print-space* t))
6679505f
JB
1373
1374(defun doctor-build (str1 str2)
1375 "Make a symbol out of the concatenation of the two non-list arguments."
1376 (cond ((null str1) str2)
1377 ((null str2) str1)
1378 ((and (atom str1)
1379 (atom str2))
1380 (intern (concat (doctor-make-string str1)
1381 (doctor-make-string str2))))
1382 (t nil)))
1383
1384(defun doctor-make-string (obj)
1385 (cond ((stringp obj) obj)
1386 ((symbolp obj) (symbol-name obj))
1387 ((numberp obj) (int-to-string obj))
1388 (t "")))
1389
1390(defun doctor-concat (x y)
1391 "Like append, but force atomic arguments to be lists."
1392 (append
1393 (if (and x (atom x)) (list x) x)
1394 (if (and y (atom y)) (list y) y)))
1395
1396(defun doctor-assm (proto)
1397 (cond ((null proto) nil)
1398 ((atom proto) (list proto))
1399 ((atom (car proto))
1400 (cons (car proto) (doctor-assm (cdr proto))))
1401 (t (doctor-concat (doctor-assm (eval (car proto))) (doctor-assm (cdr proto))))))
1402\f
1403;; Functions that handle specific words or meanings when found.
1404
1405(defun doctor-go (destination)
1406 "Call a `doctor-*' function."
1407 (funcall (intern (concat "doctor-" (doctor-make-string destination)))))
1408
1409(defun doctor-desire1 ()
869c4186 1410 (doctor-go (doc$ doctor--whereoutp)))
6679505f
JB
1411
1412(defun doctor-huh ()
869c4186
GM
1413 (cond ((< (length doctor-sent) 9) (doctor-type (doc$ doctor--huhlst)))
1414 (t (doctor-type (doc$ doctor--longhuhlst)))))
6679505f 1415
869c4186 1416(defun doctor-rthing () (doctor-type (doc$ doctor--thlst)))
6679505f 1417
121656e9 1418(defun doctor-remem () (cond ((null doctor--history) (doctor-huh))
869c4186 1419 ((doctor-type (doc$ doctor--remlst)))))
6679505f
JB
1420
1421(defun doctor-howdy ()
869c4186
GM
1422 (cond ((not doctor--howdyflag)
1423 (doctor-type '((doc$ doctor--hello) what brings you to see me \?))
1424 (setq doctor--howdyflag t))
6679505f 1425 (t
869c4186
GM
1426 (doctor-type '((doc$ doctor--ibelieve) we\'ve introduced ourselves already \.))
1427 (doctor-type '((doc$ doctor--please) (doc$ doctor--describe) (doc$ doctor--things) \.)))))
6679505f
JB
1428
1429(defun doctor-when ()
121656e9 1430 (cond ((< (length (memq doctor-found doctor-sent)) 3) (doctor-short))
6679505f 1431 (t
869c4186
GM
1432 (setq doctor-sent (cdr (memq doctor-found doctor-sent)))
1433 (setq doctor-sent (doctor-fixup doctor-sent))
121656e9 1434 (doctor-type '((doc$ doctor--whatwhen) (doc// doctor-sent) \?)))))
6679505f
JB
1435
1436(defun doctor-conj ()
121656e9 1437 (cond ((< (length (memq doctor-found doctor-sent)) 4) (doctor-short))
6679505f 1438 (t
869c4186
GM
1439 (setq doctor-sent (cdr (memq doctor-found doctor-sent)))
1440 (setq doctor-sent (doctor-fixup doctor-sent))
1441 (cond ((eq (car doctor-sent) 'of)
1442 (doctor-type '(are you (doc$ doctor--sure) that is the real reason \?))
1443 (setq doctor--things (cons (cdr doctor-sent) doctor--things)))
6679505f 1444 (t
869c4186
GM
1445 (doctor-remember doctor-sent)
1446 (doctor-type (doc$ doctor--beclst)))))))
6679505f
JB
1447
1448(defun doctor-short ()
869c4186
GM
1449 (cond ((= (car doctor--repetitive-shortness) (1- doctor--lincount))
1450 (rplacd doctor--repetitive-shortness
1451 (1+ (cdr doctor--repetitive-shortness))))
6679505f 1452 (t
869c4186
GM
1453 (rplacd doctor--repetitive-shortness 1)))
1454 (rplaca doctor--repetitive-shortness doctor--lincount)
1455 (cond ((> (cdr doctor--repetitive-shortness) 6)
1456 (cond ((not doctor--**mad**)
1457 (doctor-type '((doc$ doctor--areyou)
6679505f
JB
1458 just trying to see what kind of things
1459 i have in my vocabulary \? please try to
1460 carry on a reasonable conversation!))
869c4186 1461 (setq doctor--**mad** t))
6679505f
JB
1462 (t
1463 (doctor-type '(i give up \. you need a lesson in creative
1464 writing \.\.\.))
6679505f
JB
1465 )))
1466 (t
869c4186
GM
1467 (cond ((equal doctor-sent (doctor-assm '(yes)))
1468 (doctor-type '((doc$ doctor--isee) (doc$ doctor--inter) (doc$ doctor--whysay) this is so \?)))
1469 ((equal doctor-sent (doctor-assm '(because)))
1470 (doctor-type (doc$ doctor--shortbeclst)))
1471 ((equal doctor-sent (doctor-assm '(no)))
1472 (doctor-type (doc$ doctor--neglst)))
1473 (t (doctor-type (doc$ doctor--shortlst)))))))
a1506d29 1474
869c4186 1475(defun doctor-alcohol () (doctor-type (doc$ doctor--drnk)))
6679505f
JB
1476
1477(defun doctor-desire ()
869c4186 1478 (let ((foo (memq doctor-found doctor-sent)))
6679505f 1479 (cond ((< (length foo) 2)
869c4186 1480 (doctor-go (doctor-build (doctor-meaning doctor-found) 1)))
454473ea 1481 ((memq (cadr foo) '(a an))
6679505f 1482 (rplacd foo (append '(to have) (cdr foo)))
869c4186
GM
1483 (doctor-svo doctor-sent doctor-found 1 nil)
1484 (doctor-remember (list doctor-subj 'would 'like doctor-obj))
1485 (doctor-type (doc$ doctor--whywant)))
454473ea 1486 ((not (eq (cadr foo) 'to))
869c4186 1487 (doctor-go (doctor-build (doctor-meaning doctor-found) 1)))
6679505f 1488 (t
869c4186
GM
1489 (doctor-svo doctor-sent doctor-found 1 nil)
1490 (doctor-remember (list doctor-subj 'would 'like doctor-obj))
1491 (doctor-type (doc$ doctor--whywant))))))
6679505f
JB
1492
1493(defun doctor-drug ()
869c4186
GM
1494 (doctor-type (doc$ doctor--drugs))
1495 (doctor-remember (list 'you 'used doctor-found)))
6679505f
JB
1496
1497(defun doctor-toke ()
869c4186 1498 (doctor-type (doc$ doctor--toklst)))
6679505f
JB
1499
1500(defun doctor-state ()
121656e9 1501 (doctor-type (doc$ doctor--states)) (doctor-remember (list 'you 'were doctor-found)))
6679505f
JB
1502
1503(defun doctor-mood ()
121656e9 1504 (doctor-type (doc$ doctor--moods)) (doctor-remember (list 'you 'felt doctor-found)))
6679505f
JB
1505
1506(defun doctor-fear ()
869c4186
GM
1507 (setq doctor--feared (doctor-setprep doctor-sent doctor-found))
1508 (doctor-type (doc$ doctor--fears))
1509 (doctor-remember (list 'you 'were 'afraid 'of doctor--feared)))
6679505f
JB
1510
1511(defun doctor-hate ()
869c4186
GM
1512 (doctor-svo doctor-sent doctor-found 1 t)
1513 (cond ((memq 'not doctor-sent) (doctor-forget) (doctor-huh))
1514 ((equal doctor-subj 'you)
121656e9
JB
1515 (doctor-type '(why do you (doc// doctor-verb) (doc// doctor-obj) \?)))
1516 (t (doctor-type '((doc$ doctor--whysay) (list doctor-subj doctor-verb doctor-obj))))))
6679505f
JB
1517
1518(defun doctor-symptoms ()
869c4186 1519 (doctor-type '((doc$ doctor--maybe) you should consult a medical doctor\;
a8bccd82 1520 i am a psychotherapist. \.)))
6679505f
JB
1521
1522(defun doctor-hates ()
869c4186 1523 (doctor-svo doctor-sent doctor-found 1 t)
6679505f
JB
1524 (doctor-hates1))
1525
1526(defun doctor-hates1 ()
121656e9 1527 (doctor-type '((doc$ doctor--whysay) (list doctor-subj doctor-verb doctor-obj) \?)))
6679505f
JB
1528
1529(defun doctor-loves ()
869c4186 1530 (doctor-svo doctor-sent doctor-found 1 t)
6679505f
JB
1531 (doctor-qloves))
1532
1533(defun doctor-qloves ()
121656e9 1534 (doctor-type '((doc$ doctor--bother) (list doctor-subj doctor-verb doctor-obj) \?)))
6679505f
JB
1535
1536(defun doctor-love ()
869c4186
GM
1537 (doctor-svo doctor-sent doctor-found 1 t)
1538 (cond ((memq 'not doctor-sent) (doctor-forget) (doctor-huh))
1539 ((memq 'to doctor-sent) (doctor-hates1))
6679505f 1540 (t
869c4186
GM
1541 (cond ((equal doctor-object 'something)
1542 (setq doctor-object '(this person you love))))
1543 (cond ((equal doctor-subj 'you)
1544 (setq doctor--lover doctor-obj)
1545 (cond ((equal doctor--lover '(this person you love))
1546 (setq doctor--lover '(your partner))
6679505f
JB
1547 (doctor-forget)
1548 (doctor-type '(with whom are you in love \?)))
869c4186
GM
1549 ((doctor-type '((doc$ doctor--please)
1550 (doc$ doctor--describe)
1551 (doc$ doctor--relation)
1552 (doc// doctor--lover)
6679505f 1553 \.)))))
869c4186 1554 ((equal doctor-subj 'i)
6679505f
JB
1555 (doctor-txtype '(we were discussing you!)))
1556 (t (doctor-forget)
869c4186
GM
1557 (setq doctor-obj 'someone)
1558 (setq doctor-verb (doctor-build doctor-verb 's))
6679505f
JB
1559 (doctor-qloves))))))
1560
1561(defun doctor-mach ()
869c4186
GM
1562 (setq doctor-found (doctor-plural doctor-found))
1563 (doctor-type (doc$ doctor--machlst)))
6679505f
JB
1564
1565(defun doctor-sexnoun () (doctor-sexverb))
1566
1567(defun doctor-sexverb ()
121656e9 1568 (if (or (memq 'me doctor-sent) (memq 'myself doctor-sent) (memq 'i doctor-sent))
6679505f 1569 (doctor-foul)
869c4186 1570 (doctor-type (doc$ doctor--sexlst))))
6679505f 1571
f535f6b2 1572(defun doctor-death ()
869c4186
GM
1573 (cond (doctor--suicide-flag (doctor-type (doc$ doctor--deathlst)))
1574 ((or (equal doctor-found 'suicide)
1575 (and (or (equal doctor-found 'kill)
1576 (equal doctor-found 'killing))
1577 (memq 'yourself doctor-sent)))
1578 (setq doctor--suicide-flag t)
f535f6b2
RS
1579 (doctor-type '(If you are really suicidal, you might
1580 want to contact the Samaritans via
1581 E-mail: jo@samaritans.org or, at your option,
e597d8fb
GM
1582 anonymous E-mail: samaritans@anon.twwells.com\ \.
1583 or find a Befrienders crisis center at
1584 http://www.befrienders.org/\ \.
869c4186
GM
1585 (doc$ doctor--please) (doc$ doctor--continue) \.)))
1586 (t (doctor-type (doc$ doctor--deathlst)))))
6679505f
JB
1587
1588(defun doctor-foul ()
869c4186 1589 (doctor-type (doc$ doctor--foullst)))
6679505f
JB
1590
1591(defun doctor-family ()
869c4186
GM
1592 (doctor-possess doctor-sent doctor-found)
1593 (doctor-type (doc$ doctor--famlst)))
6679505f
JB
1594
1595;; I did not add this -- rms.
1596;; But he might have removed it. I put it back. --roland
1597(defun doctor-rms ()
869c4186
GM
1598 (cond (doctor--rms-flag (doctor-type (doc$ doctor--stallmanlst)))
1599 (t (setq doctor--rms-flag t) (doctor-type '(do you know Stallman \?)))))
6679505f 1600
869c4186 1601(defun doctor-school nil (doctor-type (doc$ doctor--schoollst)))
6679505f
JB
1602
1603(defun doctor-eliza ()
869c4186
GM
1604 (cond (doctor--eliza-flag (doctor-type (doc$ doctor--elizalst)))
1605 (t (setq doctor--eliza-flag t)
1606 (doctor-type '((doc// doctor-found) \? hah !
1607 (doc$ doctor--please) (doc$ doctor--continue) \.)))))
a1506d29 1608
869c4186 1609(defun doctor-sports () (doctor-type (doc$ doctor--sportslst)))
6679505f 1610
869c4186 1611(defun doctor-math () (doctor-type (doc$ doctor--mathlst)))
6679505f
JB
1612
1613(defun doctor-zippy ()
869c4186
GM
1614 (cond (doctor--zippy-flag (doctor-type (doc$ doctor--zippylst)))
1615 (t (setq doctor--zippy-flag t)
6679505f
JB
1616 (doctor-type '(yow! are we interactive yet \?)))))
1617
1618
869c4186 1619(defun doctor-chat () (doctor-type (doc$ doctor--chatlst)))
6679505f 1620
d2fe6685
GM
1621(random t)
1622
896546cd
RS
1623(provide 'doctor)
1624
c0274f38 1625;;; doctor.el ends here