Started work on matching
[eliza.git] / read-yaml-rules.ipynb
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "metadata": {
7 "collapsed": true
8 },
9 "outputs": [],
10 "source": [
11 "import yaml"
12 ]
13 },
14 {
15 "cell_type": "code",
16 "execution_count": 2,
17 "metadata": {
18 "collapsed": false
19 },
20 "outputs": [
21 {
22 "data": {
23 "text/plain": [
24 "[{'pattern': '?X hello ?Y',\n",
25 " 'responses': ['how do you do. please state your problem']},\n",
26 " {'pattern': '?X computer ?Y',\n",
27 " 'responses': ['do computers worry you',\n",
28 " 'what do you think about machines',\n",
29 " 'why do you mention computers',\n",
30 " 'what do you think machines have to do with your problem']},\n",
31 " {'pattern': '?X name ?Y', 'responses': ['i am not interested in names']},\n",
32 " {'pattern': '?X sorry ?Y',\n",
33 " 'responses': [\"please don't apologize\",\n",
34 " 'apologies are not necessary',\n",
35 " 'what feelings do you have when you apologize']},\n",
36 " {'pattern': '?X i remember ?Y',\n",
37 " 'responses': ['do you often think of ?Y',\n",
38 " 'does thinking of ?Y bring anything else to mind',\n",
39 " 'what else do you remember?',\n",
40 " 'why do you recall ?Y right now',\n",
41 " 'what in this present situation reminds you of ?Y',\n",
42 " 'what is the connection between me and ?Y']},\n",
43 " {'pattern': '?X do you remember ?Y',\n",
44 " 'responses': ['did you think i would forget ?Y',\n",
45 " 'why do you think i should recall ?Y',\n",
46 " 'what about ?Y',\n",
47 " 'you mentioned ?Y']},\n",
48 " {'pattern': '?X if ?Y',\n",
49 " 'responses': ['do you really think it is likely that ?Y',\n",
50 " 'do you wish that ?Y',\n",
51 " 'what do you think about ?Y',\n",
52 " 'really -- if ?Y']},\n",
53 " {'pattern': '?X i dreamt ?Y',\n",
54 " 'responses': ['really -- ?Y',\n",
55 " 'have you ever fantasized ?Y while you were awake',\n",
56 " 'have you dreamt ?Y before']},\n",
57 " {'pattern': '?X i dreamed ?Y',\n",
58 " 'responses': ['really -- ?Y',\n",
59 " 'have you ever fantasized ?Y while you were awake',\n",
60 " 'have you dreamed ?Y before']},\n",
61 " {'pattern': '?X dream ?Y',\n",
62 " 'responses': ['what does this dream suggest to you',\n",
63 " 'do you dream often',\n",
64 " 'what persons appear in your dreams',\n",
65 " \"don't you believe that dream has to do with your problem\"]},\n",
66 " {'pattern': '?X my mother ?Y',\n",
67 " 'responses': ['who else is in your family ?Y',\n",
68 " 'tell me more about your family']},\n",
69 " {'pattern': '?X my father ?Y',\n",
70 " 'responses': ['your father',\n",
71 " 'does he influence you strongly',\n",
72 " 'what else comes to mind when you think of your father']},\n",
73 " {'pattern': '?X i want ?Y',\n",
74 " 'responses': ['what would it mean if you got ?Y',\n",
75 " 'why do you want ?Y',\n",
76 " 'suppose you got ?Y soon']},\n",
77 " {'pattern': '?X i am glad ?Y',\n",
78 " 'responses': ['how have i helped you to be ?Y',\n",
79 " 'what makes you happy just now',\n",
80 " 'can you explain why you are suddenly ?Y']},\n",
81 " {'pattern': '?X i am happy ?Y',\n",
82 " 'responses': ['how have i helped you to be ?Y',\n",
83 " 'what makes you glad just now',\n",
84 " 'can you explain why you are suddenly ?Y']},\n",
85 " {'pattern': '?X i am sad ?Y',\n",
86 " 'responses': ['i am sorry to hear you are depressed',\n",
87 " \"i'm sure it's not pleasant to be sad\"]},\n",
88 " {'pattern': '?X i am unhappy ?Y',\n",
89 " 'responses': ['i am sorry to hear you are depressed',\n",
90 " \"i'm sure it's not pleasant to be unhappy\"]},\n",
91 " {'pattern': '?X are like ?Y',\n",
92 " 'responses': ['what resemblence do you see between ?X and ?Y']},\n",
93 " {'pattern': '?X is like ?Y',\n",
94 " 'responses': ['in what way is it that ?X is like ?Y',\n",
95 " 'what resemblence do you see',\n",
96 " 'could there really be some connection',\n",
97 " 'how']},\n",
98 " {'pattern': '?X alike ?Y',\n",
99 " 'responses': ['in what way', 'what similarities are there']},\n",
100 " {'pattern': '?X same ?Y', 'responses': ['what other connections do you see']},\n",
101 " {'pattern': '?X i was ?Y',\n",
102 " 'responses': ['were you really',\n",
103 " 'perhaps i already knew you were ?Y',\n",
104 " 'why do you tell me you were ?Y now']},\n",
105 " {'pattern': '?X was i ?Y',\n",
106 " 'responses': ['what if you were ?Y',\n",
107 " 'do you think you were ?Y',\n",
108 " 'what would it mean if you were ?Y']},\n",
109 " {'pattern': '?X i am ?Y',\n",
110 " 'responses': ['in what way are you ?Y', 'do you want to be ?Y']},\n",
111 " {'pattern': '?X am i ?Y',\n",
112 " 'responses': ['do you believe you are ?Y',\n",
113 " 'would you want to be ?Y',\n",
114 " 'you wish i would tell you you are ?Y',\n",
115 " 'what would it mean if you were ?Y']},\n",
116 " {'pattern': '?X am ?Y',\n",
117 " 'responses': ['why do you say \"am\"', \"i don't understand that\"]},\n",
118 " {'pattern': '?X are you ?Y',\n",
119 " 'responses': ['why are you interested in whether i am ?Y or not',\n",
120 " \"would you prefer it if i weren't ?Y\",\n",
121 " 'perhaps i am ?Y in your fantasies']},\n",
122 " {'pattern': '?X you are ?Y', 'responses': ['what makes you think i am ?Y']},\n",
123 " {'pattern': '?X because ?Y',\n",
124 " 'responses': ['is that the real reason',\n",
125 " 'what other reason might there be',\n",
126 " 'does that reason seem to explain anything else']},\n",
127 " {'pattern': '?X were you ?Y',\n",
128 " 'responses': ['perhaps i was ?Y',\n",
129 " 'what do you think',\n",
130 " 'what if i had been ?Y']},\n",
131 " {'pattern': \"?X i can't ?Y\",\n",
132 " 'responses': ['maybe you could ?Y now', 'what if you could ?Y']},\n",
133 " {'pattern': '?X i feel ?Y', 'responses': ['do you often feel ?Y']},\n",
134 " {'pattern': '?X i felt ?Y', 'responses': ['what other feelings do you have']},\n",
135 " {'pattern': '?X i ?Y you ?Z',\n",
136 " 'responses': ['perhaps in your fantasies we ?Y each other']},\n",
137 " {'pattern': \"?X why don't you ?Y\",\n",
138 " 'responses': ['should you ?Y yourself',\n",
139 " \"do you believe i don't ?Y\",\n",
140 " 'perhaps i will ?Y in good time']},\n",
141 " {'pattern': '?X yes ?Y',\n",
142 " 'responses': ['you seem quite positive', 'you are sure', 'i understand']},\n",
143 " {'pattern': '?X no ?Y',\n",
144 " 'responses': ['why not',\n",
145 " 'you are being a bit negative',\n",
146 " 'are you saying \"no\" just to be negative']},\n",
147 " {'pattern': '?X someone ?Y', 'responses': ['can you be more specific']},\n",
148 " {'pattern': '?X everyone ?Y',\n",
149 " 'responses': ['surely not everyone',\n",
150 " 'can you think of anyone in particular',\n",
151 " 'who for example',\n",
152 " 'you are thinking of a special person']},\n",
153 " {'pattern': '?X always ?Y',\n",
154 " 'responses': ['can you think of a specific example',\n",
155 " 'when',\n",
156 " 'what incident are you thinking of',\n",
157 " 'really -- always']},\n",
158 " {'pattern': '?X what ?Y',\n",
159 " 'responses': ['why do you ask',\n",
160 " 'does that question interest you',\n",
161 " 'what is it you really want to know',\n",
162 " 'what do you think',\n",
163 " 'what comes to your mind when you ask that']},\n",
164 " {'pattern': '?X perhaps ?Y', 'responses': ['you do not seem quite certain']},\n",
165 " {'pattern': '?X are ?Y',\n",
166 " 'responses': ['do you think they might not be ?Y', 'possibly they are ?Y']},\n",
167 " {'pattern': '?X',\n",
168 " 'responses': ['very interesting',\n",
169 " 'i am not sure i understand you fully',\n",
170 " 'what does that suggest to you',\n",
171 " 'please continue',\n",
172 " 'go on',\n",
173 " 'do you feel strongly about discussing such things']}]"
174 ]
175 },
176 "execution_count": 2,
177 "metadata": {},
178 "output_type": "execute_result"
179 }
180 ],
181 "source": [
182 "with open('rules.yaml') as f:\n",
183 " rules = yaml.load(f)\n",
184 "rules"
185 ]
186 }
187 ],
188 "metadata": {
189 "kernelspec": {
190 "display_name": "Python 3",
191 "language": "python",
192 "name": "python3"
193 },
194 "language_info": {
195 "codemirror_mode": {
196 "name": "ipython",
197 "version": 3
198 },
199 "file_extension": ".py",
200 "mimetype": "text/x-python",
201 "name": "python",
202 "nbconvert_exporter": "python",
203 "pygments_lexer": "ipython3",
204 "version": "3.4.3"
205 }
206 },
207 "nbformat": 4,
208 "nbformat_minor": 0
209 }