且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过程序Node.js为RASA NLU创建训练数据

更新时间:2023-12-02 21:51:58

Rasa具有功能强大的API,如此处.

Rasa has a highly functional API as documented here.

要回答特定问题,您可以通过以下命令将训练数据传递给Rasa NLU API:

To answer the specific question you can pass training data to the Rasa NLU API via the below commands:

如果您的训练数据在文件中:

If your training data is in a file:

curl -XPOST localhost:5000/train?project=my_project -d @data/examples/rasa/demo-rasa.json

如果您的训练数据为json格式:

If your training data is in json format:

curl --request POST \
  --url 'http://localhost:5000/train?project=test&fixed_model_name=tested-project' \
  --header 'content-type: application/json' \
  --data ' {
  "rasa_nlu_data": {
    "regex_features": [
      {
        "name": "zipcode",
        "pattern": "[0-9]{5}"
      }
    ],
    "entity_synonyms": [
      {
        "value": "chinese",
        "synonyms": ["Chinese", "Chines", "chines"]
      },
      {
        "value": "vegetarian",
        "synonyms": ["veggie", "vegg"]
      }
    ],
    "common_examples": []
  }
}'

显然,您需要创建json文件或有效负载.并且在Node中您不会使用curl,而是使用 request 之类的库.

Obviously you'll need to create the json file or payload. and in Node you wouldn't be using curl, but a library like request.

我写了系列教程可能有助于您开始与Rasa的API进行交互.

I've written a series of tutorials that may be good to help you get started interacting with Rasa's API.