1

有没有办法在没有 HTTP 服务器的情况下使用https://nlu.rasa.com模型?我想将它用作 python 库/模块。

4

1 回答 1

4

是的,这在 nlu.rasa.com 的文档中有记录,特别是本节

从 0.12.3 版开始:

训练

from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu import config

training_data = load_data('data/examples/rasa/demo-rasa.json')
trainer = Trainer(config.load("sample_configs/config_spacy.yml"))
trainer.train(training_data)
model_directory = trainer.persist('./projects/default/')  # Returns the directory the model is stored in

解析

from rasa_nlu.model import Metadata, Interpreter

# where `model_directory points to the folder the model is persisted in
interpreter = Interpreter.load(model_directory)

interpreter.parse(u"The text I want to understand")
于 2018-06-25T12:27:15.453 回答