Commit Graph

522 Commits

Author SHA1 Message Date
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
Julien Odent
2e70e683b4 Documentation: Coding style
Reviewed By: haoxuany

Differential Revision: D7992017

fbshipit-source-id: ddbd92929690fea167ea5cd99602160a8d8a3aa9
2018-05-14 14:30:36 -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
Julien Odent
8325fc0c5e README: custom dimensions and updated new lang instructions
Summary: .

Reviewed By: haoxuany

Differential Revision: D7937075

fbshipit-source-id: 3ae51e893773ca75cdd31e5c9bfde78077447f1b
2018-05-09 15:15: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
Julien Odent
d81056dd0d Fix build
Reviewed By: haoxuany

Differential Revision: D7878218

fbshipit-source-id: f5a37ea3d4bb56e5053e854222f5804b2eca8488
2018-05-04 10:30:30 -07:00
Chinmay Deshmukh
a7f83ffe6a Time/EN: Make partial meridies latent
Summary: Make partial meridies latent to not flag spans like "A4 A5"

Reviewed By: patapizza

Differential Revision: D7866300

fbshipit-source-id: 2254750d643ca28474a5340731f9786617dcbadf
2018-05-03 15:45:33 -07:00
RIAN DOUGLAS
f328821bbc Add support for using 'grand' to refer to 1,000's of currency in EN
Summary: Added support for ",number> grand" and "a grand" to result in thousands of currency amount

Reviewed By: haoxuany

Differential Revision: D7688809

fbshipit-source-id: 72a81c7a1c48329f85c9f525b72b00c479a9edb0
2018-05-03 14:45:25 -07:00
Julien Odent
1976fd4543 Time/EN_US: Tax Day
Summary:
The first weekday on or after April 15 not falling on Emancipation
Day. Otherwise, the weekday after that.

Reviewed By: chinmay87

Differential Revision: D7745651

fbshipit-source-id: c215d903c250bac5ebc265192794fd324efda812
2018-04-30 13:45:25 -07:00
Julien Odent
94a0fb3f63 Warn against incomplete patterns
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
2018-04-26 16:31:02 -07:00
Julien Odent
b4c0f6ebd6 Time/EN_US: Fix Emancipation Day
Summary: Observed is the first weekday closest to April 16.

Reviewed By: haoxuany

Differential Revision: D7735190

fbshipit-source-id: f046dfb5c067464b83764f97114ccf9c805069d0
2018-04-24 11:01:27 -07:00
Julien Odent
d6143e98d7 Time/EN: Fix before/after/until/since + <year>
Summary: Reusing existing rules to be consistent.

Reviewed By: haoxuany

Differential Revision: D7735684

fbshipit-source-id: dd1699e095a2ae9754ec71e5d622c9378c308f17
2018-04-24 10:00:32 -07:00
Julien Odent
00d46b18f2 Time/EN: Absorb "since" before month/year
Summary:
since 2009, since February, etc.

https://github.com/wit-ai/wit/issues/1056

Reviewed By: haoxuany

Differential Revision: D7729314

fbshipit-source-id: a635cdab4ee5f077c77ef0c01180c805675cd0a7
2018-04-23 10:45:29 -07:00
Julien Odent
17dd70ffe5 Update old github links
Summary: facebookincubator -> facebook

Reviewed By: haoxuany

Differential Revision: D7729114

fbshipit-source-id: 4786b40060e873900c50e3af20be180a573a19ce
2018-04-23 10:15:33 -07:00
Pavlo Kerestey
7b6cbf0ddb Support '2 thursdays ago|back'
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
2018-04-20 16:45:33 -07:00
Ziyang Liu
a3b35880e5 Change value in Entity to typed value instead of JSON
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
2018-04-20 14:18:47 -07:00
Panagiotis Vekris
e679a7e32c version bump to 0.1.5.0
Summary: Bumping version before hackage release

Reviewed By: patapizza

Differential Revision: D7712566

fbshipit-source-id: 8dd55487ec2ce89ad84d8c79ae5baa3b94016508
2018-04-20 12:30:36 -07:00
Julien Odent
e15efc4336 Time/EN: Vasant Panchami, Holika Dahan, Holi
Summary: Moar Hindu holidays.

Reviewed By: chinmay87

Differential Revision: D7704148

