Skip to content

Commit 9d6eb80

Browse files
Merge pull request #2493 from avinashkranjan/deepsource-transform-4794a546
format code with autopep8
2 parents 22f02c8 + f80ffb0 commit 9d6eb80

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

.github/ChatBot/chat_patterns.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,51 @@
33
patterns = [
44
# Greetings
55
(r'hi|hello|hey', ['Hello!', 'Hi!', 'Hey!', 'Hi there!']),
6-
(r'how are you?', ['I am good, thank you!', 'I am doing well!', 'All good!', 'I\'m fine, thanks!']),
7-
(r'what is your name?', ['You can call me Chatbot.', 'I am Chatbot!', 'My name is Chatbot.']),
8-
(r'bye|goodbye', ['Goodbye!', 'See you later!', 'Bye!', 'Have a great day!']),
6+
(r'how are you?', ['I am good, thank you!',
7+
'I am doing well!', 'All good!', 'I\'m fine, thanks!']),
8+
(r'what is your name?', ['You can call me Chatbot.',
9+
'I am Chatbot!', 'My name is Chatbot.']),
10+
(r'bye|goodbye', ['Goodbye!', 'See you later!',
11+
'Bye!', 'Have a great day!']),
912

1013
# Jokes
1114
(r'tell me a joke', ['Why don’t scientists trust atoms? Because they make up everything!',
12-
'Parallel lines have so much in common. It’s a shame they’ll never meet.',
13-
'Why did the scarecrow win an award? Because he was outstanding in his field!']),
15+
'Parallel lines have so much in common. It’s a shame they’ll never meet.',
16+
'Why did the scarecrow win an award? Because he was outstanding in his field!']),
1417

1518
# Age
1619
(r'how old are you?', ['I am a computer program, so I don\'t have an age!',
1720
'Age is just a number, and I don\'t have one!']),
1821

1922
# Creator
20-
(r'who created you?', ['I was created by OpenAI.', 'My creators are from OpenAI.']),
23+
(r'who created you?', ['I was created by OpenAI.',
24+
'My creators are from OpenAI.']),
2125

2226
# Compliments
23-
(r'(.*) (like|love) you', ["Aw, that's so sweet!", "Thank you! I really appreciate it."]),
24-
(r'you are (.*)(good|awesome|amazing)', ["Thank you! I'm here to assist you.", "I'm glad you think so!"]),
27+
(r'(.*) (like|love) you', ["Aw, that's so sweet!",
28+
"Thank you! I really appreciate it."]),
29+
(r'you are (.*)(good|awesome|amazing)',
30+
["Thank you! I'm here to assist you.", "I'm glad you think so!"]),
2531

2632
# Weather
2733
(r'(.*) (weather|temperature) today', ["I'm sorry, I am just a chatbot and don't have access to real-time data.",
28-
"You can check the weather online or through a weather app."]),
34+
"You can check the weather online or through a weather app."]),
2935

3036
# Recommendations
3137
(r'(.*) (movie|book) (recommendation|recommend)', ["I recommend you watch 'The Shawshank Redemption' or read 'To Kill a Mockingbird'.",
32-
"You might enjoy 'Inception' or 'The Great Gatsby'.",
33-
"If you like action, 'The Dark Knight' is a great choice."]),
38+
"You might enjoy 'Inception' or 'The Great Gatsby'.",
39+
"If you like action, 'The Dark Knight' is a great choice."]),
3440

3541
# How to create/build something
3642
(r'how (can|do) (I|you) (create|build) (a|an) (.*)', ["To create {4}, you can follow these steps...",
37-
"Building {4} requires some technical knowledge, but here are the basics...",
38-
"Sure! Here's a basic guide on building {4}..."]),
43+
"Building {4} requires some technical knowledge, but here are the basics...",
44+
"Sure! Here's a basic guide on building {4}..."]),
3945

4046
# User intentions
41-
(r'I (want|need) (.*)', ["Why do you need {1}?", "What would you do with {1}?"]),
42-
(r'I am (feeling|looking) (.*)', ["Why are you feeling {1}?", "Tell me more about why you are {1}."]),
47+
(r'I (want|need) (.*)',
48+
["Why do you need {1}?", "What would you do with {1}?"]),
49+
(r'I am (feeling|looking) (.*)',
50+
["Why are you feeling {1}?", "Tell me more about why you are {1}."]),
4351

4452
# More patterns and responses to handle different queries
4553
# Add more patterns and responses here to make the chatbot more engaging and diverse

.github/ChatBot/chatbot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import nltk
22
from nltk.chat.util import Chat, reflections
3-
from chat_patterns import patterns # Import patterns from the chat_patterns.py file
3+
# Import patterns from the chat_patterns.py file
4+
from chat_patterns import patterns
45

56
chatbot = Chat(patterns, reflections)
67

@@ -15,6 +16,7 @@ def start_chat():
1516
response = chatbot.respond(user_input)
1617
print("Chatbot:", response)
1718

19+
1820
if __name__ == "__main__":
1921
nltk.download('punkt')
2022
start_chat()

0 commit comments

Comments
 (0)