Rasa NLU
この演習では、Rasa NLU を使って interpreter を作成します。interpreter は受信したユーザーメッセージを解析し、エンティティのセットを返します。Rasa NLU の MITIE エンティティ認識モデルを使って interpreter を学習させましょう。
この演習はコースの一部です
Python でチャットボットを作る
演習の手順
- キー
"pipeline"、値"spacy_sklearn"を持つ辞書argsを作成しましょう。 RasaNLUConfig()に引数cmdline_argsとしてargsを渡し、configを作成しましょう。- 作成した設定を引数として
Trainer()を呼び出し、trainerを作成しましょう。 trainer.train()にtraining_dataを渡してinterpreterを作成しましょう。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Import necessary modules
from rasa_nlu.converters import load_data
from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer
# Create args dictionary
args = ____
# Create a configuration and trainer
config = ____
trainer = ____
# Load the training data
training_data = load_data("./training_data.json")
# Create an interpreter by training the model
interpreter = ____
# Test the interpreter
print(interpreter.parse("I'm looking for a Mexican restaurant in the North of town"))