0

我正在使用Facebook Duckling解析一些文本,但结果包括一些奇怪的维度:

String text = "Tomorrow, February 28";
String result = Duckling.parseText(text);

Result:
 [
  {
    "body": "Tomorrow, February 28",
    "start": 0,
    "value": {
      "values": [
        {
          "value": "2022-02-28T00:00:00.000-08:00",
          "grain": "day",
          "type": "value"
        }
      ],
      "value": "2022-02-28T00:00:00.000-08:00",
      "grain": "day",
      "type": "value"
    },
    "end": 21,
    "dim": "time",
    "latent": false
  },
  {
    "body": "28'",
    "start": 19,
    "value": {
      "value": 28,
      "type": "value",
      "minute": 28,
      "unit": "minute",
      "normalized": {
        "value": 1680,
        "unit": "second"
      }
    },
    "end": 22,
    "dim": "duration",
    "latent": false
  },
  {
    "body": "28'",
    "start": 19,
    "value": {
      "value": 28,
      "type": "value",
      "unit": "foot"
    },
    "end": 22,
    "dim": "distance",
    "latent": false
  }
]

这个结果很奇怪,因为从查询的上下文来看,文本“28”显然指的是月份中的某一天,但Duckling也返回数据,就好像它指的是Distance维度一样。

有没有办法让Duckling上下文感知并让它只返回与完整查询匹配的结果?将“尺寸”作为参数传递并不理想,因为我事先不知道尺寸。

谢谢

4

0 回答 0