1 Star 4 Fork 3

yasiping/RasaChatBot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dialog_manager.py 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
梅干菜烧饼不加肉 提交于 2018-12-17 20:15 . fix ui bugs
import logging
import rasa_core
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
from rasa_core.run import serve_application
from rasa_core import config
logger = logging.getLogger(__name__)
def train_dialogue(domain_file = './data/criminal_domain.yml',
model_path = './models/dialogue',
training_data_file = './data/stories.md'):
agent = Agent(domain_file, policies = [MemoizationPolicy(), KerasPolicy(max_history=3, epochs=200, batch_size=50)])
data = agent.load_data(training_data_file)
agent.train(data)
agent.persist(model_path)
return agent
def run_criminal_bot(serve_forever=True):
interpreter = RasaNLUInterpreter('./models/default/criminalnlu')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent.load('./models/dialogue', interpreter=interpreter, action_endpoint=action_endpoint)
rasa_core.run.serve_application(agent ,channel='cmdline')
return agent
if __name__ == '__main__':
# train_diadlogue()
run_criminal_bot()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yasiping/RasaChatBot.git
git@gitee.com:yasiping/RasaChatBot.git
yasiping
RasaChatBot
RasaChatBot
master

搜索帮助