fbshipit-source-id: 90fc611021389585c35b667d822cbe67e281d48d
2018-04-19 18:45:29 -07:00
Ziyang Liu
5460d8df0e Support custom dimensions
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
2018-04-19 15:30:51 -07:00
Julien Odent
eccf5c8f24 Time/EN: More Hindu holidays
Summary:
* Raksha Bandhan
* Pongal
* Onam

Reviewed By: chinmay87

Differential Revision: D7662179

fbshipit-source-id: f29f9bdadb70455956ddf8c65afc34309e7e25d0
2018-04-19 11:00:50 -07:00
Julien Odent
9c8619cbc9 Time/EN: Navaratri holidays
Summary: Added Navaratri-related holidays from 2000 to 2030.

Differential Revision: D7661419

fbshipit-source-id: ab5cf5c4fe9a4019cf51e9569692a03321667bf4
2018-04-19 11:00:50 -07:00
Julien Odent
1f1837c47b Time/EN: Diwali holidays
Summary: Adding Diwali-related holidays from 2000 to 2030.

Reviewed By: chinmay87

Differential Revision: D7660326

fbshipit-source-id: aff8de97b266f797ff759655982252e7e259e87f
2018-04-19 11:00:50 -07:00
Quan
c166179d89 Use comma "," as decimal separator for VI
Summary:
In Vietnam, we use comma "," as decimal separator instead of dot "."
Closes https://github.com/facebook/duckling/pull/176

Reviewed By: patapizza

Differential Revision: D7601328

Pulled By: panagosg7

fbshipit-source-id: 7f5725006f9054fe45a24757ec2abc36b7aa6605
2018-04-18 23:15:30 -07:00
Aaron Yue
4df76289bc Implement AmountOfMoney
Summary: implement AmountOfMoney rules and corpus for ZH

Reviewed By: patapizza

Differential Revision: D7508507

fbshipit-source-id: 3591b399a9880c5278587979c6576720343cc123
2018-04-17 16:45:32 -07:00
Aaron Yue
babe317723 fix intersect rule to work with negative numbers
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
2018-04-13 19:45:40 -07:00
Chinmay Deshmukh
17e1845e12 Time/EN_CA, EN_US: Add "Groundhogs day" in regex for "Groundhog Day"
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
2018-04-13 12:15:31 -07:00
Julien Odent
de977fe5cc Duration: Move composite duration rule to English
Summary: "and" is language-specific.

Reviewed By: chinmay87

Differential Revision: D7605874

fbshipit-source-id: 59adcee4784baebe3b9eb775b6763bf3bba8ef8d
2018-04-12 15:15:29 -07:00
RIAN DOUGLAS
fd267ee80b Time/EN: Make "may" latent
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
2018-04-12 14:00:29 -07:00
Aaron Yue
fe0807dced Use lambda-case for Rule production
Summary: change Rule production functions to lambda-case

Reviewed By: patapizza

Differential Revision: D7424413

fbshipit-source-id: edac0290d310578f633ff0208434d1eca038ad9c
2018-04-12 10:15:57 -07:00
Aaron Yue
4ef255e577 Generalize and expand digit specifier usage for hanzi
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
2018-04-12 10:00:33 -07:00
Chinmay Deshmukh
f355abacc5 Time/EN: time + n years ago/in n years
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
2018-04-12 01:10:17 -07:00
Julien Odent
c539ba2f55 Time/EN: Tu BiShvat
Summary: Added precomputed Jewish holiday `Tu BiShvat`.

Reviewed By: chinmay87

Differential Revision: D7596389

fbshipit-source-id: ed770dfa0eca982d5d1896dacff6443ee0fa2d30
2018-04-11 20:15:42 -07:00
Julien Odent
443caeb096 Time/EN_AU: Reconciliation Day
Summary:
First Monday on or after May 27th:
https://publicholidays.com.au/reconciliation-day/

Reviewed By: chinmay87

Differential Revision: D7596237

fbshipit-source-id: 5ad4effb30d1e09a988c93fdb85f9dc60d0a1e54
2018-04-11 20:15:42 -07:00
Souvik Ghosh
ced73dcdcb AmountOfMoney NL Support
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
2018-04-11 17:15:30 -07:00
Julien Odent
120f569ed0 Time/EN: Fix "in" + year
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
2018-04-11 11:00:30 -07:00
Lucas Hosseini
528fea9ad4 Make all years latent
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
2018-04-11 05:15:31 -07:00