facebook / duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Other
4.05k stars 723 forks source link

Should the dim param constrain the results? #624

Closed 1dolinski closed 3 years ago

1dolinski commented 3 years ago

If time related text, such as "June 21" is added while not including "time" in the dims param, the result provides dim time results.

Here's an example using the README query

curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_US&text="June 21 and 3 cups of sugar"&dims="[\"quantity\",\"numeral\"]"'

[
  {
    body: 'June 21',
    start: 1,
    value: {
      values: [Array],
      value: '2021-06-21T00:00:00.000-07:00',
      grain: 'day',
      type: 'value'
    },
    end: 8,
    dim: 'time',
    latent: false
  },
  {
    body: '3 cups of sugar',
    start: 13,
    value: { value: 3, type: 'value', product: 'sugar', unit: 'cup' },
    end: 28,
    dim: 'quantity',
    latent: false
  }
]

I would have expected only quantity and numeral dims to be returned

chessai commented 3 years ago

Yes, it should. This is a bug.