forked from KikeVen/simplebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chatter_trainer.py
53 lines (44 loc) · 2.29 KB
/
chatter_trainer.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
chatbot = ChatBot("Twily")
trainer = ListTrainer(chatbot)
documentation_topics = [
("sdk", "https://www.twilio.com/docs/sms/whatsapp#sdks"),
("twilio python helper library", "https://www.twilio.com/docs/libraries/python"),
("tutorials", "https://www.twilio.com/docs/sms/whatsapp/tutorial/send-and-receive-media-messages-twilio-api-whatsapp"),
("api for whatsapp", "https://www.twilio.com/docs/sms/whatsapp/api"),
("autopilot", "https://www.twilio.com/docs/autopilot/channels/whatsapp"),
("contact us", "https://support.twilio.com/hc/en-us")
]
twilio_knowledge = [
("Twilio description", "Simply put, Twilio is a developer platform for communications.\
Software teams use Twilio APIs to add capabilities like voice, video, and messaging \
to their applications. This enables businesses to provide the right communications \
experience for their customers."),
("help me", "I can give you general information about this project"),
("Twilio email", "Sorry, you can submit a ticket at: https://www.twilio.com/console/support/tickets/create"),
("Twilio phone number", "We don't have a phone number for this type of account"),
("mailing address", "You can email our corporate headquaters at [email protected] "),
("chatterbot", "library making it easy to generate automated responses to a user’s input, visit https://chatterbot.readthedocs.io/en/stable/"),
("textblob", "library for processing textual data, please visit https://textblob.readthedocs.io/en/dev/")
]
classifier = ["silly", "dumb", "stupid", "I'dont think so", "I don't care",
"do you know anything", "not good", "omg", "this is not working"
"this is bad", "not what I want", "live help",
"get me a rep", "I need a real person", "forget you"]
for topic, link in documentation_topics:
trainer.train([
f"{topic}",
f"Sure, here is the {topic} link: {link}"
])
for topic, description in twilio_knowledge:
trainer.train([
f"{topic}",
f"Ok sure, {description}"
])
for i in classifier:
trainer.train([
f"{i}",
"I am sorry you feel that way, please ask the question again"
])
trainer.export_for_training('twilybot.json')