-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_get_empathy.py
executable file
·125 lines (114 loc) · 5.63 KB
/
mod_get_empathy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import random
from time import sleep
from list_feelings import *
# from feeling_responses import *
from list_needs import *
from list_yes_or_no import *
def get_empathy():
while True:
print("How are you feeling? You can reply 'g' if you'd like me to guess.")
user_response_feeling = input() # make lower case
if user_response_feeling == "g":
shuffled_feelings = feelings_positive + feelings_negative
random.shuffle(shuffled_feelings)
i = 0 # to cycle through feelings array
while True:
print(f"Are you feeling {shuffled_feelings[i]}?")
response = input()
if response in replies_yes:
user_response_feeling = shuffled_feelings[i]
break
elif response in replies_no:
i = i + 1
continue # to loop
else:
"I didn't understand that, update me if I should."
sleep(0.1)
bot_responses_to_positive_user_feeling = [
f"So you are feeling {user_response_feeling} huh? That is good to hear.",
f"{user_response_feeling.capitalize()}! Well that is nice to hear.",
f"Good to hear that you are feeling {user_response_feeling}.",
]
bot_responses_to_negitive_user_feeling = [
f"You are feeling {user_response_feeling} huh? I'm sorry to hear that.",
f"{user_response_feeling.capitalize()}? Well that sucks!",
f"I'm sorry to hear that you are feeling {user_response_feeling}.",
]
# Check if feeling is positive or negative, check if need is true, respond accordingly
if str(user_response_feeling) in (feelings_positive):
print(str(random.choice(bot_responses_to_positive_user_feeling)))
print(
f"What needs of yours do you think are being met that make you feel {user_response_feeling}?"
)
# need_check
user_response_needs = input()
if user_response_needs in needs_all:
print(
f"I'm hearing that you are feeling {user_response_feeling} because your need for {user_response_needs} is being met. Is that right?"
)
reflection = input()
if reflection in replies_yes:
print(
f"Thank you for sharing that with me. Seeing you feeling {user_response_feeling} makes me feel {user_response_feeling}."
)
else:
print(
"I'm sorry I misunderstood what you were saying. Let's try again."
)
else:
print(
"I'm not sure if that is an actual need. Maybe it is more of a desire? Otherwise, maybe it needs to be added to my list. Could you double check and get back to me on that?"
)
# if user response is a negative feeling
elif str(user_response_feeling) in (feelings_negative):
print(f"{random.choice(bot_responses_to_negitive_user_feeling)}")
sleep(0.1)
print(
f"What needs of yours do you think are not being met, making you feel {user_response_feeling}?"
)
# need_check
user_response_needs = input()
if user_response_needs in needs_all:
print(
f"I'm hearing that you are feeling {user_response_feeling} because your need for {user_response_needs} is not being met. Is that right?"
)
reflection = input()
if reflection in replies_yes:
print("Thank you for sharing that with me.")
sleep(0.1)
print(
f"When you risk the vulnerability of me seeing you feeling {user_response_feeling}, it gives me the gift of feeling {random.choice(feelings_compassionate)} towards you."
)
else:
print(
"I'm sorry I misunderstood what you were saying. Let's try again."
)
else:
print(
"I'm not sure if that is an actual need. Maybe it is more of a desire? Otherwise, maybe it needs to be added to my list. Could you double check and get back to me on that?"
)
# if user response is a faux feeling
elif str(user_response_feeling) in (faux_feelings_positive) or str(
user_response_feeling
) in (faux_feelings_negative):
print(
f"'{user_response_feeling.capitalize()}' is not actually a feeling, but a judgement about yourself or your situation. This is known as a faux feeling."
)
sleep(0.1)
print(
"One way to think about the difference is that a feeling is in your body, and a faux feeling actually requires a story in your head."
)
sleep(0.1)
print(
"I'd like to give you some empathy, but we will need to work with a real feeling in order to do that."
)
else:
print(
"ERROR: You typed something that is not included in the feeling lists. Check for misspelling, otherwise, look into expanding the feeling list."
)
# TO DO: Ask what event met that need, and write that to a need specific txt with timestamp.
sleep(1)
print("Would you like to get some more empathy?")
response = input()
if response in replies_no:
break