Bradford Griggs
Bradford Griggs

Reputation: 449

Increase Precision of Text Parsed via Facebook Duckling?

I'm using Facebook Duckling to parse some text but the results include some odd dimensions:

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
  }
]

This result is odd since from the context of the query the text "28" is clearly referring to the day of month but Duckling also returns data as if it were referring to the Distance dimension.

Is there a way to make Duckling context aware and have it only return results matching the full query? Passing "dimensions" as argument is not ideal since I don't know the dimensions in advance.

Thanks

Upvotes: 0

Views: 147

Answers (0)

Related Questions