Commit Graph

16 Commits

Author SHA1 Message Date
Julien Odent
7a6c2597af Time: don't shift duration on <duration> before/after <time> (but now)
Summary:
* `Duration` before/after `Time` now resolves with the lowest grain
* "now" has an undefined grain `NoGrain`, as depending on the context it might mean different things, as opposed to "right now"

Before:
`day after tomorrow` -> `day` grain
`1 day after tomorrow` -> `hour` grain

Given that the reference date/time is `2013-02-12T04:30:00`.
`one year from now` -> `2014-02-01T00:00:00` with `month` grain.
`one year from today` -> `2014-02-01T00:00:00` with `month` grain.

After:
`day after tomorrow` -> `day` grain
`1 day after tomorrow` -> `day` grain
`one year from now` -> `2014-02-12T04:30:00` with `month` grain (remains the same).
`one year from today` -> `2014-02-12T00:00:00` with `day` grain.

For other `Time` entities involving `Duration`, such as "in + `Duration`", the behavior remains the same: shift to the lower grain (the intent is not precise).

Reviewed By: l5t, blandinw

Differential Revision: D5467164

fbshipit-source-id: b63b6a4
2017-07-26 11:49:44 -07:00
chiralcarbon
ce0e9e4f50 Add MM/YYYY and MM/YY
Summary:
MM/YY is a common format for dates in India,UK and other parts of the world.Have added testcases in `Time/EN/corpus.hs` ,however it conflicts with one of the original(2/15 is output now as Feb. 2015 and not the 15th of February).
Closes https://github.com/facebookincubator/duckling/pull/59

Reviewed By: niteria

Differential Revision: D5455881

Pulled By: patapizza

fbshipit-source-id: 23b73a5
2017-07-20 11:20:02 -07:00
Julien Odent
a55629d541 Fix #53
Summary: Added a rule to handle "from <month> dd-dd" to fix #53.

Reviewed By: blandinw

Differential Revision: D5329214

fbshipit-source-id: a5f746d
2017-06-27 12:49:23 -07:00
Julien Odent
bfb6ba0387 Numeral flag for Time patterns
Summary:
Today things like `at single`, `at a few`, `at a couple of` would return a `Time`.
Discussed with blandinw to do this very explicit hack right now until other use cases show up.

Reviewed By: niteria

Differential Revision: D5325369

fbshipit-source-id: aec0402
2017-06-27 07:34:21 -07:00
chao pan
efc1f36494 fix issue #50
Summary: Closes https://github.com/facebookincubator/duckling/pull/52

Reviewed By: blandinw

Differential Revision: D5296543

Pulled By: patapizza

fbshipit-source-id: 041844a
2017-06-23 07:04:27 -07:00
tarung-ml
d6f8ddc064 Support dates of type mm-dd
Summary:
e.g. "New York from 10-6 to 10-22" currently extracts: HH-MM. Instead, it should extract mm-dd i.e. October 10th to October 22nd.
Closes https://github.com/facebookincubator/duckling/pull/48

Reviewed By: niteria

Differential Revision: D5292473

Pulled By: patapizza

fbshipit-source-id: 04f1a4b
2017-06-22 04:04:26 -07:00
Julien Odent
213f94dda7 Time: don't parse 'this (past )?one'
Summary:
'one' is a latent time of day.
Restricting a couple of rules to accept non-latent time tokens.

Reviewed By: blandinw

Differential Revision: D5293972

fbshipit-source-id: 07cdb9b
2017-06-21 15:04:27 -07:00
Şeref R.Ayar
b0574191ac Support early/mid/late <month> #35
Summary: Closes https://github.com/facebookincubator/duckling/pull/43

Reviewed By: blandinw

Differential Revision: D5264974

Pulled By: patapizza

fbshipit-source-id: 0330f2b
2017-06-16 12:04:29 -07:00
Julien Odent
cd3f3dd2f4 Time/EN: afternoonish
Summary: Apparently it's a thing.

Reviewed By: blandinw

