22 self.
keys =
list(
map(
lambda x: re.compile(x[0], re.IGNORECASE), gPats))
30 words = str.lower().
split()
32 for i
in range(0, len(words)):
34 words[i] = dict[words[i]]
35 return " ".join(words)
44 for i
in range(0, len(self.
keys)):
49 resp = random.choice(self.
values[i])
54 num =
int(resp[pos + 1:pos + 2])
57 gReflections) + resp[pos + 2:]
62 resp = resp[:-2] +
'.'
64 resp = resp[:-2] +
'?'
98 [
r'I need (.*)', [
'Why do you need %1?',
99 'Would it really help you to get %1?',
'Are you sure you need %1?'
101 [
r'Why don\'?t you ([^\?]*)\??', [
"Do you really think I don't %1?"
102 ,
'Perhaps eventually I will %1.',
'Do you really want me to %1?'
104 [
r'Why can\'?t I ([^\?]*)\??',
105 [
'Do you think you should be able to %1?',
106 'If you could %1, what would you do?',
107 "I don't know -- why can't you %1?",
'Have you really tried?']],
108 [
r'I can\'?t (.*)', [
"How do you know you can't %1?",
109 'Perhaps you could %1 if you tried.',
110 'What would it take for you to %1?']],
111 [
r'I am (.*)', [
'Did you come to me because you are %1?',
112 'How long have you been %1?',
'How do you feel about being %1?']],
113 [
r'I\'?m (.*)', [
'How does being %1 make you feel?',
114 'Do you enjoy being %1?',
"Why do you tell me you're %1?",
115 "Why do you think you're %1?"]],
116 [
r'Are you ([^\?]*)\??', [
'Why does it matter whether I am %1?',
117 'Would you prefer it if I were not %1?',
118 'Perhaps you believe I am %1.',
'I may be %1 -- what do you think?'
120 [
r'What (.*)', [
'Why do you ask?',
121 'How would an answer to that help you?',
'What do you think?']],
122 [
r'How (.*)', [
'How do you suppose?',
123 'Perhaps you can answer your own question.',
124 "What is it you're really asking?"]],
125 [
r'Because (.*)', [
'Is that the real reason?',
126 'What other reasons come to mind?',
127 'Does that reason apply to anything else?',
128 'If %1, what else must be true?']],
130 [
'There are many times when no apology is needed.',
131 'What feelings do you have when you apologize?']],
132 [
r'(Hi)|(Hello(.*))', [
"Hello... I'm glad you could drop by today.",
133 'Hi there... how are you today?',
134 'Greetings, how are you?',
135 'Hello, how are you feeling today?']],
136 [
r'I think (.*)', [
'Do you doubt %1?',
'Do you really think so?',
137 "But you're not sure %1?"]],
138 [
r'(.*) friend (.*)', [
'Tell me more about your friends.',
139 'When you think of a friend, what comes to mind?',
140 "Why don't you tell me about a childhood friend?"]],
141 [
r'Yes', [
'You seem quite sure.',
'OK, but can you elaborate a bit?'
143 [
r'(.*) computer(.*)', [
'Are you really talking about me?',
144 'Does it seem strange to talk to a computer?',
145 'How do computers make you feel?',
146 'Do you feel threatened by computers?']],
147 [
r'Is it (.*)', [
'Do you think it is %1?',
148 "Perhaps it's %1 -- what do you think?",
149 'If it were %1, what would you do?',
'It could well be that %1.'
151 [
r'It is (.*)', [
'You seem very certain.',
152 "If I told you that it probably isn't %1, what would you feel?"]],
153 [
r'Can you ([^\?]*)\??', [
"What makes you think I can't %1?",
154 'If I could %1, then what?',
'Why do you ask if I can %1?']],
155 [
r'Can I ([^\?]*)\??', [
"Perhaps you don't want to %1.",
156 'Do you want to be able to %1?',
'If you could %1, would you?']],
157 [
r'You are (.*)', [
'Why do you think I am %1?',
158 "Does it please you to think that I'm %1?",
159 'Perhaps you would like me to be %1.',
160 "Perhaps you're really talking about yourself?"]],
161 [
r'You\'?re (.*)', [
'Why do you say I am %1?',
162 'Why do you think I am %1?',
'Are we talking about you, or me?']],
163 [
r'I don\'?t (.*)', [
"Don't you really %1?",
"Why don't you %1?",
164 'Do you want to %1?']],
165 [
r'I feel (.*)', [
'Good, tell me more about these feelings.',
166 'Do you often feel %1?',
'When do you usually feel %1?',
167 'When you feel %1, what do you do?']],
168 [
r'I have (.*)', [
"Why do you tell me that you've %1?",
169 'Have you really %1?',
170 'Now that you have %1, what will you do next?']],
171 [
r'I would (.*)', [
'Could you explain why you would %1?',
172 'Why would you %1?',
'Who else knows that you would %1?']],
173 [
r'Is there (.*)', [
'Do you think there is %1?',
174 "It's likely that there is %1.",
'Would you like there to be %1?'
176 [
r'My (.*)', [
'I see, your %1.',
'Why do you say that your %1?',
177 'When your %1, how do you feel?']],
178 [
r'You (.*)', [
'We should be discussing you, not me.',
179 'Why do you say that about me?',
'Why do you care whether I %1?'
181 [
r'Why (.*)', [
"Why don't you tell me the reason why %1?",
182 'Why do you think %1?']],
183 [
r'I want (.*)', [
'What would it mean to you if you got %1?',
184 'Why do you want %1?',
'What would you do if you got %1?',
185 'If you got %1, then what would you do?']],
186 [
r'(.*) mother(.*)', [
'Tell me more about your mother.',
187 'What was your relationship with your mother like?',
188 'How do you feel about your mother?',
189 'How does this relate to your feelings today?',
190 'Good family relations are important.']],
191 [
r'(.*) father(.*)', [
'Tell me more about your father.',
192 'How did your father make you feel?',
193 'How do you feel about your father?',
194 'Does your relationship with your father relate to your feelings today?'
195 ,
'Do you have trouble showing affection with your family?']],
196 [
r'(.*) child(.*)', [
'Did you have close friends as a child?',
197 'What is your favorite childhood memory?',
198 'Do you remember any dreams or nightmares from childhood?',
199 'Did the other children sometimes tease you?',
200 'How do you think your childhood experiences relate to your feelings today?'
202 [
r'(.*)\?', [
'Why do you ask that?',
203 'Please consider whether you can answer your own question.',
204 'Perhaps the answer lies within yourself?',
205 "Why don't you tell me?"]],
206 [
r'bye', [
'Thank you for talking with me.',
'Good-bye.',
207 'Thank you, that will be $150. Have a good day!']],
209 'Please tell me more.',
210 "Let's change focus a bit... Tell me about your family.",
211 'Can you elaborate on that?',
212 'Why do you say that %1?',
216 'I see. And what does that tell you?',
217 'How does that make you feel?',
218 'How do you feel when you say that?',
224 whoami = Crossfire.WhoAmI()
225 message = Crossfire.WhatIsMessage()
227 while message[-1]
in '!.':
228 message = message[:-1]
232 whoami.Say(therapist.respond(message))
235 if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.SAY: