forked from alfredfrancis/ai-chatbot-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·52 lines (46 loc) · 1.57 KB
/
setup.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
import nltk
import os
# Downloading necessary NLTK datasets
nltk.download("stopwords")
nltk.download("wordnet")
nltk.download('averaged_perceptron_tagger')
nltk.download('punkt')
#creating directory for storing chat logs
if not os.path.exists("logs"):
os.makedirs("logs")
try:
from app.stories.models import Story, LabeledSentences
# Setting up default intents
newStory = Story()
newStory.storyName = 'Default Fallback intent'
newStory.intentName = 'fallback'
newStory.speechResponse = "Sorry. I'm having trouble understanding you."
newStory.apiTrigger = False
newLabeledSentence = LabeledSentences()
newLabeledSentence.data = [['', 'VB', 'O']]
newStory.labeledSentences.append(newLabeledSentence)
newStory.save()
newStory = Story()
newStory.storyName = 'cancel'
newStory.intentName = 'cancel'
newStory.speechResponse = "Ok. Canceled."
newStory.apiTrigger = False
newLabeledSentence = LabeledSentences()
newLabeledSentence.data = [['cancel', 'VB', 'O'], ['close', 'VB', 'O']]
newStory.labeledSentences.append(newLabeledSentence)
newStory.save()
newStory = Story()
newStory.storyName = 'Welcome message'
newStory.intentName = 'init_conversation'
newStory.speechResponse = "Hi, What can i do for you ?"
newStory.apiTrigger = False
newLabeledSentence = LabeledSentences()
newLabeledSentence.data = [[
"init_conversation",
"NN",
"O"
]]
newStory.labeledSentences.append(newLabeledSentence)
newStory.save()
except:
print("Stories already exists..skipping..")