A way to limit entity dimensions returned by Duckling via the HTTP API?

Hi there,

I have a pipeline set up that includes Duckling, specifying 3 dimensions:

dimensions: [“duration”, “time”, “number” ]

I then call the http API (the “/parse” endpoint) to try and extract (for example) duration and date/time from a string. One of the issues I’ve had is that if I pass (for example) “10 heures” to it, Rasa correctly returns an array of 2 entities, one a duration and one a time. The problem I have (this isn’t helped by Golang, which insists on mapping the JSON response to a data struct) is that the data structure inside each slice of this array is different, for example the “value” element in the “duration” slice is an integer, but “value” in the “time” slice is a string. This makes is kind of awkward to process the API response.

I know in advance that at any given time, I only want to check for a duration or a time, so I never actually want to get back both entities (in other words, at point A I just want to check if a given text can be converted to a duration, and at point B I want to check if a given text can be converted to a time).

Right now, I’ve worked around it by creating different pipelines/models, restricting duckling to just one dimension in each. But this seems clumsy - is there a better way of doing this, for example calling the “/parse” endpoint with a ducklling dimension to restrict the API response to that dimension?

Alternatively, it would be nice if the JSON format returned was more generic, so at the very least a particular element doesn’t change its type between different array slices?

I think unifying the response from duckling is a good point - nevertheless I think that is something that should be done on the duckling project.

I def see your point and it is quite cumbersome to have two models, but I think the requirement is a bit niche to justify a new feature.