Commit Graph

649 Commits

Author SHA1 Message Date
byuan
596bf62888 Fixed a problem with parsing "day of month" that contains "dia" in it (#487)
Summary:
Current:

"el dia nueve" -> "9pm" of current day

Expected:
"el dia nueve" -> 9th of current or next month

Fix:

added new ES rule to handle the pattern like "el dia  <day of month>"
Pull Request resolved: https://github.com/facebook/duckling/pull/487

Reviewed By: girifb

Differential Revision: D21850807

Pulled By: chinmay87

fbshipit-source-id: d8edd81273c7e5f700b440ccc8c7e7bded679051
2020-06-09 14:51:08 -07:00
byuan
4cfe88ead1 Fixed a problem with paring fractional time phrase for hours and minutes. (#483)
Summary:
Current behavior:
"an hour and 45 minutes" -> parsed as "1 hour" [dimension: "Duration"]
"a minute and 30 seconds" ->parsed as "1 minute" [dimension: "Duration"]

Expected behavior:
"an hour and 45 minutes" -> "105 minutes" with dimension as "Duration"
"a minute and 30 seconds" -> "90 seconds" with dimension as "Duration"

The fix:

adding new rule to handle this duration composition
pattern. (<some duration> and <some other duration>)
Pull Request resolved: https://github.com/facebook/duckling/pull/483

Reviewed By: haoxuany

Differential Revision: D21850773

Pulled By: chinmay87

fbshipit-source-id: 62eb6859e0ce2b88cf8ae48d836a1a6a1ac8705d
2020-06-05 13:01:48 -07:00
byuan
1dac46a8ce Time/es: Make "n horas" latent". (#478)
Summary:
1. ~~Fixed broken build due to the problem with main test entry point;~~
2. Fixed the ambiguous results caused by mishandling the
ranking rules for parsing frames in ES. For example "una hora"
be interpreted either as "Duration" or "1pm" in "Time" dimension.
And the expected result should be in "Duration" dimension.
3. ~~ignore stack lock file~~
Pull Request resolved: https://github.com/facebook/duckling/pull/478

Test Plan:
```
:test Endpoint.Duckling.Tests --hide-successes
[1003 of 1003] Endpoint.Duckling.Tests (Duckling.Api changed)
Ok, two modules loaded.

All 357 tests passed (79.69s)
```

```
haxlsh> H.io $ debug (makeLocale ES Nothing) "de una horas" [This Time, This Duration]
<integer> <unit-of-duration> (una horas)
-- number (0..15) (una)
-- -- regex (una)
-- hora (grain) (horas)
-- -- regex (horas)
[Entity {dim = "duration", body = "una horas", value = RVal Duration (DurationData {value = 1, grain = Hour}), start = 3, end = 12, latent = False, enode = Node {nodeRange = Range 3 12, token = Token Duration (DurationData {value = 1, grain = Hour}), children = [Node {nodeRange = Range 3 6, token = Token Numeral (NumeralData {value = 1.0, grain = Nothing, multipliable = False, okForAnyTime = True}), children = [Node {nodeRange = Range 3 6, token = Token RegexMatch (GroupMatch ["una","","a","","",""]), children = [], rule = Nothing}], rule = Just "number (0..15)"},Node {nodeRange = Range 7 12, token = Token TimeGrain Hour, children = [Node {nodeRange = Range 7 12, token = Token RegexMatch (GroupMatch ["ora"]), children = [], rule = Nothing}], rule = Just "hora (grain)"}], rule = Just "<integer> <unit-of-duration>"}}]
it :: [Entity]
```

Reviewed By: fascpt

Differential Revision: D21770015

Pulled By: chinmay87

fbshipit-source-id: 3056fcf656140c9d65b70b5c604a286ea2c307b2
2020-05-29 11:09:46 -07:00
Steven Troxler
4bfe50eed0 AmountOfMoney/EN: Make ruleIntervalMax, ruleIntervalMin symmetric
Summary:
When I was working on some related diffs, I noticed that there were some
asymmetries between the regexes for ruleIntervalMax and ruleIntervalMin:
 - we had no support for "at most", even though we did have "at least"
 - we had no support for "not? less than"
 - the ordering of the different constructions didn't match

This a minor tweak to make things match better

Reviewed By: patapizza

Differential Revision: D20484594

fbshipit-source-id: c3c54a9cc1b83402e42634b7a98a1a3b8cc5e09c
2020-04-07 10:32:29 -07:00
Chinmay Deshmukh
d91a2dd4c0 Time/es: Fix ruleYearLatent
Summary: Fix `ruleYearLatent` to be the same as the one in `en`. We don't want to match numerals that could have been hours.

Reviewed By: patapizza

Differential Revision: D20683975

fbshipit-source-id: cdef9b1b5f8a21dc5e207ed2a7afcad84c56a596
2020-03-27 15:07:22 -07:00
Julien Odent
7166286a6f Add type=value to JSON response for Email, PhoneNumber and Url
Summary: For consistency.

Reviewed By: jtliao

Differential Revision: D20524369

fbshipit-source-id: 44031667adccab9bca7b3b6d42c80878bb96ccae
2020-03-18 17:04:42 -07:00
Steven Troxler
5d6750208a Duration: Rename timesOneAndAHalf to nPlusOneHalf
Summary:
When I first skimmed our rules for "half an hour" vs "an hour and a half"
I actually thought there might be a bug, because `timesOneAndAHalf`
sounds like it's actually multiplying by `1.5`.

There's no bug, the implementation is entirely correct, but it does
not multiply by 1.5, it adds .5 to any integer value at the given grain.
This diff renames the function to be more descriptive.

Handy trick for doing this kind of refactor without IDE tooling:
```
find duckling/Duckling/Duration/ -name 'Rules.hs'| xargs sed -i 's/timesOneAndAHalf/nPlusOneHalf/g'
```

Reviewed By: haoxuany

Differential Revision: D20456966

fbshipit-source-id: 35020685f091a41618b30b7e5f95dbfa48509b88
2020-03-16 12:17:00 -07:00
Ciaran O'Reilly
04d0db6efa Numeral/EN: Fixes ambiguous parses when both ruleNegative and ruleMultiply apply (#406)
Summary:
I noticed two ambiguous parses would occur when both ruleNegative and ruleMultiply would apply.

For example: "minus three million two hundred thousand"

```
*Duckling.Debug> debug (makeLocale EN Nothing) "minus three million two hundred thousand" [This Numeral]
compose by multiplication (minus three million two hundred thousand)
-- negative numbers (minus three million two hundred)
-- -- regex (minus)
-- -- intersect 2 numbers (three million two hundred)
-- -- -- compose by multiplication (three million)
-- -- -- -- integer (0..19) (three)
-- -- -- -- -- regex (three)
-- -- -- -- powers of tens (million)
-- -- -- -- -- regex (million)
-- -- -- compose by multiplication (two hundred)
-- -- -- -- integer (0..19) (two)
-- -- -- -- -- regex (two)
-- -- -- -- powers of tens (hundred)
-- -- -- -- -- regex (hundred)
-- powers of tens (thousand)
-- -- regex (thousand)
negative numbers (minus three million two hundred thousand)
-- regex (minus)
-- intersect 2 numbers (three million two hundred thousand)
-- -- compose by multiplication (three million)
-- -- -- integer (0..19) (three)
-- -- -- -- regex (three)
-- -- -- powers of tens (million)
-- -- -- -- regex (million)
-- -- compose by multiplication (two hundred thousand)
-- -- -- compose by multiplication (two hundred)
-- -- -- -- integer (0..19) (two)
-- -- -- -- -- regex (two)
-- -- -- -- powers of tens (hundred)
-- -- -- -- -- regex (hundred)
-- -- -- powers of tens (thousand)
-- -- -- -- regex (thousand)
```

This PR fixes this ambiguity and Duckling will only return the second (correct) parse.
Pull Request resolved: https://github.com/facebook/duckling/pull/406

Test Plan:
regen'd classifiers (no-op)

  :test Duckling.Tests

Imported from GitHub, without a `Test Plan:` line.

Reviewed By: chinmay87, girifb

Differential Revision: D20303354

Pulled By: patapizza

fbshipit-source-id: 280b0e33b7c944f9d87a7c23afda2f6a843e28a4
2020-03-13 11:40:02 -07:00
Steven Troxler
e3114c08f5 AmountOfMoney/ES: Add support for intervals
Summary:
This change applies roughly the same rules for supporting intervals
in Spanish AmountOfMoney that we suppor in English: intervals using
`entre _ e _` / `de _ a _` / `_ - _` with either money in both slots
or a number in the first slot and money in the second.

My Spanish is okay but not great - I'm confident these rules are good and
cover the most likely phrases, but there's probably room to add more coverage.

Reviewed By: patapizza

Differential Revision: D20425979

fbshipit-source-id: deb17fc331e1aa192d91dd47bc7f3864a246f0be
2020-03-13 11:21:45 -07:00
Ashwini Challa
2f38255cf8 Enabling TimeGrain (#460)
Summary:
Pull Request resolved: https://github.com/facebook/duckling/pull/460

Exposing the TimeGrain feature

Reviewed By: patapizza

Differential Revision: D20250270

fbshipit-source-id: 726f85eebd95ae31d911ebd9a43428d549aba877
2020-03-05 12:50:20 -08:00
Julien Odent
f57593c9df Time/EN: the (nth) closest (day) to (time)
Summary:
Leveraging `predNthClosest` helper in English rules.
"the second closest monday to february 6"
"the closest tax day to boss day 2018"

Reviewed By: haoxuany

Differential Revision: D20214444

fbshipit-source-id: b6be32f63097d221aa7ccc6df4e3639e4deee4a9
2020-03-03 12:04:53 -08:00
Julien Odent
11f671a95a Time/EN_US: Super Tuesday
Summary: Adding new holiday.

Reviewed By: haoxuany

Differential Revision: D20193781

fbshipit-source-id: c8be523293b7b6ee836965c8914e3db58cc41085
2020-03-02 10:48:07 -08:00
Jiaxu Zhu
0527be1ce0 Adding Locales for ES Numeral
Summary:
Adding locale rules for ES Numeral because Spain use "," as decimal but south american country use "." as decimal.

Wiki: https://en.wikipedia.org/wiki/Decimal_separator

Reviewed By: haoxuany

Differential Revision: D20040111

fbshipit-source-id: e2a4bfc2928df19976ef98e90ee82e7d21b52313
2020-02-25 16:01:45 -08:00
Andrew Ma
4681cf4bba Time/EN_US: orthodox good friday
Summary: Supporting "orthodox good friday" in addition to "orthodox great friday" in the regex

Reviewed By: chinmay87

Differential Revision: D19604033

fbshipit-source-id: c6ca68fc34e284304ca2ba07a8f1bf81378c3558
2020-01-28 14:24:25 -08:00
Jesse Vermeulen
922d06b6e4 AF Setup + Numeral (#422)
Summary:
- Setup Afrikaans (AF) language
- Added Numeral Dimension

Some of the paths have changed, and some extra files were necessary, after
basing initial work off 24d3f19976

I followed some of the Numeral examples from Dutch as well as Hungarian,
since Afrikaans and Dutch have some similarities.

One thing was examples for numbers having the number as an example, which I
didn't do here, because I'm not sure it's necessary.
Pull Request resolved: https://github.com/facebook/duckling/pull/422

Reviewed By: awalterschulze

Differential Revision: D18348617

Pulled By: patapizza

fbshipit-source-id: b8c4218629c264b48d6f2cecc4c23e2e281a64da
2020-01-10 15:02:50 -08:00
Ondrej Kováč
294771593d Added Slovak (sk) language with numeral dimension and tests.
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/428

Reviewed By: haoxuany

Differential Revision: D18348514

Pulled By: patapizza

fbshipit-source-id: 9b0b9c2caa9fec8330746059eefa6185a8f3e072
2020-01-10 14:49:08 -08:00
Aleksandar Hitrov
cff1ca0080 Add Time dimension for language BG
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/403

Reviewed By: haoxuany

Differential Revision: D18348752

Pulled By: patapizza

fbshipit-source-id: ce3b5c76cb2cf39114216842529d4eaa8df5b93f
2020-01-10 14:34:22 -08:00
Aaron Yue
8d681f7ec7 fix imports for Types
Summary: apparently this is breaking the external build, fix this

Reviewed By: patapizza

Differential Revision: D19104360

fbshipit-source-id: bc75f698b483a7f4f5b2905e11cf52fd36c1f0a9
2019-12-17 15:41:19 -08:00
Julien Odent
a6b7253aa4 Duration/EN: Leverage TimeGrain for number.number hours
Summary: also kill redundant `isGrain` helper from `Time`.

Reviewed By: dwhit, haoxuany

Differential Revision: D18937649

fbshipit-source-id: ed658cc3bac70e6592dabae536a31a4c2da8a578
2019-12-11 12:38:17 -08:00
David Whitney
0ebaf378dc Duration/EN: parse Xm as X minutes and X.Y hrs as X.Y hours
Summary: modified the regex pattern for minutes to include m alone, as well as the regex pattern for ruleDurationDotNumeralHours to pass h, hr, and hrs

Reviewed By: patapizza

Differential Revision: D18799727

fbshipit-source-id: df4d0bd53407b427254169454e647e43e073795e
2019-12-06 08:47:51 -08:00
Kamolsit Mongkolsrisawat
7f2450e067 Add Numeral dimension for new language TH (#399)
Summary:
Hello,
I am new to Haskell, but I would like to add Thai language (TH) to Duckling.
I have tried to extended Duckling by adding Numeral dimension for new language TH.
Please have a look at it and see what we can improve.

Thanks!
Pull Request resolved: https://github.com/facebook/duckling/pull/399

Reviewed By: patapizza

Differential Revision: D17651508

Pulled By: haoxuany

fbshipit-source-id: 4b3ee1352f239eee637958f5e9dce68430352a0a
2019-11-27 15:48:38 -08:00
Eric Pinkham
a204954397 reuse helpers in HR rules
Summary: [Duckling][Time][HR] Reuse helpers: cleanup code by reusing helper functions in HR rules

Reviewed By: chinmay87

Differential Revision: D18310913

fbshipit-source-id: 0efd69121d25f6a0967b104bfaf97a2b3096ed30
2019-11-07 10:03:56 -08:00
Kai Jun Weng
fa5d74ed34 Time/EN: Support 'the <day-of-month > of <month>'
Summary: We weren't capturing cases like "the second of february" as it was matching with the "the <cycle> of <time>" rule

Differential Revision: D18249651

fbshipit-source-id: 09e214f585b96d07af4d5043de61445f4e156c54
2019-10-31 12:48:29 -07:00
Franz-Julius Chen
ba092881c5 Time/EN_US: Modify this|last|next <cycle>
Summary: We weren't capturing cases like "the first Saturday of the month", due to "the month" not being properly parsed.

Reviewed By: haoxuany

Differential Revision: D18193355

fbshipit-source-id: 2c4e83a3f22b0fe306ce7662ade85434a0016784
2019-10-29 11:16:47 -07:00
Franz-Julius Chen
8dc4ca9289 Readd a test.
Summary: This got removed in a previous commit, readd this to confirm this functionality is still working.

Reviewed By: haoxuany

Differential Revision: D18175640

fbshipit-source-id: 3d06efe3537e1a517f412ed739f3cc34a9b3105b
2019-10-28 15:46:51 -07:00
Franz-Julius Chen
6f560efa7b Add "<part-of-day> at "<time-of-day>" rule.
Summary:
Parts of day are time ranges, e.g. "tonight" is a range from 6:00pm to midnight. We have intersect logic in place to resolve a string like "tonight at 7pm" to one time, at 7pm. But if the time is outside of the part of day's range (e.g. "tonight at 5pm"), the string is resolved to 2 separate times ("tonight" and "at 5pm").

These changes resolve e.g. "tonight at xx" to "xx" irrespective of the range of tonight, as long as the am/pm makes sense (so "tonight at 5am" would still resolve to 2 separate times - "tonight" and at "5am").

"this/early morning at xx" gets resolved to "xx am". All other parts of day get resolved to "xx pm", with one exception: all parts of day resolve "... at 12" to midnight.

Differential Revision: D17694898

fbshipit-source-id: 1e24023759bb942659285d18a6a4d0b09f77c9da
2019-10-25 17:04:55 -07:00
Meghana Doppalapudi
b6fc40aff3 Time/EN: Added rama navami holiday
Summary: Added support for Rama Navami holiday from 2000 to 2030

Reviewed By: chinmay87

Differential Revision: D17881237

fbshipit-source-id: f3f17d67d178fa8fbcb8ae640c3bfc17bc3e21d3
2019-10-11 12:03:17 -07:00
Kai Jun Weng
ea1cb8facb Duration/EN support for <integer> hour and <integer>
Summary: Resolves durations such as "2 hours and ten" to 130 minutes or "1 hour and 15" to 75 minutes.

Reviewed By: zhpzuo

Differential Revision: D17822118

fbshipit-source-id: 7da5c0e43ced91cb924046f764c133a66af8ee4d
2019-10-11 00:16:54 -07:00
Manika Puri
1b36e2b819 Time/EN: Added support for Ganesh Chaturthi
Summary: Added support for Ganesh/Vinayaka Chaturthi Hindu holiday from 2000 to 2030

Reviewed By: haoxuany

Differential Revision: D17675368

fbshipit-source-id: 2d53ad2592fc8d234bd7a3cbac2bddeaa45b220b
2019-10-01 12:01:57 -07:00
Michał Andrzej Tepper
18b399d3e0 Time/PL: refactor
Summary:
Refactor Time/PL code by reusing mkRuleHolidays and mkRuleSeasons, and guarding against isOkWithThisNext for ruleLastTime, ruleNextTime, ruleThisTime,
,and mkOkForThisNext for ruleWeekend

Add another polish holidays

Reviewed By: chinmay87

Differential Revision: D17395534

fbshipit-source-id: d4ec591b0aad71f8f5e144ff5274491d55dc97f6
2019-09-27 04:46:47 -07:00
Phuong Trinh
0b57f49360 Remove ANN pragma for duckling
Summary:
Use of ANN pragma may slow down compilation time because of TemplateHaskell.
Because of that, using comment style ignore would be preferable.

For more information on ways to ignore hints with hlint, please see
https://github.com/ndmitchell/hlint#ignoring-hints

Reviewed By: patapizza

Differential Revision: D17365266

fbshipit-source-id: 71e4952738bba17b4d2ec2a18b31b4b7e3f509db
2019-09-26 02:49:33 -07:00
Anne Chen
332e0cc0a7 Translate periodic holidays
Summary:
Add the support for periodic holidays in Spanish (the ones that make sense in the language).

Skipped Periodic Holidays:
Año Nuevo, Navidad, Nochevieja: These holidays already had rules defined for them in the Rules file (see ruleAnoNuevo, ruleNavidad, ruleNochevieja)
Ugadi: This holiday does not have a translation into Spanish.

Note: Ignoring Lint issues for "Line too long", to follow convention set by original file / previous diffs.

Reviewed By: chinmay87

Differential Revision: D17506908

fbshipit-source-id: 7b43768443dcd4f020a20758995a63ab88706b35
2019-09-25 12:48:20 -07:00
Michael Voegele
4218897f64 Translated all computed holidays from English into German and added HolidayHelpers to reduce code duplication.
Summary: Added German langauage support for all computed holidays currently supported in English. Also created HolidayHelpers, which contains more complex holiday calculations used across languages.

Reviewed By: patapizza

Differential Revision: D17386163

fbshipit-source-id: 9dd88f8b0d699e5d7254a5ba7114bfa01b15176a
2019-09-20 18:32:13 -07:00
Karoly Szabo
71e1b9760d Translate periodic holidays
Summary: Adding support for periodic holidays in Italian

Reviewed By: chinmay87

Differential Revision: D17204304

fbshipit-source-id: 06adf1c5f673263cab7269033d2a312baca842eb
2019-09-18 02:17:00 -07:00
Hao Wang
c5f697ba5a Add support for computed holidays in ZH
Reviewed By: chinmay87

Differential Revision: D17431708

fbshipit-source-id: 88b95877f49c0f46e4c9817020c266c37974daa2
2019-09-17 15:34:08 -07:00
l5t
de8af2395d EN/FR support temperature with decimal values (#408)
Summary:
Allowing the support of decimal values like in human body temperature. Example: 98.6°F
Pull Request resolved: https://github.com/facebook/duckling/pull/408

Reviewed By: girifb

Differential Revision: D17401806

Pulled By: patapizza

fbshipit-source-id: f04b768e2f6cb48c9c50977a5807d62e38f8d545
2019-09-17 10:34:25 -07:00
Michael LeMay
1fa17b01d4 Time/EN: Added Ratha-Yatra holiday
Summary:
Added dates for Ratha-Yatra

I double checked the dates, but still could have messed something up.

Reviewed By: patapizza

Differential Revision: D17358944

fbshipit-source-id: bf7c5f81c83c312166c5e3c960534606b95f0c2e
2019-09-16 14:20:21 -07:00
Chinmay Deshmukh
fd8eb2190a En/Time: Support "Saint" Patrick's Day
Summary: Improved the regex to support "saint"

Reviewed By: patapizza

Differential Revision: D17327533

fbshipit-source-id: 97b8290c416adbc4b32d543b01f408016c62075a
2019-09-12 16:31:43 -07:00
Diego Dainese
c9baa741f9 Time: Extend support for Ramadan and Eid al-Fitr from 1950 to 2000
Summary: Previously Duckling was supporting Ramadan and Eid al-Fitr from 2000 to 2029. Now the range has been expanded to start from 1950.

Reviewed By: patapizza

Differential Revision: D17319760

fbshipit-source-id: 008ef7ffef77f293666a32381f663db07b8130ae
2019-09-11 23:48:16 -07:00
Sergei Rybalkin
70681e3302 latent entities
Summary:
Adding latent matching rules.
Matching Numerical to QuantityData with Unnamed as unit

Reviewed By: chinmay87

Differential Revision: D17225711

fbshipit-source-id: 8e423454e5e7b83eb8de4cabfd4f85a2a35b7a6d
2019-09-10 10:46:42 -07:00
Sergei Rybalkin
961930b1ea Add Ugadi holiday
Summary: Adding support for Ugadi holiday from 2000 to 2030.

Reviewed By: chinmay87

Differential Revision: D17156412

fbshipit-source-id: b16f710912bf90a1a472661e31d83fbff7043cfe
2019-09-06 14:57:30 -07:00
Terrance Liang
a63d631a23 reuse helpers
Summary:
guard against `isOkWithThisNext` for ruleThisTime, ruleNextTime and ruleLastTime.

Required changes to be made in ruleNoon, ruleMidnight, and ruleWeekend

Reviewed By: patapizza

Differential Revision: D16999895

fbshipit-source-id: 2c18bd39692389f7e6a9d2fb82802e9dc509893d
2019-09-03 11:18:11 -07:00
Chinmay Deshmukh
436a97e738 Duration/EN: <integer> and a half minutes
Summary: Add rule for "<integer> and a half minutes"

Differential Revision: D17108126

fbshipit-source-id: beaf3eea976572fdec292df6c17303abeb8fcdbf
2019-08-30 13:32:36 -07:00
Julien Odent
a0ca037668 Add back Copyright header to EN_GB classifiers
Summary: as title

Reviewed By: chinmay87

Differential Revision: D16902441

fbshipit-source-id: 9b6d1fe9696191dffef5af315a47666edf715c0d
2019-08-19 22:06:57 -07:00
Shubham Khandelwal
f2af9422bd Add Pargat Diwas holiday | T28481361
Summary:
Adding support for Pargat Diwas holiday from 2000 to 2030. Made changes to:
- corpus.hs (included test)
- computed.hs (included dates): Dates were checked on the sources:
    * https://www.drikpanchang.com/hindu-saints/valmiki/maharishi-valmiki-jayanti.html?year=2020 (year being changed)
    * https://www.festivalsdatetime.co.in/2018/11/2020-valmiki-jayanti-date-and-time-2020.html?m=1 (year being changed)

    For conflicting dates (one day difference), chose www.drikpanchang.com as the primary choice.
- rules.hs (included regex for the festival)

Generated all the related classifiers

Reviewed By: chinmay87

Differential Revision: D16721179

fbshipit-source-id: c3c1023b39ca616374a5d936c08352ee0d4b210d
2019-08-10 01:36:02 -07:00
Hayley Russell
d03423cff5 Reuse helpers
Summary: Guarded against `isOkWithThisNext` for ruleThisTime, ruleNextTime and ruleLastTime. Changes based off of D16589879 and D7200945

Reviewed By: chinmay87

Differential Revision: D16678781

fbshipit-source-id: b1fba9067818d0cc587016651b35d54d5c70e621
2019-08-07 15:33:18 -07:00
Simran Suresh Motwani
a20b98a8ec Reuse helpers
Summary: Reuse mkRuleHolidays, mkRuleSeasons, mkRuleDaysOfWeek, mkRuleMonths in the Arabic rules for Time, and guard against `isOkWithThisNext` for ruleThisTime, ruleNextTime and ruleLastTime.

Reviewed By: chinmay87

Differential Revision: D16589997

fbshipit-source-id: f8e6d7fb6362abc314aa9eb04bfa4b965e1d1e41
2019-08-01 14:46:24 -07:00
Jae Lee
125ab967e0 Use mkRuleDaysOfWeek for KO language
Summary: Use mkRuleDaysOfWeek for KO language.

Reviewed By: patapizza

Differential Revision: D16441936

fbshipit-source-id: 1bee48cd59caede92cf43056ea5aa4d953827318
2019-07-31 16:20:22 -07:00
Jae Lee
fa386a548e Use mkRuleSeason for KO language
Summary: Use mkRuleSeason for KO language.

Reviewed By: patapizza

Differential Revision: D16441908

fbshipit-source-id: 94c450461fe788561dbf41e7b811de3d699f504d
2019-07-31 16:20:22 -07:00
Jae Lee
70dde3bc60 Use mkRuleHoliday for KO language
Summary: Use mkRuleHoliday for KO language

Reviewed By: patapizza

Differential Revision: D16441727

fbshipit-source-id: 167c47ed5f3960e9ab68d9b4b444ae9f1c63eda5
2019-07-31 16:20:21 -07:00
Sindhu Vempati
e8ecb23113 added Maha Shivaratri holiday to Duckling
Reviewed By: chinmay87

Differential Revision: D16504890

fbshipit-source-id: fc4f1392203cc22a9c4cee7a6d4317a12a0cb85c
2019-07-29 14:20:01 -07:00
Jae Lee
7e17d31201 Added Mahavir Jayanti holiday
Summary: Added Mahavir Jayanti holiday from 2000 to 2030.

Reviewed By: chinmay87

Differential Revision: D16380984

fbshipit-source-id: 025127cfab312645ec622527a217a910a55179d3
2019-07-22 08:31:36 -07:00
Kai Jun Weng
9e96ac802a Time/EN Support for a quarter after <hour-of-day>
Summary:
Essentially "for a quarter after <time-of-day>" gets matched with the "for <duration> from <time>" rule where "quarter" is interpreted as a duration of a few months.
Fixing this by allowing an optional preceding "for " in the quarter "quarter after|past <hour-of-day>" rule.

Reviewed By: chinmay87

Differential Revision: D16166518

fbshipit-source-id: 0215ec6a0dabf227194a14d15c87c8ed5539f9d1
2019-07-10 18:01:56 -07:00
Michael Guarino
ef0919055f Add Karva Chauth to duckling
Summary: Need to manually specify the dates due to differences in the Hindu and Gregorian calendars

Reviewed By: haoxuany

Differential Revision: D16151703

fbshipit-source-id: dfa8136fa133df5b31402fe4ab3825e97ad604aa
2019-07-10 13:16:51 -07:00
Sasa Milic
b29bb5d3ed Support for intervals
Summary:
- Supports singular (like English "a")
- Supports intervals (e.g. EUR 100-200)
- Supports open intervals (like English "more than", "less than")

Reviewed By: haoxuany

Differential Revision: D16069296

fbshipit-source-id: 74808ad28f5673c2ca82f07dcc0934f82910b566
2019-07-02 13:34:55 -07:00
Filipe Correia
7341556898 Time/EN: Adding support for <hour>h<min>
Summary: Adding support for 24h "h" time separator as in "23h45" and "23h".

Reviewed By: patapizza

Differential Revision: D15692699

fbshipit-source-id: 58ae8105ff97b887e9fe171927e89a7c444d7ed5
2019-06-28 08:16:42 -07:00
Chinmay Deshmukh
a9438734c9 Duration/en: 5 additional minutes
Summary: Support more words in rule `ruleDurationNumeralMore`

Reviewed By: patapizza

Differential Revision: D15501197

fbshipit-source-id: feb12cd27dfb964e1e404b1d902828000c9fa4f7
2019-06-03 18:02:51 -07:00
Chinmay Deshmukh
e54cbe3165 Time/EN: "the week"
Summary: Make "the week" resolve to interval from `today` to `end of week`

Reviewed By: patapizza

Differential Revision: D15400571

fbshipit-source-id: 143fa2a8b7c30f1bee0ba8419926db90c680d036
2019-05-23 16:02:57 -07:00
Jens Persson
41f140992d Add support for larger spelled-out Danish ordinals (#346)
Summary:
Adds support for larger spelled-out Danish ordinal number expressions, like
treoghalvfemsindstyvende (93rd)
or
tohundrede og femogfyrrende (245th)
Pull Request resolved: https://github.com/facebook/duckling/pull/346

Reviewed By: patapizza

Differential Revision: D14476918

Pulled By: chinmay87

fbshipit-source-id: eb20ee8d304f291ff4ab2b28c4e272a9d447396e
2019-05-23 16:02:56 -07:00
Julien Odent
bf89e34365 Relicense to BSD3
Reviewed By: JoelMarcey

Differential Revision: D15439223

fbshipit-source-id: c5af3cb06318748142fe503945b38beffadfc28a
2019-05-22 10:46:39 -07:00
Kai Jun Weng
0eb5b060d7 Time/EN Add <duration> past <time>
Summary: We need to handle "N minutes past <time>".

Reviewed By: patapizza

Differential Revision: D15283767

fbshipit-source-id: 2a758e62c7af93b7f3c0e5856e38e3f040dcca03
2019-05-10 08:46:40 -07:00
Julien Odent
6d980a63a4 fix build
Summary: missing import

Reviewed By: haoxuany

Differential Revision: D15198265

fbshipit-source-id: 443c245c2194dd17b87fd5ae360e804f2b08142c
2019-05-03 09:26:50 -07:00
Josua Blejeru
54cd64d0ec Fix minor issues in german. (#362)
Summary:
1. Fix a bug for "fünfter"
3. support for "am ersten Dezember" to " am einunddreißigsten Dezember"
3. duckling recognizes  "der fünfte Dezember"

- [x] ``README.md`` is up to date with docker
- [x] ``docker-compose.yml`` is included
- [x] all ``apt-get`` commands are in a single RUN command to avoid multiple stages
- [x] dockerfile now use the files from the directory
- [ ] more tests should be include
Pull Request resolved: https://github.com/facebook/duckling/pull/362

Reviewed By: patapizza

Differential Revision: D15100843

Pulled By: haoxuany

fbshipit-source-id: 407c8bb2a05a1d0cee81c407e81d882fca63a2be
2019-05-01 14:02:06 -07:00
Andrew Eun Kyu Kang
0b551597ce EN/Time: Add "<integer> <day-of-time> from <time>" rule
Summary:
"What is the date three Fridays from now?" resolves incorrectly:

- On Friday, it detects "three fridays", "fridays from now"
- On other days, it detects "three fridays", "from now"

Thus, added a new rule, "<integer> <day-of-week> from <time>" to give the expected result of three Fridays after the current day and added test examples. If there are too many test examples, please let me know!

Reviewed By: chinmay87

Differential Revision: D15110770

fbshipit-source-id: a77b86de8b6d8f7c947df9e14edb17f61bcc8419
2019-04-29 18:16:58 -07:00
Chinmay Deshmukh
9962e25845 Time/EN: "<day> in <duration>" should only operate on grain > Hour
Summary:
`today in one hour` was returning a time interval starting at 1 hr from now and ending at 2 hr from now.

The expected value is a single value one hour from now. This is accomplished by restricting `"<day> in <duration>"` to operaton only on durations with a grain > Hour

Reviewed By: patapizza

Differential Revision: D15055912

fbshipit-source-id: c3141eba358036577d2e14f0d588a99af83f62be
2019-04-24 11:46:35 -07:00
Varun M Rao
10f3ce044f Time/EN: Krishna Janmashtami
Summary: Added Krishna Janmashtami to Duckling.

Reviewed By: chinmay87

Differential Revision: D14763094

fbshipit-source-id: 46d65c74f53010113ccfaab6cc0d40545c3945b9
2019-04-08 16:03:35 -07:00
Nathan Hausman
cbfca8ccc3 Support Arabic decimals and comma separated integers
Summary: Adding support for decimal numbers written in Arabic script.

Reviewed By: patapizza

Differential Revision: D14700060

fbshipit-source-id: 3261c36dde17dc9e589eac6b6521da6dece814f2
2019-04-03 13:07:23 -07:00
Nathan Hausman
f6399c8462 Support Arabic numeric integer and fractions
Summary: Adding support for Arabic numbers written in Arabic script.

Reviewed By: patapizza

Differential Revision: D14697405

fbshipit-source-id: 1162319afda55bdfdcb132932fa7e3a99fdcda15
2019-04-03 08:33:26 -07:00
Nathan Hausman
b90ff9a64e Support Arabic phone numbers
Summary: Support Arabic phone numbers for AR locales.

Reviewed By: patapizza

Differential Revision: D14591780

fbshipit-source-id: 93875c5b407c3fe2a06276c6fa3af2a26c91639e
2019-03-29 09:48:20 -07:00
Nathan Hausman
830e5e3d8e Time/AR: Periodic and Time
Summary: Adding Arabic support for periodic and rule computed holidays.

Reviewed By: patapizza

Differential Revision: D14573637

fbshipit-source-id: 84d8c42acaebc8483c641cc865e54c418c9918aa
2019-03-29 09:48:20 -07:00
Laurence Emms
77e88171d6 Extended support for Eid al-Adha from 1950 to 2000
Summary: Added dates for Eid al-Adha from Gregorian calendar years 1950 to 2000.

Reviewed By: patapizza

Differential Revision: D14492291

fbshipit-source-id: 7e5436ae2e5ded798753c29a0e94410a0d848dad
2019-03-25 11:33:17 -07:00
Tom Milligan
81c32e465a AmountOfMoney: match three letter currency codes beginning with C (#327)
Summary:
Closes #326

All three letter currency codes beginning with the letter `C` are missed by the `currencies` regex. The regex will match `c` (meaning `cents`) and return, so `CAD`, `CHF` and `CNY` will never be matched.

This PR adds tests for all three failing currencies, and corrects the regex.
Pull Request resolved: https://github.com/facebook/duckling/pull/327

Differential Revision: D14540169

Pulled By: patapizza

fbshipit-source-id: a909cb452cd9e9f00aa64d1c6458dcbc415f85b9
2019-03-20 08:46:59 -07:00
Hasan Eray Dogan
63195642de Added Guru Ravidass Jayanti
Summary: Added Guru Ravidass Jayanti

Reviewed By: chinmay87

Differential Revision: D14285746

fbshipit-source-id: fee9ebab8ae93d5f5960f3c9cc21765f426d80fa
2019-03-04 09:01:28 -08:00
Hasan Eray Dogan
165208742c Added Rabindra Jayanti holiday
Reviewed By: chinmay87

Differential Revision: D14197864

fbshipit-source-id: 663b511e19fb99a779d310b4433dcb809c838c57
2019-02-27 14:15:50 -08:00
Julien Odent
5e5f5b85e1 AmountOfMoney/EN: aborb a prefix
Summary: Fixes https://github.com/facebook/duckling/issues/340.

Reviewed By: haoxuany, girifb

Differential Revision: D14195058

fbshipit-source-id: a9341c245701b51202769bfe90d5a9284d0702a8
2019-02-25 11:16:31 -08:00
ilakli
25ff06c165 KA - Improvements in Time, Numeral, Duration (#299)
Summary:
- Improved understanding of past periods and dates which include days, months and years.
- Added support for quarters.
- Fixed unnecessary two or more results on some queries.
Pull Request resolved: https://github.com/facebook/duckling/pull/299

Differential Revision: D13878236

Pulled By: patapizza

fbshipit-source-id: 5ae4ac96dd5d75f54ed1567017a81e5a9c8bcc83
2019-02-22 18:16:32 -08:00
Karl Ostmo
a6b60c8921 support composite distances
Summary:
Add general support for composite distances and remove ad-hoc feet/inch-specific rules.
Test cases are added to the corpus.

This implementation resolves the ambiguous "m" unit to either Metric or Imperial units
based on context.

Reviewed By: patapizza

Differential Revision: D13911040

fbshipit-source-id: e75fd237158fc1c2f02709dfe4dd2f1907958b4c
2019-02-15 10:46:19 -08:00
Luciano van der Veekens
6d8a320a40 Time/NL Small bug fix (#314)
Summary:
In the NL time module there's this bug where the following input

_"het is voor 5 personen"_ (english: _"it's for 5 people"_)

extracts a _time_ entity from it, instead of the expected _number_ entity.

This PR aims to fix that problem.
Pull Request resolved: https://github.com/facebook/duckling/pull/314

Reviewed By: patapizza

Differential Revision: D13742641

Pulled By: chinmay87

fbshipit-source-id: 96abb3fef4b6e5b66d0fa179751e2636a7bb4605
2019-02-14 12:16:27 -08:00
Jens Persson
d85c7ee926 Add 'the day before yesterday' rule for German, and a test for it. Al… (#324)
Summary:
Add 'the day before yesterday' rule for German, and a test for it. Also another test
Pull Request resolved: https://github.com/facebook/duckling/pull/324

Reviewed By: patapizza

Differential Revision: D13931961

Pulled By: haoxuany

fbshipit-source-id: 11d9ebd879be3e4d28a762d5638ee300a4132445
2019-02-13 13:31:26 -08:00
Jens Persson
e176cd0195 fix veintodós spelling (#325)
Summary:
This seems to have existed earlier but have been removed. The correct spelling seems to be with the accent though.
Pull Request resolved: https://github.com/facebook/duckling/pull/325

Differential Revision: D14059697

Pulled By: patapizza

fbshipit-source-id: 7c2aafc555a31bff8962032613b8a1da0edc8dc9
2019-02-12 17:31:21 -08:00
akki2825
a2494caf61 add Kannada support (for Numeral)
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/322

Reviewed By: patapizza

Differential Revision: D13888983

Pulled By: haoxuany

fbshipit-source-id: b7a3b5c72dae0ccc637cf6faa14670ebf868bb50
2019-02-08 11:31:39 -08:00
Micha Molko
301f74ea2e AmountOfMoney/HE Extend support
Summary: Improve support for amount of money in Hebrew

Reviewed By: patapizza

Differential Revision: D13685915

fbshipit-source-id: f9796f52b4d011bdc5e1ef903d5e3dc789bfcd04
2019-02-06 02:32:24 -08:00
Nate Mueller
d31bf25bf4 Extend support for Mawlid from 1950 to 1998
Summary:
Dates based on the Umm al-Qura Calendar of Saudi Arabia.
http://www.staff.science.uu.nl/~gent0113/islam/ummalqura.htm
http://www.staff.science.uu.nl/~gent0113/islam/ummalqura_principal.htm

Reviewed By: chinmay87

Differential Revision: D13862563

fbshipit-source-id: 6085d4ede1553e7757e8d3cae67da4d0723400cd
2019-02-05 13:01:20 -08:00
VPanjeta
c30607851f HI Duration correction and synonyms addition (#319)
Summary:
Pakhwada (पखवाड़ा) is 15 days not a fortnight, corrected that logic and added new synonyms and rules for other time grains.
Pull Request resolved: https://github.com/facebook/duckling/pull/319

Reviewed By: chinmay87

Differential Revision: D13785950

Pulled By: girifb

fbshipit-source-id: 2e38ac2f1486ca8891ca561c0cb87141f5bfc1cd
2019-01-28 16:46:38 -08:00
Martin Ring
fc7f2c77dd DE: Distance + Volume
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/311

Reviewed By: patapizza

Differential Revision: D13683766

Pulled By: chinmay87

fbshipit-source-id: a18c5ab656d26eb2b83d9340f307baae89da56f6
2019-01-28 11:18:39 -08:00
Michele Riva
33b9d20a7a Added IT Rules and Corpus for Distance
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/307

Reviewed By: girifb

Differential Revision: D13606124

Pulled By: patapizza

fbshipit-source-id: 5c8718d4d7dea818d8d70117c2b0d799796ab33c
2019-01-23 10:31:00 -08:00
Hamza Kwisaba
392e584d1b swahili numerical support
Summary: Adding support for swahili numerals

Reviewed By: patapizza

Differential Revision: D13637092

fbshipit-source-id: 6fe0facfa74caae6fd00e0e84b09571aca616f21
2019-01-18 01:16:13 -08:00
Enzo Lebrun
a707be9eae Value before month in zh can be an integers or a chinese char (#301)
Summary:
May 2019 is more often written like' 2019年5月' than ' 2019年五月' so the corresponding integer are added in the regex's rule ruleMonths.
Pull Request resolved: https://github.com/facebook/duckling/pull/301

Reviewed By: haoxuany

Differential Revision: D13606127

Pulled By: patapizza

fbshipit-source-id: 7dd2536e36711b4be42a93419b08dbd66cf31523
2019-01-14 09:45:56 -08:00
Yarik Markov
7d6af43feb Remove the list of exposed exports from Time.En.Us.Rules
Summary: This will allow other modules to import the defined Time rules without redefining it.

Reviewed By: patapizza

Differential Revision: D13613596

fbshipit-source-id: d4232ef3860680de8448f0ad6d586519ba1f2215
2019-01-10 14:15:59 -08:00
Alon Elishkov Harel
2b2af2eb95 Time/NL: Added suport for king's day
Summary: Implemented a rule for king's day (Koningsdag)

Reviewed By: haoxuany

Differential Revision: D13545471

fbshipit-source-id: f43116b14fd8649896941bed23c528d0a39a5881
2019-01-08 23:45:56 -08:00
Eelco den Heijer
f3088ae252 Added Quantity for NL, small fix for Volume NL (#302)
Summary:
* Added Quantity for NL (kg, mg, g, cup)
* Small fix for Volume (removed Gallon, fixed 'milliliter' typo)
Pull Request resolved: https://github.com/facebook/duckling/pull/302

Reviewed By: chinmay87

Differential Revision: D13554637

Pulled By: patapizza

fbshipit-source-id: 445fcb062c8cc2643b8e7810722759c168b5242f
2019-01-02 14:01:54 -08:00
Wojtek Przechodzeń
e662269626 Time/PL add today evening corpus example (#294)
Summary:
I'm using Duckling on a daily basis for Polish but there is a problem with some time synonyms. I've tried to add some ([#293](https://github.com/facebook/duckling/pull/293)) but unfortunately I couldn't add 'wieczorem' word wich is polish equivalent to `evening`.
Can you give me some tip how I can implement it or just implement that missing synonym?

Thanks for that great tool!
Pull Request resolved: https://github.com/facebook/duckling/pull/294

Reviewed By: chinmay87

Differential Revision: D13554490

Pulled By: patapizza

fbshipit-source-id: 013e3eccc96b44fd3f659c029b7a0542783b0b2c
2019-01-02 14:01:54 -08:00
João Gonçalves
23737375d9 Time/PT: Last and quarter expressions + ordinals 13..99 (#291)
Summary:
Add support for ordinals from 13..99
Add support for quarter expressions like:

- próximo trimestre

- quarto trimestre de 2018

- último trimestre de 2015

- de primeiro trimestre de 2017 até terceiro trimestre de 2017

- entre terceiro mês de 2017 e nono mês de 2017

Add new vocabulary for last expressions like:

- últimos 2 meses

- 2 meses anteriores
Pull Request resolved: https://github.com/facebook/duckling/pull/291

Reviewed By: chinmay87

Differential Revision: D13553884

Pulled By: patapizza

fbshipit-source-id: 330af62bf457ffaab65636b29fb7bb51ba8a3ae5
2019-01-02 14:01:53 -08:00
Michele Riva
9a45a0cf7b Added IT Rules and Corpus for AmountOfMoney (#284)
Summary:
Hi,
I've added Rules and Corpus for Italian language on "AmountOfMoney".
Running `stack test`, I always get `empty result on "10 000 dollari"`.
I've checked my code more than once but I can't figure out what is not working. I made a PR in order to make it easier for you to understand what's going wrong :)

I really hope that my contribution can help.
Regards!
Pull Request resolved: https://github.com/facebook/duckling/pull/284

Reviewed By: chinmay87

Differential Revision: D13551890

Pulled By: patapizza

fbshipit-source-id: c1b448e44c2c6720ad93f61c6396f4d75231131e
2019-01-02 14:01:53 -08:00
Martin Heuschober
c0e4c8c926 fix issue #249 (wrong parsing of yyyy-mm-dd dates in DE) (#282)
Summary:
- took regex from EN (which is working)
- added test cases from 2016-01-01 to 2018-12-31

- change non-breaking space to regular space
Pull Request resolved: https://github.com/facebook/duckling/pull/282

Reviewed By: chinmay87

Differential Revision: D13551882

Pulled By: patapizza

fbshipit-source-id: e254be1beaed21226741c55f243ac21eaa06d636
2019-01-02 14:01:53 -08:00
Yarik Markov
0093590968 Remove the list of exposed exports from Time.En.Rules
Summary: This will allow other modules to import the defined Time rules without redefining it.

Reviewed By: patapizza

Differential Revision: D13320380

fbshipit-source-id: e6fc7214e282de279974e14ad01e9c5b9c8c0986
2018-12-04 14:01:04 -08:00
Santosh Kumar Ghosh
d2705eccfb Add Dayananda Saraswati Jayanti holiday
Summary: Added suppport for Dayananda Saraswati Jayanti 2000-2030

Reviewed By: patapizza

Differential Revision: D13267610

fbshipit-source-id: 58e1415235ecd1814fb719ff5a547a75f67a3b6e
2018-12-01 10:16:07 -08:00
uugan
69ffb0f39d Mongolian (#277)
Summary:
MN Setup+Numeral
Pull Request resolved: https://github.com/facebook/duckling/pull/277

Reviewed By: chinmay87

Differential Revision: D13028169

Pulled By: patapizza

fbshipit-source-id: 7d587300918b3ed6211b6ce4147350147b4dc89e
2018-11-26 15:31:08 -08:00
Giovanni Cappellotto
97cbde5454 Handle credit card dashes
Summary: This update adds support for credit card numbers that contain dashes, at least for the issuer specific regular expressions.

Reviewed By: patapizza

Differential Revision: D13105871

fbshipit-source-id: 36130d2c7c53efc837ff61d7037761987660901c
2018-11-19 06:15:53 -08:00
Vitaly Shaydurov
b40e2147a9 Time/UK: added dimensions
Summary:
- added Time dimension for UK language
- added tests for Time dimension for UK language

Reviewed By: patapizza

Differential Revision: D13024050

fbshipit-source-id: e5be933fff8041c42d8fd26ddaf919584912a012
2018-11-19 04:31:03 -08:00
Vitaly Shaydurov
3c5790f605 TimeGrain,Duration/UK: added dimensions
Summary:
- added TimeGrain dimension for UK language
- added Duration dimension for UK language

Reviewed By: patapizza

Differential Revision: D12871569

fbshipit-source-id: 356c2031aa9582620be11ea634c854c0d96ebbeb
2018-11-19 04:31:03 -08:00
Jeremy L. Morris
4bee26851e Update rules to allow more variation for MonthDDDD intervals. (#271)
Summary:
Fixes [#218](https://github.com/facebook/duckling/issues/218)

**Note:** This is still a work in progress. But, I'm new to both Haskell and this repo and I seem to be stuck. Would appreciate feedback on what I've done so far. Thank you!
Pull Request resolved: https://github.com/facebook/duckling/pull/271

Reviewed By: chinmay87

Differential Revision: D13087476

Pulled By: patapizza

fbshipit-source-id: 2dee0d023794265bd791ae0bbc0e2e2b89ea1959
2018-11-17 00:45:55 -08:00
Giovanni Cappellotto
39a6a4c6ec Add missing pattern match
Summary:
`fromName` was missing a pattern to match the new `"credit-card-number"` dimension string representation.

Adding also `CreditCardNumber.Tests.tests` to the `Dimensions Tests` test group.

Reviewed By: chinmay87

Differential Revision: D13072125

fbshipit-source-id: 792727ef038d26ae12ceea909fa726692d56db6d
2018-11-15 07:16:57 -08:00
Hyo Jin Kim
5de0b1fbb6 Support intervals
Summary: Support intervals for Duckling AmountOfMoney KO

Reviewed By: haoxuany

Differential Revision: D13020692

fbshipit-source-id: 79e1d99acf317467c1b06b156f47a497c91062da
2018-11-14 14:30:51 -08:00
Giovanni Cappellotto
1052914cb4 Credit cards
Summary:
Add the ability to parse credit cards and identify the issuer in Duckling.

Credit card numbers are a sequence of 8 to 19 digits, with a few specific digits at the start that identify the card issuer. They also satisfy Luhn checksum (https://en.wikipedia.org/wiki/Luhn_algorithm).

Reviewed By: chinmay87

Differential Revision: D13014623

fbshipit-source-id: 96586e074777ae90a4a39c515648c31a8111f0c2
2018-11-14 11:16:03 -08:00
riccardo.macioce
4c4e0c59b7 Time/IT: wrong results for the ruleDurationAgo rule for the Italian language (#279)
Summary:
Fixes #278
Pull Request resolved: https://github.com/facebook/duckling/pull/279

Differential Revision: D13044464

Pulled By: patapizza

fbshipit-source-id: f4534fda4def6fa590786320fbcbe88d475d0e9e
2018-11-13 14:01:26 -08:00
Julien Odent
d0516324ec Time/VI: don't parse ngày
Summary:
Fixes https://github.com/facebook/duckling/issues/273.
`ngày` can mean day or date in Vietnamese.
Fixed bad Christmas regex.

Reviewed By: chinmay87

Differential Revision: D12955229

fbshipit-source-id: 071b623e581d36f7db4bf356219647147a087a25
2018-11-07 09:45:53 -08:00
Kumar Shridhar
975489fed6 Added German+Icelandic spelled out Email
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/272

Reviewed By: chinmay87

Differential Revision: D12955290

Pulled By: patapizza

fbshipit-source-id: 671ee50c92c031762aa147dc6bd98f374693ba6b
2018-11-07 09:15:53 -08:00
PhalPheaktra Chhaya
3374f4ea50 Add Volume/KM and Distance/KM (#256)
Summary:
Hello.
I have updated Quantity/KM and added 3 more dimensions (Volume/KM, Time/KM, and Distance/KM) for KM.
Please take a look at it.
Pull Request resolved: https://github.com/facebook/duckling/pull/256

Reviewed By: patapizza

Differential Revision: D9758093

Pulled By: xhavokx

fbshipit-source-id: 5a800fd443789795b8e63c88dade3785cfca706c
2018-10-31 16:45:58 -07:00
Krogsager
d90cf205db Recognize time from abbreviation 'kl' (#267)
Summary:
The common phrase "i dag kl 15" (today at 15:00) will now be recognized with the correct time.
So far duckling has expected the 'kl' to be written as 'kl.'.

Before this pull
`$ curl -XPOST http://0.0.0.0:8000/parse --data 'locale=da_DK&text=i dag kl 15'`
Time is 00:00:00:
```
[{"body":"i dag","start":0,"value":{"values":[{"value":"2018-10-18T00:00:00.000-07:00","grain":"day","type":"value"}],
	**"value":"2018-10-18T00:00:00.000-07:00",**
"grain":"day","type":"value"},"end":5,"dim":"time","latent":false},{"body":"15","start":9,"value":{"value":15,"type":"value"},"end":11,"dim":"number","latent":false}]
```

`$ curl -XPOST http://0.0.0.0:8000/parse --data 'locale=da_DK&text=i dag kl. 15'`
Time is 15:00:00:
```
[{"body":"i dag kl. 15","start":0,"value":{"values":[{"value":"2018-10-18T15:00:00.000-07:00","grain":"hour","type":"value"}],
	"value":"2018-10-18T15:00:00.000-07:00",
"grain":"hour","type":"value"},"end":12,"dim":"time","latent":false}]
```

After this pull:
`$ curl -XPOST http://0.0.0.0:8000/parse --data 'locale=da_DK&text=i dag kl 15'`
Time is 15:00:00
```
[{"body":"i dag kl 15","start":0,"value":{"values":[{"value":"2018-10-18T15:00:00.000-07:00","grain":"hour","type":"value"}],
	"value":"2018-10-18T15:00:00.000-07:00",
"grain":"hour","type":"value"},"end":11,"dim":"time","latent":false}]
```
Pull Request resolved: https://github.com/facebook/duckling/pull/267

Reviewed By: chinmay87

Differential Revision: D10489441

Pulled By: patapizza

fbshipit-source-id: ae574a7057be3adbb29ee1cb0659d4e5afa896e8
2018-10-22 13:46:56 -07:00
Chinmay Deshmukh
9077f9e147 AmountOfMoney,Numeral/EN: Add support for lakh and crore
Summary:
Add support for lakh (1e5) and crore (1e7) in Numeral.

This will help resolve "9-7 lakh rupees" to (Rs. 9, Rs. 700000). Next step is to resolve it to (Rs. 900000, Rs. 700000)

Reviewed By: patapizza

Differential Revision: D10417678

fbshipit-source-id: 670115f22015698ff8c7a9d96afd624efd4c864e
2018-10-17 10:30:50 -07:00
Colin Clemmons
ea1ed47336 Time/EN: Adds Support for Parsi New Year
Summary: Adds support for Parsi New Year

Reviewed By: patapizza

Differential Revision: D10208163

fbshipit-source-id: 6c125ab4310cb81c239d9a2ee3c765a4a1841a5c
2018-10-16 13:16:52 -07:00
Makan Diarra
4943798c75 Extend support for Ramadan and Eid al-Fitr from 2029 to 2050
Summary: Extended Ramadan and Eid al-Fitr from 2029 to 2050 in computed.hs

Reviewed By: chinmay87

Differential Revision: D10304284

fbshipit-source-id: 5240046977632411bf067769499e6afbcda0af7b
2018-10-12 10:01:09 -07:00
Egxona Ferati
f2fd05f9c2 Add Guru Gobind Singh Jayanti holiday
Summary: Adding support for Guru Gobind Singh Jayanti holiday from 2000 to 2030.

Reviewed By: chinmay87

Differential Revision: D10148514

fbshipit-source-id: 79e35bcca37f7a87fc6b46fda41edf0a57b424a6
2018-10-03 15:30:52 -07:00
Akhil Ravidas
e349942541 Support malayalam ordinals
Summary: Add support for malayalam ordinals.

Reviewed By: patapizza

Differential Revision: D10097075

fbshipit-source-id: 90be5f05d1f9cf4cc6558a4583c8c72518fe0ab0
2018-09-28 10:30:54 -07:00
Akhil Ravidas
c46dbb0d92 Support malayalam numerals
Summary: Add support for malayalam numerals in duckling.

Reviewed By: patapizza

Differential Revision: D10075358

fbshipit-source-id: ce7fee2a71d862391980481b018c513981249f3d
2018-09-28 10:30:54 -07:00
Konstantin Kloster
ee24a4196d small bugfix in german numeral dimension (#257)
Summary:
There is a small bug in the German numeral dimension. The number "fünfzehn"(15) cannot be recognized correctly due to a typo. This pull request should fix it:)
Pull Request resolved: https://github.com/facebook/duckling/pull/257

Reviewed By: girifb

Differential Revision: D9810012

Pulled By: patapizza

fbshipit-source-id: e2408a2dc237590b24840260e2a97e9b5c8231f3
2018-09-13 14:30:44 -07:00
Albert Morgese
2ace5d474b AmountOfMoney/EN: Add basic latent support
Summary: Implemented basic latent value support for AmountOfMoney (along with a corpus).  Currently only supports raw numbers.

Reviewed By: chinmay87

Differential Revision: D9777183

fbshipit-source-id: 16a454d451b74ddc526e0db1ddc9b4959b677ca6
2018-09-12 15:30:58 -07:00
Michelle Prawiro
5d8fb7e7fe AmountOfMoney/ID: Support intervals
Summary: Adding interval support for `AmountOfMoney` in Indonesian.

Reviewed By: adanielescu

Differential Revision: D9416842

fbshipit-source-id: 13f1ed74e6ef1e5c12a2f5d785e44069eefe555b
2018-09-07 10:45:45 -07:00
jfulse
d5639056f3 Norwegian currencies (#244)
Summary:
Some small improvements to Norwegian currencies:

- Parse more currencies. Some were not yet defined in `AmountOfMoney.Types` and thus were added
- Parse `norske kroner` as well as `kroner`
- Parse cents of more currencies
- Remove duplicate rule `ruleIntersectXCentsWithAnd` (duplicated in `ruleIntersectAndXCents`)
Pull Request resolved: https://github.com/facebook/duckling/pull/244

Reviewed By: patapizza

Differential Revision: D9505839

Pulled By: haoxuany

fbshipit-source-id: 69c777a24e5138c04f3ada56c5d8541c9837bb8c
2018-09-06 21:00:57 -07:00
pheaktra21
cd33b26acf Add support for Ordinal, Quantity, & Temperature dimension for KM. (#251)
Summary:
Hello.
I added 3 new dimensions: Ordinal, Quantity, & Temperature. And I also added more data to Numeral dimension.
Thank you!
Pull Request resolved: https://github.com/facebook/duckling/pull/251

Reviewed By: beauby

Differential Revision: D9656646

Pulled By: patapizza

fbshipit-source-id: f17797be811d58b0b5bcd02b83c0a699650c9f6e
2018-09-06 07:01:15 -07:00
kumar-shridhar
4a77765134 Icelandic support
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/247

Reviewed By: beauby

Differential Revision: D9656660

Pulled By: patapizza

fbshipit-source-id: 993baa9a0e442fc6f6f813a3af717b700c4d89e6
2018-09-06 06:46:02 -07:00
jfulse
b9d39f723e Norwegian numeral improvements (#243)
Summary:
Some small improvements to Norwegian numerals:

- Parse powers of ten with spaces as well as dots: `10 000 == 10.000`
- Some more textual powers of ten: `milliard`, `billion`, ...
- Textual numbers from 21 to 99: `tjueen`, `tjueto`, ...
   (they were already parsed with spaces, as in `tjue en`, but not without)
Pull Request resolved: https://github.com/facebook/duckling/pull/243

Reviewed By: patapizza

Differential Revision: D9505835

Pulled By: haoxuany

fbshipit-source-id: e42a290b3dd2d5e6a82f00514617b4c3c4dd3416
2018-08-31 17:46:08 -07:00
David Magaltadze
ab3b789896 KA AmountOfMoney (#245)
Summary:
Added support for AmountOfMoney for KA
Pull Request resolved: https://github.com/facebook/duckling/pull/245

Differential Revision: D9510854

Pulled By: patapizza

fbshipit-source-id: 966c0f69193dd37ed458339fbc381ca640a3a179
2018-08-28 17:00:50 -07:00
Julien Odent
fd3948169f Time/EN: Intersect "9 tomorrow morning"
Summary:
It didn't intersect before, as `9` is latent and we were guarding against it.
Instead, guard against years (to prevent nonsensical things like `one ninety nine a.m.`) and against 2 latent tokens.

Reviewed By: chinmay87

Differential Revision: D9507044

fbshipit-source-id: 4c97eba8fc1e47bf7b9a78e04dd6b5531898fda6
2018-08-28 16:45:45 -07:00
Nathan Hu
eb0b84a5aa Time/EN: add <datetime> - <datetime> (interval) timezone rule
Summary: Introducing `hasTimezone` flag to prevent double timezone parsing.

Reviewed By: patapizza

Differential Revision: D9317892

fbshipit-source-id: 0e9246abeb65c5fa61725f9b78a1421d85263bdc
2018-08-24 11:45:45 -07:00
Nihar Shah
6a05e40a37 Volume: Intervals Support
Summary:
This diff implements volume intervals in Duckling. It follows the AmountofMoney and Quantity modules in doing so.

I had to make one crucial choice here -- defining the core Volume data type -- and whether the attribute "Unit" was optional (i.e. "Maybe") or not. Like in Quantity and unlike in AmountOfMoney, I made it optional, so that latent volumes can be supported down the line in the codebase.

I also wrote the codebase to be more modular, such that future developers only need to add regular expressions rather than functions for any language. For instance, developers can simply define a fraction (e.g. "eighth") at the start of the file, and new rules will be generated automatically; rather than requiring the developer to create an entirely new rule, as previously. The only (partial) exceptions were in the Arabic and Russian Rules files, where the language structure is more difficult and so I cannot fully implement this. Developers for those two languages may need to write new rules, as before.

Reviewed By: patapizza

Differential Revision: D9043117

fbshipit-source-id: f08de4f167596b5b32d12a79268b8ab92c099b22
2018-08-24 11:31:08 -07:00
Kay Hu
fc801ad600 Time/EN: Holiday name alias fixes
Summary:
Adding holiday aliases:
Veteran Day
Mardi Gras
St. Paddy's Day

Reviewed By: chinmay87

Differential Revision: D9483120

fbshipit-source-id: 50bf8338bbaf5c4a59210331dac00508141be1ee
2018-08-23 17:45:42 -07:00
David Magaltadze
010146d2f4 GE + Duration, Ordinal, TimeGrain, Time (#221)
Summary:
Added initial support for ka_GE for

- Duration
- Ordinal
- TimeGrain
- Time
Pull Request resolved: https://github.com/facebook/duckling/pull/221

Differential Revision: D8840919

Pulled By: haoxuany

fbshipit-source-id: 80f94fbaf25786b0f58cd6598c29cd3663858809
2018-08-22 18:30:48 -07:00
Chinmay Deshmukh
dd60c1e013 Time/EN: in <duration> at <time-of-day>
Summary: Make rule for in <duration> at <time-of-day>

Reviewed By: patapizza

Differential Revision: D9375588

fbshipit-source-id: e0ebea53005b09e0ef8b70bf4f68d73b0f75df08
2018-08-20 00:30:52 -07:00
Gerben Janssen van Doorn
f70f991b38 Added support Lao numerals
Summary: Duckling didn't support Lao numerals, this diff adds it.

Reviewed By: patapizza

Differential Revision: D9323242

fbshipit-source-id: 5dad0d4dfb4843281a327947690e664c91ab8f1a
2018-08-17 10:31:17 -07:00
Daniel Sainati
3910c68262 AmountOfMoney/EN: added support for subunits of dollars
Summary: Added support for recognizing nickels, dimes and quarters, as well as numbers of coins.

Reviewed By: patapizza

Differential Revision: D9317706

fbshipit-source-id: 3fb3d63546c9cfe13c094703ddb583c6ac46585b
2018-08-16 15:45:43 -07:00
Christian Johns
84a4f30f5a Flip month-match expressions in VI ng(à)y regex (#228)
Summary:
Fix issues where date time matching on double-digit months fails for VI.

Reverse the order of month digit matching in two VI rules. Reversing will attempt to capture a two digit month beginning with 1, then fall back to single digit months optionally preceeded with a 0.

The current regex greedily captures months starting with 1, but only of a single digit. (10, 11, and 12) are left out of this calculation, and thus regexes for capturing ng(à)y fail. This leads us into bad capturing on unexpected rules. When matched properly, the idea rules for matching date times are used.

Resolves #225.

I've added to the VI Time Corpus the case in question in #225 and verified its failure at `master` and success on this branch.
Pull Request resolved: https://github.com/facebook/duckling/pull/228

Reviewed By: chinmay87

Differential Revision: D9303795

Pulled By: patapizza

fbshipit-source-id: aa114f886ab0fdcd95f87730d36e5a686afe2f9c
2018-08-16 13:31:07 -07:00
Julien Odent
546fa113a6 Time: Add "today" helper + reuse "tt" helper
Summary: Instead of `cycleNth TG.Day 0` and `Just . Token Time`.

Reviewed By: chinmay87

Differential Revision: D9344258

fbshipit-source-id: 1731c19f0d83640c5716757c70fcefea4655172f
2018-08-15 12:45:48 -07:00
Julien Odent
a3e87589a1 Time: Reuse "now" helper
Summary: Instead of `cycleNth TG.Second 0`.

Reviewed By: chinmay87

Differential Revision: D9341237

fbshipit-source-id: 153dba6edb0b341afad1ee6f7fa04361415be211
2018-08-15 12:45:48 -07:00
Julien Odent
7fba0f0f28 Time: Fix some intervals for time-of-days
Summary:
"from 1:30 to 2pm" resolved to [1:30, 3pm[ with grain `Minute`.
It now resolves to [1:30, 2:01pm[ (same grain).

Reviewed By: chinmay87

Differential Revision: D9338769

fbshipit-source-id: b76c8cc8ac4b6227825c3d21431261f9fb552509
2018-08-15 12:45:48 -07:00
Julien Odent
53d124ffe8 Time/EN: make upper interval consistent for durations
Summary:
Upper interval bounds should be exclusive. For consistency, fixing this in a few rules related to durations.

https://github.com/facebook/duckling/issues/230
https://github.com/wit-ai/node-wit/issues/178

Reviewed By: chinmay87

Differential Revision: D9332993

fbshipit-source-id: ceddb193c019602c714fceb155baf4c56b77572d
2018-08-15 12:45:48 -07:00
Chinmay Deshmukh
179cec14fb Time/EN Support "Martin Luther Kings Day"
Summary: Expand regex to support "Martin Luther Kings Day"

Reviewed By: patapizza

Differential Revision: D9329681

fbshipit-source-id: 78d184f47daef582b21f5c9511b1972c762c27bc
2018-08-15 12:31:30 -07:00
Julien Odent
af480b80f0 Time/EN: Add Purim and Shushan Purim (Jewish holidays)
Summary:
Following other Jewish holidays convention, starting on sunset of
previous day.

Reviewed By: chinmay87

Differential Revision: D9315490

fbshipit-source-id: bdfef5ba0c7bca6601bb7557d30840b47734b819
2018-08-15 12:01:07 -07:00
Julien Odent
e818b4ce9e Time/EN: Restrict "on" absorption to days
Summary:
We were absorbing "on" followed by any Time token.
Restricting to days of weeks and days of months only.

https://github.com/facebook/duckling/issues/217

Reviewed By: chinmay87

Differential Revision: D9313306

fbshipit-source-id: a0c33658855af8f69631d4d1879cc27062c26a69
2018-08-15 01:16:12 -07:00
Sophia Zheng
3c6d3b38db Add daylight saving start and end times.
Summary:
Added "holidays" for daylight savings start and end dates.
In U.S., Daylight Saving start day is the second Sunday in March,  end day is the first Sunday in November.

Reviewed By: chinmay87

Differential Revision: D9277160

fbshipit-source-id: 71038d42d14c4a241cfbaf9ac4499c44139d2ba6
2018-08-14 11:45:55 -07:00
Julien Odent
b45e1c09f9 Time/EN: Allow for "Chinese New Years"
Summary: as titled

Reviewed By: chinmay87

Differential Revision: D9295927

fbshipit-source-id: d90f5183c0b4d7b483f5cf1bf8957f514954944c
2018-08-14 01:31:13 -07:00
Daniel Sainati
3de16f3fae added support for Vaisakhi 2000-2030
Summary: Added support for Vaisakhi holiday

Reviewed By: chinmay87

Differential Revision: D9275656

fbshipit-source-id: 21744a93c191837e990ddd381ea46eb7f85b86cf
2018-08-10 15:15:51 -07:00
PhalPheaktra Chhaya
b541354c31 Add Numeral dimension for new language KM. (#234)
Summary:
Hello,
I am new to Haskell, but I would like to add Khmer language (KM) to Duckling.
I have tried to extended Duckling by adding Numeral dimension for new language KM.
Please have a look at it and see what we can improve.

Thanks!
Pull Request resolved: https://github.com/facebook/duckling/pull/234

Reviewed By: blandinw

Differential Revision: D9032639

Pulled By: chinmay87

fbshipit-source-id: 7db19edf732fe6500629cc89e18e0655d7bbc48b
2018-08-03 14:45:55 -07:00
Nathan Hu
945154a174 add (timezone) rule
Summary:
add rule to match
<time> + (timezone)
It needs to be a seperate rule from the existing ruleTimezone because we need to make sure a match on both "(" and ")" before and after the timezone string.

if I do regex "(\b|\()XXX(\b|\))" it can't guarantee the match on both.

Reviewed By: xhavokx

Differential Revision: D9143475

fbshipit-source-id: bda686763c3cf69b9e2096ce05878ba592076814
2018-08-03 12:01:03 -07:00
Ben Powell
984769244f Time/EN: All week, Rest of the week
Summary:
Task also says to add "this week", but this is already covered
by the "this <time>" rule.

Reviewed By: chinmay87

Differential Revision: D9018849

fbshipit-source-id: 210daf87ad4221cf734f260932f7c95c8a3e417a
2018-08-01 09:45:42 -07:00
Chinmay Deshmukh
9a4bb48c63 Time: Fix BST and IST offsets
Summary:
Fix the offsets for BST and IST timezones.
BST is +1 (60) and IST is +5:30 (330)

Reviewed By: girifb

Differential Revision: D8981055

fbshipit-source-id: 43ad669c22638031479a7608a8e651b178361c0d
2018-07-25 13:15:50 -07:00
jfulse
e1088c1856 Norwegian improvements (#232)
Summary:
Some small improvements to the Norwegian implementation:

- The written number 8 had a typo: "otte" -> "åtte"
- Add support for half an hour before as e.g. "halv to"
- Add support for alternative clock denotation "klokka"
- Add support for alternative tomorrow denotation "i morra"
Pull Request resolved: https://github.com/facebook/duckling/pull/232

Reviewed By: girifb

Differential Revision: D8986441

Pulled By: chinmay87

fbshipit-source-id: 286617d30415febe1f0eda4bc7475ca5c9610734
2018-07-25 13:15:50 -07:00
Nathan Hu
8e658b2e27 add rules to time
Summary:
this rule can parse time interval like this:
2015-03-28 17:00:00/2015-03-28 21:00:00

Need to check both timeData has the same Grain to avoid ambiguity like the following:

intersect (2015-03-28 17:00:00/2015-03-28 21:00:00)
-- <datetime>/<datetime> (interval) (2015-03-28 17:00:00/2015-03-28)
-- -- intersect (2015-03-28 17:00:00)
-- -- -- yyyy-mm-dd (2015-03-28)
-- -- -- -- regex (2015-03-28)
-- -- -- hh:mm:ss (17:00:00)
-- -- -- -- regex (17:00:00)
-- -- regex (/)
-- -- yyyy-mm-dd (2015-03-28)
-- -- -- regex (2015-03-28)
-- hh:mm:ss (21:00:00)
-- -- regex (21:00:00)

Reviewed By: xhavokx

Differential Revision: D8951108

fbshipit-source-id: 5d5084c8c7e8d9420b9899ccbb8d757a0322be00
2018-07-23 12:31:49 -07:00
Yujiao Zhou
20c8a3750d parse yyyy-mm
Summary: as titled.

Reviewed By: haoxuany

Differential Revision: D8895617

fbshipit-source-id: 2c0ccdcbb39945d836bd64f5ff9d790c8f636b79
2018-07-20 10:30:46 -07:00
Nathan Hu
98463ae14d update typeclass to make cast work.
Summary: update typeclass to make cast work.

Reviewed By: watashi

Differential Revision: D8918769

fbshipit-source-id: af44737d439d8748926114ca7ff606fcda848946
2018-07-19 12:01:42 -07:00
Nivin Lawrence
e279c5642e added tamil ordinal
Summary: support tamil ordinal

Reviewed By: girifb

Differential Revision: D8713963

fbshipit-source-id: c0760f0cf13d983473d29e18425ba926584c3072
2018-07-16 17:15:53 -07:00
Julien Odent
9c367ab6cd Don't accept dashes (-) as token separators
Summary:
This is causing some issues, e.g. `20-30` resolving to 8:30pm (latent).
Updating `Numeral` rules to account for that (`EN`, `FR`, `NL` following tests).

Differential Revision: D8854891

fbshipit-source-id: ba17099b014d9cf2f48a7d85147cc890b02578f5
2018-07-16 06:00:40 -07:00
Arunavha Chanda
d5555d0149 Numeral/BN: Adding Bengali numeral support to Duckling
Summary: Added support for Bengali numerals

Reviewed By: patapizza

Differential Revision: D8730468

fbshipit-source-id: dc36017e24d796f35abc477a0b8b317218c64a6a
2018-07-09 12:30:30 -07:00
Cuong Dinh Tri Nguyen
4e11613d39 Supported AmountOfMoney intervals and improved Numeral
Summary:
Support amount of money intervals for VI

Modify ruleNg, ruleDollar, and ruleVND to better capture the usage of VI

In Numeral, add "ngàn" - a common synonym of "nghìn", and "chục" - colloquially used to count tens. Remove "?" in regex of other words as it does not make sense.

Reviewed By: haoxuany

Differential Revision: D8734066

fbshipit-source-id: 15f879ab796025882c85f0ce9f1677c501b364a0
2018-07-09 10:00:42 -07:00
Nathan Hu
9d757ea449 new rule to handle 13/APR/2018
Summary:
Adding new rule to support:
"31/Oct/1974"
"31st Oct 1974"

Reviewed By: patapizza

Differential Revision: D8752684

fbshipit-source-id: 06b29ffde0d41a6133489a882dc3259570fe6a5c
2018-07-06 14:46:03 -07:00
Tiago Baptista
11e43c0775 Time/EN: Add support to YYYYQQ and YYQQ expressions (#219)
Summary:
Add support to expressions like:
- 2018Q4
- 18Q4
Closes https://github.com/facebook/duckling/pull/219

Reviewed By: haoxuany

Differential Revision: D8713864

Pulled By: patapizza

fbshipit-source-id: 491dfd408c6c2d6afdb1d70f738f87af0456bf40
2018-07-02 15:15:38 -07:00
Julien Odent
f5bd1efb4a Time/EN: fix Palm Sunday regex
Summary:
* Fixes https://github.com/facebook/duckling/issues/215.
* `regenLangClassifiers` helper

Reviewed By: chinmay87

Differential Revision: D8663109

fbshipit-source-id: 5cbbc05729caabadeb0a88190ce00312174a4fdb
2018-06-27 12:30:42 -07:00
Julien Odent
ead526a820 Time/FR: fix month intervals
Summary:
* Fixes https://github.com/facebook/duckling/issues/213
* Updated month interval rules to handle ordinals and spelled out numerals (e.g. "du premier au quinze juin")

Reviewed By: l5t

Differential Revision: D8615867

fbshipit-source-id: fac7c4aa14e175bc3f9cc7c672008a6bc6063055
2018-06-26 11:45:42 -07:00
Tero Laxström
4ed1ed83ed Basics for Finnish (#210)
Summary:
Adds Locale and Numeral for Finnish
Closes https://github.com/facebook/duckling/pull/210

Reviewed By: JonCoens

Differential Revision: D8430386

Pulled By: patapizza

fbshipit-source-id: a3c8b3b3419b7f43e2ef332cdb1fb8fc07da3bec
2018-06-19 10:45:27 -07:00
David Magaltadze
713e5db9d6 Added support of Numeral for ka_GE (#211)
Summary:
* `ka_GE` locale
* full support for Numeral
Closes https://github.com/facebook/duckling/pull/211

Reviewed By: chinmay87

Differential Revision: D8456241

Pulled By: patapizza

fbshipit-source-id: 35fb432191bd20a4965503efde94c5ea29d0c50d
2018-06-18 13:31:14 -07:00
Lucas Pasqualin
7d469a2f85 adds support for during month and regenerates classifiers (#208)
Summary:
Adds support for catching `during <month>`.

Wasn't sure whether or not to commit the classifiers, let me know if I got this right :)

Thanks!
Closes https://github.com/facebook/duckling/pull/208

Reviewed By: chinmay87

Differential Revision: D8427153

Pulled By: patapizza

fbshipit-source-id: 72c9567939cd0eeab62870e48d6e084cfe290bf1
2018-06-14 13:15:42 -07:00
Anshuman Chhabra
5ab49060e1 Added Temperature support for Hindi (HI) language (#206)
Summary:
This PR adds Temperature dimension support for Hindi (HI). Let me know if there are any changes to be made :)

Cheers!
Closes https://github.com/facebook/duckling/pull/206

Reviewed By: haoxuany

Differential Revision: D8381472

Pulled By: patapizza

fbshipit-source-id: a085ba73910a80a51385f01475d9ba75f72fd4c5
2018-06-13 17:00:35 -07:00
Julien Odent
c7bef34bc2 Duration/EN: Fix composite durations without delimiters
Summary: It would only work with commas/and-separated tokens.

Reviewed By: JonCoens

Differential Revision: D8381351

fbshipit-source-id: eafceeaf5d41bf60aaaf78c3bd6835a768e2b0b6
2018-06-12 10:45:42 -07:00
Julien Odent
9558b7a766 Time/EN: Fix 'ten thirty' latent
Summary:
* fix latent time of days like "ten thirty"
* don't parse time of days above 12 with meridiem like "13 am"

Reviewed By: haoxuany

Differential Revision: D8363720

fbshipit-source-id: 8236babdd5b8ab4163ad39704a295be048d1b03e
2018-06-11 14:00:26 -07:00
Julien Odent
e8286f762c Numeral/RO: Fix multipliers with values above 20
Summary: In Romanian, for numerals above 20, we say "20 de milioane", not "20 milioane".

Reviewed By: haoxuany

Differential Revision: D8334109

fbshipit-source-id: a7fc83440334ab9b1f0511f315029e28449f9771
2018-06-11 11:00:38 -07:00
Julien Odent
3d23372913 Volume/RO: Fix for values above 20
Summary:
In Romanian, for numerals above 20, we say "20 de litri", not "20 litri".
This would actually allow things like "4 de litri", though it's fine as it
doesn't alter meaning.

Differential Revision: D8332996

fbshipit-source-id: 709a97cec3c09513281be19e1a9b20895874b9c4
2018-06-08 09:45:28 -07:00
Julien Odent
f705206fb2 Temperature/RO: Fix for values above 20
Summary:
In Romanian, for numerals above 20, we say "20 de grade", not "20 grade".
Here we optimize for recall and allow "20 de grade de celsius", "20 de grade
celsius", "20 grade de celsius", "20 grade celsius".
This would actually allow things like "4 de grade", though it's fine as it
doesn't alter meaning.

Differential Revision: D8332923

fbshipit-source-id: e6ae0ecc902ac5db9be504b5ff6a14b1ec996413
2018-06-08 09:45:28 -07:00
Julien Odent
11316b34af Quantity/RO: Fix for values above 20
Summary:
In Romanian, for numerals above 20, we say "20 de livre", not "20 livre".
This would actually allow things like "4 de livre", though it's fine as it doesn't alter meaning.

Differential Revision: D8332867

fbshipit-source-id: 78ff193b027e547aa32a8f531d2f7ad895c6b668
2018-06-08 09:45:28 -07:00
Andreea Danielescu
bee838e1c5 AmountOfMoney/RO Support intervals
Summary: Added support for intervals (between X and Y), min, max and approximates for currency in RO.

Reviewed By: patapizza

Differential Revision: D8322948

fbshipit-source-id: 462cfd5575c87e757d2c35c8078f539af3e8150f
2018-06-08 09:00:31 -07:00
Julien Odent
bac1245f45 Duration/RO: Fix for values above 20
Summary: Same as previous commits.

Reviewed By: haoxuany

Differential Revision: D8325566

fbshipit-source-id: d4f1ae57cabdbdf8149f0673e6b7832496c2c88c
2018-06-07 16:45:43 -07:00
Julien Odent
567450beea Distance/RO: Fix for values above 20, refactoring
Summary:
* One rule to rule them all, to easily duplicate with "de" suffix.
* This would actually allow things like "4 de metri", though it's fine as it doesn't alter meaning.

Reviewed By: haoxuany

Differential Revision: D8325328

fbshipit-source-id: 3ec0f30431f3cb00152cc9509f6052b1ae29cd08
2018-06-07 16:45:43 -07:00
Julien Odent
483df26347 AmountOfMoney/RO: Fix for values above 20
Summary: In Romanian, we say "19 dolari", but for numerals above 20, it's "20 de dolari" (not "20 dolari").

Reviewed By: haoxuany

Differential Revision: D8324582

fbshipit-source-id: ffd29fa11bbc3a3f0da314f327d26c7b7890545f
2018-06-07 16:16:45 -07:00
Julien Odent
f272a175d4 Time/NL: Fix Sinterklaas for Belgium
Summary: In south Netherlands and in Belgium, Sinterklaas is celebrated on December 6.

Reviewed By: mullender

Differential Revision: D8281767

fbshipit-source-id: 4fc71783b9f543c4dfb04b8ba8481935cfb30dd8
2018-06-05 16:00:43 -07:00
Abdallatif
a00a0d7bdf fix dual big numbers in Arabic
Summary:
for 200, 2000, 2000000
Closes https://github.com/facebook/duckling/pull/202

Reviewed By: adelnobel

Differential Revision: D8257813

Pulled By: patapizza

fbshipit-source-id: d83ea31b9fdf4d28a61b75e84583ef0d7e7bea30
2018-06-04 14:45:37 -07:00
Aaron Yue
b64ff2f21b Time/EN: add <time> for <duration> rules
Summary: add rule for "from <time> for <duration>" and "<time> for <duration>" (symmetric to "for <duration> from <time>")

Reviewed By: patapizza

Differential Revision: D8195733

fbshipit-source-id: 86a0a24d847ea004aeed89ce8a144cb3311aee59
2018-05-31 09:30:30 -07:00
Aaron Yue
0726a40c2a Duration/EN: handle half time grains
Summary: add "a <time-grain> and a half" and "half a <time-grain>" for duration

Reviewed By: patapizza

Differential Revision: D8197599

fbshipit-source-id: ce4d229e7dd73906fe46d964bf48f8a1766a6e70
2018-05-30 13:30:45 -07:00
Edward Akerboom
ddbb6fdff8 Remove am/pm rule
Summary:
See https://github.com/facebook/duckling/issues/196
Closes https://github.com/facebook/duckling/pull/199

Reviewed By: patapizza

Differential Revision: D8098984

Pulled By: xhavokx

fbshipit-source-id: e6c7f94b8cda09c5f96c75052d333bced0c85ac2
2018-05-23 06:15:35 -07:00
Anshuman Chhabra
3e085fcfb1 Added TimeGrain to Hindi (HI)
Summary:
I have added __TimeGrain__ support to __Hindi (HI)__. Please let me know if there are any other changes required!

Cheers! :)
Closes https://github.com/facebook/duckling/pull/198

Reviewed By: patapizza

Differential Revision: D8082131

Pulled By: chinmay87

fbshipit-source-id: 73b8263a9f95775c32905edede14113c51b10431
2018-05-22 12:15:32 -07:00
RIAN DOUGLAS
ecceacb820 Implement Temperature intervals
Summary: Make some changes to allow the TemperatureValue type to support intervals.

Reviewed By: patapizza

Differential Revision: D7680835

fbshipit-source-id: d18c67fbb03f14d61cddb53dae3c544513cc67f2
2018-05-21 12:00:41 -07:00
RIAN DOUGLAS
a38794c7c4 Changes uses of 'financeWith' to use 'isSimpleAmountOfMoney' or 'isCurrencyOnly'
Summary: Changes uses of the financeWith function to use more specific methods which check for either a simple value, or only a currency, making the intent clearer

Reviewed By: haoxuany

Differential Revision: D8064995

fbshipit-source-id: 7321a4482aad8dbdbc7d734eb393220873ad0b51
2018-05-19 18:00:26 -07:00
Steve Gao
9c1be4ee47 Translate periodic holidays
Summary:
Add the support for periodic holidays in Chinese.

Canonical names of the holidays in Chinese are defined using simplified Chinese since it is used by the majority of the population.

Reviewed By: patapizza

Differential Revision: D8044583

fbshipit-source-id: c3db715b9d8c515c2013ab019012527033a17863
2018-05-17 20:00:27 -07:00
Tom Zhang
c0fce31f43 Update regex for Rosh Hashanah and Chanukkah
Summary: This updates the rules for Rosh Hashanah and Chanukkah to account for more alternative spellings. It's not exhaustive, but should catch some of the more common ones.

Reviewed By: patapizza

Differential Revision: D8039856

fbshipit-source-id: 7003c50518f5379f4e503d07f5d5b32a065c7ebc
2018-05-17 18:45:35 -07:00
RIAN DOUGLAS
884904b5ca Implement handling of "grand" for EN_?? locales
Summary: Add implementation of "a grand" and "<num> grand" for AU, BZ, CA, GB, IE, IN, JM, NZ, PH, TT, ZA locales. Some resolve to the local currency (AU, IN), others resolve to Dollar (NZ, PH).

Reviewed By: patapizza

Differential Revision: D7943186

fbshipit-source-id: c71ab462fa9df0ee65223ee82dc2c98457a4e13b
2018-05-17 15:45:27 -07:00
Anshuman Chhabra
8237ef4503 Added Duration support to Hindi (HI)
Summary:
Hello!

I have added __Hindi (HI)__ support for the __Duration__ dimension in ```Duckling/Duration/Rules.hs```. Written tests as well in ```Duckling/Duration/Corpus.hs``` and everything is passing and verified (`253 tests passed`).

Cheers!
Closes https://github.com/facebook/duckling/pull/194

Reviewed By: patapizza

Differential Revision: D7999571

Pulled By: chinmay87

fbshipit-source-id: deb5d60ba7f7ecbc2aa4d97ce5fb96e9bbe63b3d
2018-05-17 14:46:21 -07:00
Abdallatif
9f2fffec23 fix million in ar
Summary:
Fixes https://github.com/wit-ai/wit/issues/1080

Closes https://github.com/facebook/duckling/pull/195

Reviewed By: adelnobel

Differential Revision: D8030001

Pulled By: patapizza

fbshipit-source-id: 0dc0253ff8527c94c8e81a891f33898764336d6d
2018-05-16 14:45:42 -07:00
Matt Le
b28e6e56b1 Adding AD/BC parsing for years
Summary: Adds support for having years qualified with AD or BC.  This adds an extra field to the `TimeDatePredicate` to carry around the extra AD/BC info if it has been provided.

Reviewed By: patapizza

Differential Revision: D7940129

fbshipit-source-id: 993469b3ddd5eeca0e94f7c3d3dd061f37c77607
2018-05-11 16:00:29 -07:00
RIAN DOUGLAS
963aa6b465 Implement handling of "grand" for Ca and GB
Summary: Add implementation of "a grand" and "<num> grand" for EN_CA and EN_GB locales

Reviewed By: patapizza

Differential Revision: D7916643

fbshipit-source-id: 0cd55f17ec522c0334f48436a8a8cc19e0560b0b
2018-05-09 14:46:16 -07:00
Hugh Simpson
40e9421e86 Add millimeter units and UK spellings for Distance
Summary: Closes https://github.com/facebook/duckling/pull/183

Reviewed By: patapizza

Differential Revision: D7891858

Pulled By: panagosg7

fbshipit-source-id: 005176cd880958247e3d47aefeb6f6fdc2591dd1
2018-05-08 15:00:52 -07:00
Julien Odent
a11f10e282 Move Boss's Day to periodic list
Summary: no-op

Reviewed By: haoxuany

Differential Revision: D7912406

fbshipit-source-id: b5c0e6278563bb3a37b57a46a7c4338f44b7e907
2018-05-08 11:45:26 -07:00
mollerhoj
ae89565739 Remove the use of 'man' for Danish
Summary:
This has been bothering me for a while.

In Danish, 'man' means 'you'. E.g. "Kan man det?" translates to "Can you do that?".

As you can imagine, 'man' is used quite frequently. It used to cause a lot of false positives on facebook messenger, but it looks like FM is no longer using Duckling? Either way, unless you add a statistical layer on top of duckling, parsing 'man' as 'Monday' is the exception, not the rule.

This is my first PR, so bear with me if I've overstepped some contribution rules.
Closes https://github.com/facebook/duckling/pull/190

Reviewed By: blandinw

Differential Revision: D7891328

Pulled By: patapizza

fbshipit-source-id: 50c4adb05f206653194e4a151258f851dc9df682
2018-05-08 09:15:36 -07:00
Ziyang Liu
d44cc647a3 Parse 'second last week of October 2018'
Summary: Closes https://github.com/facebook/duckling/pull/191

Reviewed By: haoxuany

Differential Revision: D7894779

Pulled By: patapizza

fbshipit-source-id: 70ac906e7ce10e0c75843409f0dcb5f7629034f4
2018-05-07 15:15:28 -07:00
Julien Odent
cdda637d7c Time/EN_US: EMS week and EMSC day
Summary: 3rd full week in May, starting on a Sunday.

Reviewed By: chinmay87

Differential Revision: D7896050

fbshipit-source-id: aaae50b605a8d199b7134e90896da1de8785a11c
2018-05-07 12:00:50 -07:00
Ziyang Liu
aa3f9d08a6 Add Administrative Professionals' Day in EN_{AU,CA,NZ,US,ZA}
Summary:
* CA, US: Wednesday of the last full week of April
* AU: First Friday of May
* NZ: Third Wednesday of April
* ZA: First Wednesday of September

Closes https://github.com/facebook/duckling/pull/192

Reviewed By: chinmay87

Differential Revision: D7894777

Pulled By: patapizza

fbshipit-source-id: 4401c8a09758173965f08129a9b830a369a38941
2018-05-07 12:00:50 -07:00
Ziyang Liu
c84166d708 Add Quantity/ZH
Summary:
Fixes #181.
Closes https://github.com/facebook/duckling/pull/182

Reviewed By: patapizza

Differential Revision: D7891288

Pulled By: haoxuany

fbshipit-source-id: faa505dbf149c728545a92579cb2e92a89cd5cb8
2018-05-07 09:45:32 -07:00
Julien Odent
ccab5533c7 Time/EN_AU: Ekka
Summary:
Starts on the first Friday of August if it's not before August 5th,
otherwise on the second Friday of August.
10-day event, holiday on the Wednesday.

Reviewed By: chinmay87

Differential Revision: D7891529

fbshipit-source-id: 44edb3285851fc76e0de99f1581d8edf08ea9e7c
2018-05-07 01:15:26 -07:00
Julien Odent
5dbdc48047 Time/EN: Earth Hour
Summary:
Last Saturday of March unless it falls on Holy Saturday,
in which case it's the Saturday before, between 8:30pm and 9:30pm.

Reviewed By: chinmay87

Differential Revision: D7891433

fbshipit-source-id: e21ce54c865e8ee5280a374c8e8fd36571a2e550
2018-05-07 01:15:26 -07:00
Julien Odent
c6b0646493 Time/EN: Vesak
Summary:
According to Wikipedia (https://en.wikipedia.org/wiki/Vesak), Vesak
is celebrated differently across the globe.
As a first stab, taking the day of the full moon in May in the Gregorian
calendar.
Used https://eclipse.gsfc.nasa.gov/SKYCAL/SKYCAL.html to find the full moon in
May.

Reviewed By: chinmay87

Differential Revision: D7881429

fbshipit-source-id: b9897aa0dd32b01a569c8a040749df59cf78ce54
2018-05-06 11:00:34 -07:00
Julien Odent
662935fe64 Time/EN: Global Youth Service Day
Summary: and National variant for US

Reviewed By: chinmay87

Differential Revision: D7879055

fbshipit-source-id: d1db9fb5a3c4a00cb7332979ec12bb2d9935ca4e
2018-05-06 11:00:34 -07:00
Julien Odent
e9f4f21b21 Time/EN_US: Siblings Day
Summary: April 10, year over year.

Reviewed By: haoxuany

Differential Revision: D7878392

fbshipit-source-id: ed26b31d964b54805fc237c69ab1b5c680bac80b
2018-05-04 12:45:27 -07:00