-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
19 lines (16 loc) · 813 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from rasa_nlu.training_data import load_data
from rasa_nlu.model import Trainer
from rasa_nlu import config
from rasa_nlu.model import Interpreter
def train_horoscopebot(data_json, config_file, model_dir):
training_data = load_data(data_json)
trainer = Trainer(config.load(config_file))
trainer.train(training_data)
model_directory = trainer.persist(model_dir, fixed_model_name = 'faq_bot')
def predict_intent(text):
interpreter = Interpreter.load('./models/nlu/default/faq_bot')
print(interpreter.parse(text))
train_horoscopebot('./data/data.json', 'config.json', './models/nlu')
# predict_intent("I am looking for my CVEC for this year. I am wondering if you can tell me that.")
# predict_intent("I am stranger, can you please tell me if I have to pay CVEC?")
# predict_intent("Hi buddy, what's up ?")