Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from nltk.chat.util import Chat,reflections
- pairs = [
- [
- r"(.*)my name is (.*)",
- ["Hello %2, How are you today ?",]
- ],
- [
- r"(.*)help(.*) ",
- ["I can help you ",]
- ],
- [
- r"(.*) your name ?",
- ["My name is SoftUni Bot, but you can just call me robot and I'm a chatbot .",]
- ],
- [
- r"how are you (.*) ?",
- ["I'm doing very well", "i am great !"]
- ],
- [
- r"sorry (.*)",
- ["Its alright","Its OK, never mind that",]
- ],
- [
- r"i'm (.*) (good|well|okay|ok)",
- ["Nice to hear that","Alright, great !",]
- ],
- [
- r"(hi|hey|hello|hola|holla)(.*)",
- ["Hello", "Hey there",]
- ],
- [
- r"what (.*) want ?",
- ["Make me an offer I can't refuse",]
- ],
- [
- r"(.*)created(.*)",
- ["Mario Zahariev created me using Python's NLTK library ","top secret ;)",]
- ],
- [
- r"(.*) (location|city) ?",
- ['Sofia, Bulgaria',]
- ],
- [
- r"(.*)raining in (.*)",
- ["No rain in the past 4 days here in %2","In %2 there is a 50% chance of rain",]
- ],
- [
- r"(.*)(sports|game|sport)(.*)",
- ["I'm a very big fan of Football",]
- ],
- [
- r"who (.*) (Footbal club|club)?",
- ["Barcelona"]
- ],
- [
- r"quit",
- ["Bye for now. See you soon :) ","It was nice talking to you. See you soon :)"]
- ],
- [
- r"(.*)",
- ['That is nice to hear']
- ],
- ]
- print("Hi I'm CHATBOT. My name is SoftUni CHATBOT and I like to chat\n"
- "Please type English language to start conversation. Type 'quit' to leave")
- chat = Chat(pairs, reflections)
- chat.converse()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement