始める無料で始める

少ないデータでのエンティティ認識

テキストからエンティティを抽出するシステムの多くは、名前・日付・場所といった「汎用的な」情報を抽出するために設計されています。 しかし、ボットのトレーニングデータが十分でない場合、こうしたシステムで高い精度を出すのは難しいこともあります。

この演習では、Rasa 内の MITIE エンティティ認識器を有効にして、少量のトレーニングデータからレストラン関連のエンティティを抽出します。辞書 argstraining_data オブジェクトはあらかじめ定義されています。

この演習はコースの一部です

Python でチャットボットを作る

コースを見る

演習の手順

  • RasaNLUConfig() を呼び出し、引数 cmdline_args に値 {"pipeline": pipeline} を渡して config を作成してください。
  • 前の演習と同様に、trainer を作成し、それを使って interpreter を作成してください。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Import necessary modules
from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer

pipeline = [
    "nlp_spacy",
    "tokenizer_spacy",
    "ner_crf"
]

# Create a config that uses this pipeline
config = ____

# Create a trainer that uses this config
trainer = ____

# Create an interpreter by training the model
interpreter = ____

# Parse some messages
print(interpreter.parse("show me Chinese food in the centre of town"))
print(interpreter.parse("I want an Indian restaurant in the west"))
print(interpreter.parse("are there any good pizza places in the center?"))
コードを編集して実行