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