Commit Graph

754 Commits

Author SHA1 Message Date
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
Aaron Yue
dcb537c0b0 keep unicode output in tests sane
Summary: Make test failure outputs readable by proper printing of `Data.Text`, using the `unpack` function rather than relying on the implementation of the `Show` typeclass for `Text`

Reviewed By: patapizza

Differential Revision: D18367058

fbshipit-source-id: b5aece3c8818f16dfe4c55235f6b9a183ba6f70f
2019-11-07 10:48:17 -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
721e3f48db fix missing latent corpus in tests
Reviewed By: chinmay87

Differential Revision: D17225649

fbshipit-source-id: 5a41372737c31e87ec944824b852516de531d376
2019-09-10 10:31:51 -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
Amit Manchanda
e38a852138 Update: add new dimension to a language
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/384

Reviewed By: patapizza

Differential Revision: D16150013

Pulled By: haoxuany

fbshipit-source-id: 5ef22efb84120337749dd29c3d33d507502c3e4c
2019-07-09 15:21:34 -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
Noam Zilberstein
6cfa052b56 fix open source build
Summary: We need to specify the module name for the test module in the cabal file

Reviewed By: patapizza

Differential Revision: D15173223

fbshipit-source-id: 6dc5068c0d1e8fbae99b7ce9d96ae57a4f893490
2019-05-02 08:48:32 -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