From bea4f19f1f36a4bf010dacadc10b16c509097e0f Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Sun, 8 May 2022 18:01:56 +0530 Subject: Artificial Intelligence --- DataBase/ChatBot/ChatBot.py | 81 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 DataBase/ChatBot/ChatBot.py (limited to 'DataBase/ChatBot/ChatBot.py') diff --git a/DataBase/ChatBot/ChatBot.py b/DataBase/ChatBot/ChatBot.py new file mode 100644 index 0000000..99215d9 --- /dev/null +++ b/DataBase/ChatBot/ChatBot.py @@ -0,0 +1,81 @@ +import random + +Hello = ('hello','hey','hii','hi') + +reply_Hello = ('Hello Sir , I Am Zara .', + "Hey , What's Up ?", + "Hey How Are You ?", + "Hello Sir , Nice To Meet You Again .", + "Of Course Sir , Hello .") + +Bye = ('bye','exit','sleep','go') + +reply_bye = ('Bye Sir.', + "It's Okay .", + "It Will Be Nice To Meet You .", + "Bye.", + "Thanks.", + "Okay.") + +How_Are_You = ('how are you','are you fine') + +reply_how = ('I Am Fine.', + "Excellent .", + "Moj Ho rhi Hai .", + "Absolutely Fine.", + "I'm Fine.", + "Thanks For Asking.") + +nice = ('nice','good','thanks') + +reply_nice = ('Thanks .', + "Ohh , It's Okay .", + "Thanks To You.") + +Functions = ['functions','abilities','what can you do','features'] + +reply_Functions = ('I Can Perform Many Task Or Varieties Of Tasks , How Can I Help You ?', + 'I Can Call Your G.F .', + 'I Can Message Your Mom That You Are Not Studing..', + 'I Can Tell Your Class Teacher That You Had Attended All The Online Classes On Insta , Facebbook etc!', + 'Let Me Ask You First , How Can I Help You ?', + 'If You Want Me To Tell My Features , Call : Print Features !') + +sorry_reply = ("Sorry , That's Beyond My Abilities .", + "Sorry , I Can't Do That .", + "Sorry , That's Above Me.") + +def ChatterBot(Text): + + Text = str(Text) + + for word in Text.split(): + + if word in Hello: + + reply = random.choice(reply_Hello) + + return reply + + elif word in Bye: + + reply = random.choice(reply_bye) + + return reply + + elif word in How_Are_You: + + reply_ = random.choice(reply_how) + + return reply_ + + elif word in Functions: + + reply___ = random.choice(reply_Functions) + + return reply___ + + else: + + return random.choice(sorry_reply) + -- cgit v1.2.3-59-g8ed1b