- commit
- 236100055d87ef1130b23b9bd3d131337435ae8e
- parent
- f40cd422f446fbc1eeeaf60f67690e494f53aca3
- Author
- Guillaume BINET <gbin@gootz.net>
- Date
- 2012-11-08 23:09
cleanup
Diffstat
| M | eliza.py | 24 | +----------------------- |
1 files changed, 1 insertions, 23 deletions
diff --git a/eliza.py b/eliza.py
@@ -22,7 +22,7 @@ class Eliza: 22 22 #---------------------------------------------------------------------- 23 23 def translate(self,str,dict): 24 24 words = string.split(string.lower(str))25 -1 keys = dict.keys();-1 25 keys = dict.keys() 26 26 for i in range(0,len(words)): 27 27 if words[i] in keys: 28 28 words[i] = dict[words[i]] @@ -287,25 +287,3 @@ gPats = [ 287 287 "How do you feel when you say that?"]] 288 288 ] 289 289290 -1 #----------------------------------------------------------------------291 -1 # command_interface292 -1 #----------------------------------------------------------------------293 -1 def command_interface():294 -1 print "Therapist\n---------"295 -1 print "Talk to the program by typing in plain English, using normal upper-"296 -1 print 'and lower-case letters and punctuation. Enter "quit" when done.'297 -1 print '='*72298 -1 print "Hello. How are you feeling today?"299 -1 s = ""300 -1 therapist = eliza();301 -1 while s != "quit":302 -1 try: s = raw_input(">")303 -1 except EOFError:304 -1 s = "quit"305 -1 print s306 -1 while s[-1] in "!.": s = s[:-1]307 -1 print therapist.respond(s)308 -1309 -1310 -1 if __name__ == "__main__":311 -1 command_interface()