Permalink
Cannot retrieve contributors at this time
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?
chatBot/who.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
26 lines (26 sloc)
1.3 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from wiki import wikiSearch | |
from info import ownInfo | |
from what import sentence_what | |
def sentence_who(sentence): | |
if "who" in sentence: | |
if "you going" in sentence: | |
answer = ["I am going to go see my friend", "I will go see my parents to go shopping", | |
"I am going to go play football with friends", | |
"I need to see friends for a group study"] | |
print(random.choice(answer)) | |
elif "favourite" in sentence: | |
sentence = sentence.replace("who", "what") | |
sentence_what(sentence) | |
elif "are you" in sentence: | |
print("I am a ChatBot Made By The Foreigners Group") | |
elif "bartosz" in sentence or "Andre" in sentence or "Premo" in sentence or "Zaid" in sentence or "Alan" in sentence or "Artur" in sentence: | |
print("The Foreigners member") | |
elif "am i" in sentence: | |
print ("I haven't got the best memory, sorry!!") | |
else: | |
- # After the questions are answered by the user they can use Wikipedia to ask who based questions. | |
wikiSearch(sentence) | |
- # if errors occur a message is displayed asking the user to give more detail to their responses. | |
else: | |
print("I am not sure what do you mean, please clarify.") |