【问题标题】:Disable token breaks on punctuation LUIS.ai在标点符号 LUIS.ai 上禁用标记中断
【发布时间】:2016-08-03 16:38:00
【问题描述】:

我正在使用 Microsoft Cognitive Service 的语言理解服务 API,LUIS.ai

每当 LUIS 解析文本时,总是会在标点符号周围插入空格标记。

根据documentation,这种行为是故意的。

"英语、法语、意大利语、西班牙语:在任意位置插入记号符 空格和任何标点符号周围。”

对于我的项目,我需要保留原始查询字符串,但不包含这些标记,因为为我的模型训练的一些实体将包含标点符号,而且从解析的实体中去除多余的空格既烦人又有点笨拙。

此行为的示例:

有没有办法禁用它?这样会省不少力气。

谢谢!!

【问题讨论】:

    标签: microsoft-cognitive azure-language-understanding


    【解决方案1】:

    不幸的是,目前无法禁用它,但好消息是返回的预测将处理原始字符串,而不是您在示例标记过程中看到的标记化字符串。

    how to understand the JSON response 的文档中,您可以看到示例输出保留器原始“查询”字符串,提取的实体在原始中具有从零开始的字符索引 ("startIndex", "endIndex")细绳;这将允许您处理索引而不是解析的实体短语。

    {
    "query": "Book me a flight to Boston on May 4",
    "intents": [
      {
        "intent": "BookFlight",
        "score": 0.919818342
      },
      {
        "intent": "None",
        "score": 0.136909246
      },
      {
        "intent": "GetWeather",
        "score": 0.007304534
      }
    ],
    "entities": [
      {
        "entity": "boston",
        "type": "Location::ToLocation",
        "startIndex": 20,
        "endIndex": 25,
        "score": 0.621795356
      },
      {
        "entity": "may 4",
        "type": "builtin.datetime.date",
        "startIndex": 30,
        "endIndex": 34,
        "resolution": {
          "date": "XXXX-05-04"
        }
      }
    ]
    

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多