Summary:
Added GHC option to warn against incomplete patterns.
This is useful to drive the implementation for new languages, and make sure we're not missing anything.
Reviewed By: haoxuany
Differential Revision: D7782889
fbshipit-source-id: 09d92ca37974eed56a22c0edb9e8f74412f7e3f6
Summary: Observed is the first weekday closest to April 16.
Reviewed By: haoxuany
Differential Revision: D7735190
fbshipit-source-id: f046dfb5c067464b83764f97114ccf9c805069d0
Summary:
since 2009, since February, etc.
https://github.com/wit-ai/wit/issues/1056
Reviewed By: haoxuany
Differential Revision: D7729314
fbshipit-source-id: a635cdab4ee5f077c77ef0c01180c805675cd0a7
Summary:
I have seen the Call for participation for #175 in Haskell News and thought I would give it a try and exercise in contributing to unknown haskell code.
As I am new to the project, I have probably done a mistake of committing the classifiers. The commit got reverted but it is still associated with the issue. Lesson learned: don't tag commit messages wit the issue numbers.
Closes https://github.com/facebook/duckling/pull/180
Reviewed By: patapizza
Differential Revision: D7717445
Pulled By: haoxuany
fbshipit-source-id: d818f351d03b6c8b3d77984b2060a0a14230696f
Summary:
Modified `Entity` to use the new `ResolvedVal` data type. Other changes follow naturally. Related issues: https://github.com/facebook/duckling/issues/121 and https://github.com/facebook/duckling/issues/172
Now one can pattern match on the output value, for instance:
```
{-# LANGUAGE GADTs #-}
import Data.Text
import Duckling.Core
import Duckling.Testing.Types
import qualified Duckling.PhoneNumber.Types as PN
parsePhoneNumber :: Text -> Text
parsePhoneNumber input =
case value entity of
(RVal PhoneNumber (PN.PhoneNumberValue v)) -> v
where
(entity:_) = parse input testContext testOptions [This PhoneNumber]
```
Reviewed By: patapizza
Differential Revision: D7502020
fbshipit-source-id: 76ba7b315cfd0d2c61ff95c855b7c95efc0a401c
Summary:
Support custom dimensions
Had to move the definition of `Dimension` from `Duckling.Dimensions.Types` to `Duckling.Types` to avoid cyclic imports between these two modules.
A sample custom dimension is in `exe/CustomDimensionExample.hs`.
Limitations of custom dimensions:
- All rules for a custom dimension must be in the same module with the definition of the custom dimension. Otherwise there will be cyclic imports, because the definition of the dimension and the rules refer to each other.
- The custom dimension must be specified when using `parse`, since there's no way to get all the existing custom dimensions.
Reviewed By: patapizza
Differential Revision: D7630360
fbshipit-source-id: 30e12dcb33611f5692c4f5949de377bf61b75e1e
Summary:
Numerals that require intersection with negative numbers don't work, since the negative sign gets parsed
before the intersect rules happen. This fixes it by adding a guard in for positive in the intersection rule.
Reviewed By: patapizza
Differential Revision: D7592225
fbshipit-source-id: 2bc9c708cadeea4012c1f3ef487c61a144325f2a
Summary: Modify regex to add "Groundhogs day" in regex for "Groundhog Day" in US and CA
Reviewed By: patapizza
Differential Revision: D7605031
fbshipit-source-id: 0cbb45d4edde3345437872f2e5b366c39f6a8b54
Summary: Extended method for making months from a pair, to take a 3-tuple, including a flag indicating whether to make the result latent. Implement the previous mkRuleMonths method in terms of this.
Reviewed By: patapizza
Differential Revision: D7491037
fbshipit-source-id: 4d4c41b46dc0390e17b521480f3daf8306f23834
Summary:
generalize chinese digit specifier (十百千万亿) parsing, and add hanzi tests
These digits specifiers can be parsed as (<num><speci>)<num>,
by using the multiplicater value <num><speci>, and a connect function that adds them together
(two cases, skipping digits [which requires a 零 in between], and digits in consecutive locations).
Note that 个 is technically a digit specifier,
but in Chinese it is never used directly as a numeral specifier, and always as a counter.
Reviewed By: zliu41
Differential Revision: D7424249
fbshipit-source-id: 20a85a7df1f908ee9879e92b904178fa26a9a5e5
Summary:
Add support for things like -
"mlk day three years ago"
"mlk day in three years"
"Labor Day one year from now"
"Thanksgiving in one year"
"Thanksgiving in 2013"
"january in a year"
"january 3 years ago"
Reviewed By: patapizza
Differential Revision: D7581591
fbshipit-source-id: 6f37a83c5acbff28672c2e8a958eaf37c679cab3
Summary:
First Monday on or after May 27th:
https://publicholidays.com.au/reconciliation-day/
Reviewed By: chinmay87
Differential Revision: D7596237
fbshipit-source-id: 5ad4effb30d1e09a988c93fdb85f9dc60d0a1e54
Summary:
Hello,
I have added new directory for AmountOfMoney NL Support
Added two files
- Duckling/AmountOfMoney/NL/Corpus.hs
- Duckling/AmountOfMoney/NL/Rules.hs
Updated File
- Duckling/Rules/NL.hs
Added test cases
- tests/Duckling/AmountOfMoney/NL/Tests.hs
Updated Test file
- tests/Duckling/AmountOfMoney/Tests.hs
Updated
duckling.cabal
Thanks for the review and the latest merge. Looking forward
Regards
Closes https://github.com/facebook/duckling/pull/173
Reviewed By: JonCoens
Differential Revision: D7592192
Pulled By: patapizza
fbshipit-source-id: 5895c29bf7f1033e4ffd791d5915a16d230e9375
Summary: Now that years are latent, let's absorb the "in" and make them not latent.
Reviewed By: zliu41
Differential Revision: D7587599
fbshipit-source-id: 61a19ac389244df491591d78c28f0301f9124439
Summary: Make all years latent to prevent any four digit number to be considered a year.
Reviewed By: patapizza
Differential Revision: D7559843
fbshipit-source-id: f3a8625dd7d74edfffb13401278d6b4a5110359a
Summary:
Rule to resolve things like:
"27th of next month"
"15th of last month"
"3rd of this month"
Reviewed By: patapizza
Differential Revision: D7543740
fbshipit-source-id: 20bdc194ed7d1466e2ca42c87b73a04ace7c29ab
Summary:
* Fixed computed past series
* Added a few Jewish holidays, pre-computed and built upon.
Reviewed By: chinmay87
Differential Revision: D7511694
fbshipit-source-id: c66a34e6634a9f86101fb2fd3b4a372d75ba5711
Summary: Add Boss's Day (closest working day to Oct 16) in EN
Reviewed By: patapizza
Differential Revision: D7512241
fbshipit-source-id: c8a4a14b77677ed34edebfeb48bfce1019bb059d
Summary: Earlier distance was implemented, but it was not defined
Reviewed By: patapizza
Differential Revision: D7524341
fbshipit-source-id: e1e8342a6eff5a523a0db31bf301870ae27c513e
Summary:
enforce units are checked in ruleUnitAmount and ruleAmountUnit, and distribute ruleUnitAmount to all
languages, since in some languages this doesn't work (such as for ZH, where value units must succeed amounts)
Reviewed By: patapizza
Differential Revision: D7509840
fbshipit-source-id: 3a79b39721850f9d0289442925fbc02cf69abefb
Summary: show the input that an ambiguous parse is failing at
Reviewed By: patapizza
Differential Revision: D7502191
fbshipit-source-id: 9f0fbf8301413d9007236ba5b6af1f4b41c20269
Summary:
During ranking, due to how candidates are ordered, it is completely possible to have multiple correct candidates
have the exact same rank (equal range and exact equal score). In this case `analyze` returns all of them, which gets
misinterpreted as having multiple tokens in output rather than multiple solutions. Checks this case and gives the
correct prompt for ambiguous parses.
Reviewed By: patapizza
Differential Revision: D7489391
fbshipit-source-id: b66947e37bddb3ac6273843dd79b559aff9d0083
Summary:
* fixed Labour Day for most locales
* added Heroes' Day for JM, PH and ZA
* National Patriots' Day for CA
Reviewed By: chinmay87
Differential Revision: D7492156
fbshipit-source-id: 2a99412a55190ffa5a541b47f6d92d0df928fc3b
Summary: Add EN support for this|last|next season
Reviewed By: patapizza
Differential Revision: D7443814
fbshipit-source-id: 925296f793fbe03bcb67d8a6af3eb6695347eedd
Summary:
Return the canonical holiday name if the input had a holiday in it and the date resolves to the date of the holiday.
Add `holiday` to `TimeData`.
Set it in the holiday rule.
Make sure it propogates appropriately in `predNth` and `intersect`.
Make sure it doesn't propogate in other rules.
Add `holiday` to `TimeValue` and set it during `resolve`
Reviewed By: patapizza
Differential Revision: D7441387
fbshipit-source-id: d57602fd294dc6149ab044c05065c1b9250cb331
Summary:
* Added periodic holidays for all English locales
* Fixed father's day in Australia and New Zealand
Reviewed By: chinmay87
Differential Revision: D7450426
fbshipit-source-id: 9ddcf7f08e73e2bb501541d9697d64b7e99a8ef1
Summary: remove `ruleLastTuesdayLastJuly`, it does the exact same thing as `ruleLastTime`
Reviewed By: patapizza
Differential Revision: D7445836
fbshipit-source-id: 95667db4ce376223acce0ea36a6a0493946ceea1
Summary: Add EN support for last night and late last night
Reviewed By: patapizza
Differential Revision: D7369829
fbshipit-source-id: bd1dbecf247e428307adfae3e8e83840f6de77b1