始める無料で始める

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"))
コードを編集して実行