-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCLChatbot.py
More file actions
37 lines (36 loc) · 804 Bytes
/
CLChatbot.py
File metadata and controls
37 lines (36 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import nltk
from nltk.chat.util import Chat, reflections
##importing the needed libraries
pairs = [
[
r"my name is (.*)",
["Hello %1, How are you today?"]
],
[
r"hi|hey|hello",
["Hello", "Hey there"]
],
[
r"what is your name?",
["You can call me a chatbot", "My name is Chatbot", "I am a chatbot"]
],
[
r"how are you?",
["I'm doing good", "I'm fine", "Pretty good, how about You?"]
],
[
r"sorry (.*)",
["Its alright", "Its OK, never mind"]
],
[
r"I am fine",
["Great to hear that!"]
],
[
r"quit",
["BBye take care. It was nice talking to you :) "]
],
]
chatbot = Chat(pairs, reflections)
chatbot.converse()
#make edits to the chat bot