【问题标题】:Rasa lookup table throws error in training data - " Not a valid NLU data"Rasa 查找表在训练数据中抛出错误 - “不是有效的 NLU 数据”
【发布时间】:2020-09-28 23:03:53
【问题描述】:

我正在使用 RASA 构建一个天气机器人,并希望我的模型能够将位置提取为实体。我的模型无法识别训练数据之外的位置。所以,我决定为其他实体使用查找表。

我按照博客文章 Entity extraction with lookup tables 并使用查找表通过在数据文件夹下创建查找“.txt”文件来识别训练数据中的位置实体。

这就是我的训练数据的样子:

{
  "rasa_nlu_data": {
    "lookup_tables": [
    {
        "name": "location",
        "elements": "data/location.txt"
    }
]
    "common_examples": [
      {
        "text": "Hello",
        "intent": "greet",
        "entities": []
      },
      {
        "text": "goodbye",
        "intent": "goodbye",
        "entities": []
      },
      {
        "text": "What's the weather in Berlin at the moment?",
        "intent": "inform",
        "entities": [
          {
            "start": 22,
            "end": 28,
            "value": "Berlin",
            "entity": "location"
          }
        ]
      },
      {
        "text": "hey",
        "intent": "greet",
        "entities": []
      },
      {
        "text": "hello",
        "intent": "greet",
        "entities": []
      },
      {
        "text": "hi",
        "intent": "greet",
        "entities": []
      },
      {
        "text": "heya",
        "intent": "greet",
        "entities": []
      },
      {
        "text": "howdy",
        "intent": "greet",
        "entities": []
      },
      {
        "text": "hey there",
        "intent": "greet",
        "entities": []
      },
      {
        "text": "bye",
        "intent": "goodbye",
        "entities": []
      },
      {
        "text": "goodbye",
        "intent": "goodbye",
        "entities": []
      },
      {
        "text": "bye bye",
        "intent": "goodbye",
        "entities": []
      },
      {
        "text": "see ya",
        "intent": "goodbye",
        "entities": []
      },
      {
        "text": "see you later",
        "intent": "goodbye",
        "entities": []
      },
      {
        "text": "What's the weather today?",
        "intent": "inform",
        "entities": []
      },
      {
        "text": "What's the weather in London today?",
        "intent": "inform",
        "entities": [
          {
            "start": 22,
            "end": 28,
            "value": "London",
            "entity": "location"
          }
        ]
      },
      {
        "text": "Show me what's the weather in Paris",
        "intent": "inform",
        "entities": [
          {
            "start": 30,
            "end": 35,
            "value": "Paris",
            "entity": "location"
          }
        ]
      },
      {
        "text": "I wonder what is the weather in Vilnius right now?",
        "intent": "inform",
        "entities": [
          {
            "start": 32,
            "end": 39,
            "value": "Vilnius",
            "entity": "location"
          }
        ]
      },
      {
        "text": "what is the weather?",
        "intent": "inform",
        "entities": []
      },
      {
        "text": "Tell me the weather",
        "intent": "inform",
        "entities": []
      },
      {
        "text": "Is the weather nice in Barcelona today?",
        "intent": "inform",
        "entities": [
          {
            "start": 23,
            "end": 32,
            "value": "Barcelona",
            "entity": "location"
          }
        ]
      },
      {
        "text": "I am going to London today and I wonder what is the weather out there?",
        "intent": "inform",
        "entities": [
          {
            "start": 14,
            "end": 20,
            "value": "London",
            "entity": "location"
          }
        ]
      },
      {
        "text": "I am planning my trip to Amsterdam. What is the weather out there?",
        "intent": "inform",
        "entities": [
          {
            "start": 25,
            "end": 34,
            "value": "Amsterdam",
            "entity": "location"
          }
        ]
      },
      {
        "text": "Show me the weather in Dublin, please",
        "intent": "inform",
        "entities": [
          {
            "start": 23,
            "end": 29,
            "value": "Dublin",
            "entity": "location"
          }
        ]
      },
      {
        "text": "in London",
        "intent": "inform",
        "entities": [
          {
            "start": 3,
            "end": 9,
            "value": "London",
            "entity": "location"
          }
        ]
      },
      {
        "text": "Lithuania",
        "intent": "inform",
        "entities": [
          {
            "start": 0,
            "end": 9,
            "value": "Lithuania",
            "entity": "location"
          }
        ]
      },
      {
        "text": "Oh, sorry, in Italy",
        "intent": "inform",
        "entities": [
          {
            "start": 14,
            "end": 19,
            "value": "Italy",
            "entity": "location"
          }
        ]
      },
      {
        "text": "Tell me the weather in Vilnius",
        "intent": "inform",
        "entities": [
          {
            "start": 23,
            "end": 30,
            "value": "Vilnius",
            "entity": "location"
          }
        ]
      },
      {
        "text": "The weather condition in Italy",
        "intent": "inform",
        "entities": [
          {
            "start": 25,
            "end": 30,
            "value": "Italy",
            "entity": "location"
          }
        ]
      },
      {
        "text": "I am going to Barcelona",
        "intent": "inform",
        "entities": [
          {
            "start": 14,
            "end": 23,
            "value": "Barcelona",
            "entity": "location"
          }
        ]
      },
      {
        "text": "I'm planning a trip to Barcelona",
        "intent": "inform",
        "entities": [
          {
            "start": 22,
            "end": 32,
            "value": " Barcelona",
            "entity": "location"
          }
        ]
      },
      {
        "text": "I am going to Barcelona. I wonder what is the weather out there?",
        "intent": "inform",
        "entities": [
          {
            "start": 13,
            "end": 23,
            "value": " Barcelona",
            "entity": "location"
          }
        ]
      },
      {
        "text": "What is the weather in Argentina?",
        "intent": "inform",
        "entities": [
          {
            "start": 23,
            "end": 32,
            "value": "Argentina",
            "entity": "location"
          }
        ]
      },
      {
        "text": "I am planning a trip to Paris and I wonder what is the weather out there?",
        "intent": "inform",
        "entities": [
          {
            "start": 24,
            "end": 29,
            "value": "Paris",
            "entity": "location"
          }
        ]
      }
    ]
  }
}

我的查找表在一个新行中包含每个位置的名称。

但是,当我运行 'rasa train nlu' 时,我收到以下错误:“Path 'data' does not contain valid NLU data in it. Please verify the data format. The NLU model training现在将被跳过。“可能是什么原因?我只做了博客里说的。请告诉我哪里出错了。提前致谢

【问题讨论】:

标签: tensorflow lookup-tables rasa-nlu rasa named-entity-extraction


【解决方案1】:

这实际上与查找无关,通过加载您的数据,我可以看到您在查找和常见示例之间缺少逗号,它应该如下所示:

{
  "rasa_nlu_data": {
    "lookup_tables": [
    {
        "name": "location",
        "elements": "data/location.txt"
    }
],
    "common_examples"
...

这表明您可能正在手动编写/编辑 json;如果需要,可以考虑使用 markdown 并使用 rasa data convert 获取 json

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-29
    相关资源
    最近更新 更多