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