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?
Python-Chatbot/Simple_Chatter.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
176 lines (150 sloc)
8.22 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 math | |
#import tensorflow as tf | |
from nltk import * | |
#from nltk import ChatBot | |
import asyncio | |
import random | |
import win32api | |
from win32api import GetSystemMetrics | |
import re | |
from re import * | |
import webbrowser | |
from webbrowser import * | |
hi = ["hi", "hello", "sup", "wat's up", "greetings"] | |
swear = ["fuck you", "screw you", "go to hell", "fuck off", "piss off"] | |
myslef = ["I ", "I feel ", "I am feeling "] | |
feeling_good = ["good", "nice", 'lovely', 'pretty well', "I feel good", "I am feeling good"] | |
feeling_bad = ["bad", "poorly", "poor", "unwell", "feeling off", "I feel bad", "I don't feel so good" ] | |
pain = ["itches", "hurts", "pain", "hurt", "my wife left me", "died"] | |
hru = ["how are you", "how do you feel", "what do you feel"] | |
bye = ["bye", "goodbye", "see you later", ""] | |
resolution = ["what is my resolution", "resolution", "what resolution am I working on"] | |
fact = ["teach me", "teach me something new", "tell me a fact", "something interesting", "fact"] | |
what_cat = ["what's a cat", "what is a cat", "what is cat" "explain cat", "cat"] | |
what_dog = ["what's a dog", "what is a dog", "what is dog" "explain dog", "dog"] | |
what_bird = ["what's a bird", "what is a bird", "explain bird", "bird"] | |
what_tree = ["what's a tree", "what is a tree", "What is tree" "explain tree", "tree"] | |
what_treenature = ["tree in nature", "in nature", "what is tree in nature"] | |
what_treeprog = ["tree in programming", "tree in programing", "in programming", "what is tree in programming"] | |
what_reptile = ["what's a reptile", "what is a reptile", "what is reptile", "explain reptile", "reptile"] | |
what_fish = ["what's a fish", "what is a fish", "what is fish" "explain fish", "fish"] | |
weather_open = ["what's the weather outside", "what's the weather", "weather", "open weather", "weather info"] | |
wiki_open = ["open wikipedia", "wikipedia", "wikipedia", "open wiki"] | |
youtube_open = ["open youtube", "youtube", "yt", "watch some videos"] | |
browser_open = ["browser", "open browser", "search"] | |
name_question = ["what's my name", "how do they call me", "say my name"] | |
def ui1(Uinput): | |
for word in swear: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c2 = random.choice(("You are not nice, come back when you are calm!", "Get out of here!")) | |
print (c2) | |
exit() | |
for word in hi: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c1 = random.choice(("Hi!", "Hello!", "Howdy!"))#this does that and that | |
print(c1) | |
return c1 | |
for word in myslef + feeling_good: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c3 = random.choice(("Glad to hear that!", "That's very nice!", "How lovely!")) | |
print(c3) | |
return c3 | |
for word in feeling_bad: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c4 = random.choice(("That's unpleasent, tell me more.", "That's not good! Why is that?", "But why?")) | |
print(c4) | |
return c4 | |
for word in pain: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c5 = random.choice(("Go see a doctor!", "See a specialist, please!", "Be sure t take care!")) | |
print(c5) | |
return c5 | |
for word in hru: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c6 = random.choice(("I am fine, thanks for asking!", "I feel really nice.", "I feel more than fine!")) | |
print(c6) | |
return c6 | |
for word in bye: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c7 = random.choice(("Bye!", "See you!", "See you later aligator!", "Arividerci", "Adios")) | |
print(c7) | |
exit() | |
return c7 | |
for word in fact: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c8 = random.choice(("Banging your head against a wall for one hour burns 150 calories.", "In Switzerland it is illegal to own just one guinea pig.", "Pteronophobia is the fear of being tickled by feathers.", "Snakes can help predict earthquakes.", "A flock of crows is known as a murder.", 'The oldest "your mom" joke was discovered on a 3,500 year old Babylonian tablet.', "So far, two diseases have successfully been eradicated: smallpox and rinderpest.", "7 percent of American adults believe that chocolate milk comes from brown cows.")) | |
print(c8) | |
return c8 | |
for word in resolution: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c9 = ("Your screen resolution is ") | |
print(c9); print(GetSystemMetrics(0)); print(" x "); print(GetSystemMetrics(1)) | |
return 9 | |
for word in what_cat: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c10 = random.choice(("A carnivorous mammal (Felis catus) long domesticated as a pet and for catching rats and mice.", "Any of a family (Felidae) of carnivorous usually solitary and nocturnal mammals (such as the domestic cat, lion, tiger, leopard, jaguar, cougar, wildcat, lynx, and cheetah).")) | |
print(c10) | |
return c10 | |
for word in what_dog: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c11 = random.choice(("A highly variable domestic mammal (Canis familiaris) closely related to the gray wolf.", "A domesticated mammal related to the gray wolf, often used for hunting assistance.")) | |
print(c11) | |
return c11 | |
for word in what_fish: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c12 = random.choice(("Any of various warm-blooded, egg-laying, feathered vertebrates of the class Aves, having forelimbs modified to form wings.", "Such an animal hunted as game.")) | |
print(c12) | |
return c12 | |
for word in what_reptile: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c12 = random.choice(("Any of various cold-blooded, usually egg-laying vertebrates of the class Reptilia, such as a snake, lizard, crocodile, turtle, or dinosaur, having an external covering of scales or horny plates and breathing by means of lungs.", "Creeping; moving on the belly, or by means of small and short legs.", "Mark Zukerberg")) | |
print(c12) | |
return c12 | |
for word in what_tree: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c12 = "Tree in Nature or Programmign" | |
print(c12) | |
#return c12 | |
#if Uinput.lower().split(" ")[0] in what_treenature == True: | |
you = input("You: ") | |
for word in what_treenature: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c12a = random.choice(("A perennial woody plant having a main trunk and usually a distinct crown.", "A plant or shrub resembling a tree in form or size.")) | |
print (c12a) | |
return c12a | |
#for word in what_treeprog: | |
#if Uinput.lower().strip() == word.lower().strip(): | |
#c12b = 'A long list of "IF" statements and/or itterated "IF" statements encased in "WHILE" or "FOR" itteration that copies human like logic. Basically, what this is.' | |
#print (c12b) | |
#return c12b | |
for word in weather_open: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c14 = 'Here you go! ' | |
print (c14) | |
webbrowser.open_new('https://openweathermap.org/city/2652221') | |
return c14 | |
for word in wiki_open: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c15 = 'Here you go! ' | |
print (c15) | |
webbrowser.open_new('https://en.wikipedia.org/wiki/Main_Page') | |
return c15 | |
for word in youtube_open: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c16 = 'Here you go! ' | |
print (c16) | |
webbrowser.open_new('https://www.youtube.com/') | |
return c16 | |
for word in browser_open: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c17 = 'Here you go! ' | |
print (c17) | |
webbrowser.open_new('https://duckduckgo.com/') | |
return c17 | |
for word in name_question: | |
if Uinput.lower().strip() == word.lower().strip(): | |
c18 = "I don't know your name yet." | |
print (c18) | |
return c18 | |
while True: | |
ui1(input("You: ")) |