facebook / facebook/duckling

[EN/DE/ES/...] 'Part of Day' rule coerces timespans

Open
#648 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
4.3k
Forks
739
PR merge metrics
No merged PRs in 30d

Description

Some time spans are incorrectly interpreted, yielding values that seem caused by a defaulting rule. Parsing is correct, but when building the final Entitys for some reason the time span from and to are incorrect.

All of these report the correct time spans:

vormittags von 3 bis 11 Uhr
vormittags von 4 bis 11 Uhr
...
vormittags von 10 bis 11 Uhr

If the lower bound is 1 or 2 the lower bound is (incorrectly) set to 03:00.

On the other side, if the upper bound is 12 or greater then the time span defaults to 03:00 to 12:00 consistently. I tracked down the issue to the rule time-of-day (latent):

https://github.com/facebook/duckling/blob/d8888e2ff842c4dacd570989570c101cf7b43153/Duckling/Time/DE/Rules.hs#L959

As far as I understand, 'latent' means that there's some ambiguity. For example, the number 7 could mean several things depending on the context.

Lets change this rule and use the check n < 13 like in the EN version:

https://github.com/facebook/duckling/blob/d8888e2ff842c4dacd570989570c101cf7b43153/Duckling/Time/EN/Rules.hs#L577

This will no longer break the lower bound when the upper bound is 12. Nevertheless, the issue remains for the upper bound: values 12 ... as upper bound result in ranges 03:00 to 12:00 consistently. Do these values ring any bell? some kind of defaulting rule?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Duckling/Time/DE/Rules.hs at the time-of-day (latent) rule and compare it with the corresponding rule in Duckling/Time/EN/Rules.hs. Reproduce the German vormittags von 1 bis 11 Uhr and vormittags von 3 bis 12 Uhr cases, then trace entity construction to identify why the bounds become 03:00 or 12:00. Done means the reported lower and upper time bounds are preserved correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.