This is a simple basic code of my Sara AI brain written in Python, Just say Hi, and she will recognize it and respond appropriately.
The program consists of 2 parts:
1) [Arrays] of what user inputs to our chat bot.
2) [Conditions] of responses that Chat bot will reply with.
So if you add more arrays with more conditions, Sara will be more smarter than now!
You can change her name as you like and feel free to teach her something new :)
The code:
The program consists of 2 parts:
1) [Arrays] of what user inputs to our chat bot.
2) [Conditions] of responses that Chat bot will reply with.
So if you add more arrays with more conditions, Sara will be more smarter than now!
You can change her name as you like and feel free to teach her something new :)
The code:
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
#By DevHima | |
#List of greetings that the program will recognize as greetings | |
greetingdict = ["hello", "hi","what's up", "hola", "how are you?", "greetings", "salutations", "hey", "sup", "wussup", "Hello", "Hi","What's up", "Hola", "How are you?", "Greetings", "Salutations", "Hey", "Sup", "Wussup"] | |
#welcome message | |
print("Don't be shy, say hi!") | |
#read user input | |
x = input("You said: ") | |
print(x) | |
#check if user input is a greeting | |
if x in greetingdict: | |
print("Sara: Hi, pleased to meet you! My name is Sara.") | |
else: | |
print(" It's rude not to greet new people!") | |
Comments
Post a Comment