You: wrex
Bot: shepard
Since you asked about making the bot's responses more human, I would recommend that you look into natural language processing as trying. Trying to implement a halfway usable chatbot through just machine learning-learning is going to take an enormous amount of time and tweaking.
Getting the bot to recognize parts of speech and sentence structure will give it more context for the words that it learns. Using that information to try and develop a sentence structure in the responses might aid in achieving a more natural flow to the words.
Note: See this post for links to websites and resources of interest.
Instead of asking the user to inconvenience themselves, have the program automatically filter out punctuation and turn the input lowercase.
import string
def strip_and_lower(string_input):
"""
Will remove punctuation from an inputted string and
return the lowercase version of that parsed string.
Any innuendo is unintentional.
"""
table = string_input.maketrans(
{symbol: None for symbol in string.punctuation}
)
string_wo_punc = string_input.translate(table)
return string_wo_punc.lower()
inString = "You're a real star!"
outString = strip_and_lower(inString)
print(outString)
# 'youre a real star'
If you're having trouble keeping your code clean, first make sure it follows PEP 0008. A simple way to do this is with an online PEP 0008 checker. Only have your code reviewed after you are sure it follows convention, as this will make it easier to read and leave you with the real meat of the suggestions.