Differential Revision: D5199823

fbshipit-source-id: d2ed2aa
2017-06-09 09:34:20 -07:00
chao pan
292a94128f Generalize mm/dd rules to accept spaces like '05 / 27', '05/ 27'
Summary:
The existing "mm/dd" rules only accepts format like "05/27"; However, in practice there might be extra spaces like "05 / 27", "05/ 27". The pull requests tweaks the regex to accept extra space.
Closes https://github.com/facebookincubator/duckling/pull/31

Reviewed By: niteria

Differential Revision: D5147118

Pulled By: patapizza

fbshipit-source-id: f6a5069
2017-05-30 09:49:55 -07:00
Matt Schultz
ff9b54ad43 Added English fractional Numeral rule (ex: "3/4", "1/2", "5/7")
Summary:
Also added real-world test to English `Quantity` corpus ("3/4 cup", as a culinary example)
Closes https://github.com/facebookincubator/duckling/pull/14

Reviewed By: patapizza

Differential Revision: D5035990

Pulled By: niteria

fbshipit-source-id: c1b8f65
2017-05-10 07:04:16 -07:00
Bartosz Nitka
290ca48e25 Fix 4:23am returning 5:23am
Summary:
This is the easiest way to fix it, but talking offline
with Julien, we may need to revisit.
It basically gets rid of time series where we were
producing intervals that are not a multiply of the grain.

Reviewed By: patapizza

Differential Revision: D4841759

fbshipit-source-id: 1c4742a
2017-04-06 11:04:16 -07:00
Bartosz Nitka
28d53fce30 Remove ruleIntersect2
Summary:
It is no longer necessary after D4676812 and D4698788.
`"I have 9 am 12 pm 1 pm 2pm 4 pm 3 pm on Saturday"` now works in
less than a second, it used to be 10s.

The test suite also got 3s faster.

Reviewed By: patapizza

Differential Revision: D4701890

fbshipit-source-id: 107a55f
2017-03-14 05:04:12 -07:00
Bartosz Nitka
003604dce7 Optimize simple time predicates
Summary:
This is the next step for:
https://fb.facebook.com/groups/527352907463243/permalink/600056483526218/

This:
* changes the time language to be able to track contradictions (`EmptyPredicate`)
* changes the time language to be able to collect non-contradicting pieces, like month and hour and unify them
* provides an efficient way to convert those pieces into (past,future) time series
* adds AMPM predicate runner - there's a bit of overlap with is12H, but it basically works
* changes a test case that was wrong before
* regenerates classifiers, I'm not sure why they changed exactly

Before:
```
res <- H.io $ let sentence = "10am thurs 4.30 thurs 12pm sat" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(15.50 secs, 6,171,188,928 bytes)

res <- H.io $ let sentence = "I have 9 am 12 pm 1 pm 2pm 4 pm 3 pm on Saturday" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(110.82 secs, 44,031,569,512 bytes)
```

After:
```
res <- H.io $ let sentence = "10am thurs 4.30 thurs 12pm sat" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(1.24 secs, 703,020,912 bytes)

res <- H.io $ let sentence = "I have 9 am 12 pm 1 pm 2pm 4 pm 3 pm on Saturday" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(9.51 secs, 5,891,109,592 bytes)
```

Reviewed By: JonCoens

Differential Revision: D4676812

fbshipit-source-id: 9810203
2017-03-13 17:04:10 -07:00
Julien Odent
2e50aa5ea0 Fix 'tomorrow July' + IT fixes
Summary:
* we weren't checking the right reference time in `takeNth` and `takeN`
* fixing resulting failing tests for `IT`
* `analyzedNTest` to check that input results in `n` parsed tokens

Reviewed By: niteria

Differential Revision: D4698788

fbshipit-source-id: 2cd4762
2017-03-13 12:04:17 -07:00
FBShipIt
3f8e52e70a Initial commit
fbshipit-source-id: 301a10f448e9623aa1c953544f42de562909e192
2017-03-08 10:33:56 -08:00