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