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