Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#assuming the rest is done
#if someone just wants to be listened to make sure it replies to certain words to make sure they are being listened to
#advice box, if they say certain things it will detect the words
#yes = open("yes.txt","r")
#yeswords = yes.read()
#if answer == yeswords:
#print("whatever the yes is for this")
def unsatisfied_service(): #asks why they aren't happy with their service
answer = str(input("I'm sorry to hear that, why aren't you happy with your service?"))
a = answer.split(". ")
fb = open("feedbackwords.txt","r")
fbwords = fb.read().splitlines()
for word in a:
if any((True for word in a if word in fbwords)):
print("We work hard to make sure our services are helpful. I'm sorry that I was unable to help")
yn = str(input("Would you like your feedback to be recorded?"))
if yn.lower() == "yes":
feedback = open("Feedback.txt","w+")
feedback.write(answer + "\n") # writes answer to file and makes a new line
feedback.close()
print("Your feedback has been recorded, thank you for answering")
else:
("Thank you for telling us. Your data HAS NOT been recorded")
#INSERT REMINDER TO TALK TO A SPECIALIST (ASMAA)
def advice(): #when the option for advice is selected
#make it so if they enter keywords it'll autogenerate advice
print("Feel free to vent here and I will listen to you and give you advice")
box = input("")
word_search = [] #https://www.techbeamers.com/python-add-lists-join-concatenate/#:~:text=Python%20Add%20Lists%20%E2%80%93%2010%20Ways%20to%20Join%2FConcatenate,...%206%20itertools.chain%20%28%29%20to%20combine%20lists%20
word = box.split(". ")
word_search.extend(word)
answer = str(input("I'm happy to keep listening, would you like to continue?"))
while answer.lower() != 'no': #loops so that they can keep venting until they enter the word 'finished'
box = input("")
word = box.split(". ")
word_search.extend(word)
answer = str(input("Thank you for telling me, would you like to continue?"))
else:
print(word_search)
neg = open("negative.txt","r") #stuff that the AI cannot handle for ethical reasons
negative = neg.read().splitlines()
lonely = open("lonely.txt","r") #stuff that the AI cannot handle for ethical reasons
lonelyword = lonely.read().splitlines()
school = open("school.txt","r") #stuff that the AI cannot handle for ethical reasons
schoolword = school.read().splitlines()
for word in word_search:
if any((True for word in word_search if word in negative)): #https://stackoverflow.com/questions/740287/how-to-check-if-one-of-the-following-items-is-in-a-list
print('''I'm sorry to hear that. May I implore you to contact your local hotline. I am unable to help you further. You need medical attention.
Here is a link to all hotlines: https://faq.whatsapp.com/3243110509092762/?locale=en_US''') #why is indenting like this.
if any((True for word in word_search if word in lonely)):
print("Remember that there are people that love you")
if any((True for word in word_search if word in school)):
print("Your mental health is a priority. Work hard at school but make sure you are feeling okay")
def listen(): #when the option listen is selected
print("You mentioned you want someone to listen to you, feel free to vent here and I will listen, I won't say anything back :) Enter the phrase 'finished' when you are done")
box = input("")
answer = box.split() #splits the answer up so it can identify the word finsished
length = len(answer) - 1
while answer[length].lower() != 'finished': #loops so that they can keep venting until they enter the word 'finished'
box = input("")
answer = box.split() #splits the answer up so it can identify the word finsished
length = len(answer) - 1
else:
print("Thank you for venting to me")
answer = input("Are you happy with your service?")
if answer.lower() == 'yes':
print("*Asmaa part here*") #TO BE REPLACED WITH ASMAA'S FUNCTION
if answer.lower() == 'no':
unsatisfied_service()
unsatisfied_service()