我可以使用以下命令从终端使用rasa。
rasa nlu train
rasa nlu shell
现在,我想做同样的python代码。我该怎么办?
我有我的nlu.md和config.yml。我看到了此链接https://legacy-docs.rasa.com/docs/nlu/0.15.1/python/,但它显示的是demo-rasa.json,而我没有。
仅供参考,这些文档是针对rasa的旧版本的-我建议您使用最新版本(或至少为>1.0
),并在https://rasa.com/docs/rasa/中签出新文档>
您的问题在论坛上有一些答案,例如:https://forum.rasa.com/t/training-models-from-a-python-script-python-api-in-the-new-rasa-1-0/12482
https://forum.rasa.com/t/python-api-for-nlu-interpreter-and-agent/22710
为了训练模型,它看起来像:
from rasa.train import train_nlu
model_directory = <model output dir>
config_file = <path to config file>
nlu_data = <path to NLU training folder or file>
train_nlu(
config=config_file,
nlu_data=nlu_data,
output=model_directory
)