facebook / duckling

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

Is there a way to find out which values of a date are imputed by duckling #689

Open nvinayvarma189 opened 2 years ago

nvinayvarma189 commented 2 years ago

Case 1: Input text: on the 26th Duckling output: {"value":"2022-04-26T00:00:00.000-07:00","grain":"day","type":"value"} In this case, duckling has filled the values of the month (04) and the year (2022). So month and year are imputed

Case 2: Input text: 26th May Duckling output: {"value":"2022-05-26T00:00:00.000-07:00","grain":"day","type":"value"} In this case, duckling has filled the value of the year (2022). Only year is imputed

In both the above cases, duckling tried to obtain a complete date from the input by imputing some values.

Question: From the parsed output itself, Is there a way to know if duckling has imputed certain placeholder values to the parsed output? If yes, which ones (i.e. Month or a year or both, etc)?

chessai commented 2 years ago

Closest time in the future

On Tue, Apr 26, 2022, 02:06 Vinay Varma @.***> wrote:

Case 1: Input text: on the 26th Duckling output: {"value":"2022-04-26T00:00:00.000-07:00","grain":"day","type":"value"} In this case, duckling has filled the values of the month (04) and the year (2022). So month and year are imputed

Case 2: Input text: 26th May Duckling output: {"value":"2022-05-26T00:00:00.000-07:00","grain":"day","type":"value"} In this case, duckling has filled the value of the year (2022). Only year is imputed

In both the above cases, duckling tried to obtain a complete date from the input by imputing some values.

Question: From the parsed output itself, Is there a way to know if duckling has imputed certain placeholder values to the parsed output? If yes, which ones (i.e. Month or a year or both, etc)?

— Reply to this email directly, view it on GitHub https://github.com/facebook/duckling/issues/689, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOIX27WFCBP7L5T2HKBD53VG6IWPANCNFSM5UK2E4YQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nvinayvarma189 commented 2 years ago

@chessai

Sorry but I did not get it. I understand that Duckling gives preference to the closest future date, but how can that help me find out what values of the date were imputed by Duckling?

chessai commented 2 years ago

@chessai

Sorry but I did not get it. I understand that Duckling gives preference to the closest future date, but how can that help me find out what values of the date were imputed by Duckling?

I don't think this is doable right now, you'd have to make a PR to make this possible

nvinayvarma189 commented 2 years ago

Thanks @chessai

I just have one more question. Since it is not possible to know which values are imputed, is it possible to know if at all imputation has happened?

I think even for this info, we would need a PR right?

chessai commented 2 years ago

Thanks @chessai

I just have one more question. Since it is not possible to know which values are imputed, is it possible to know if at all imputation has happened?

I think even for this info, we would need a PR right?

Yes, you would likely need a PR for that as well.