Summary:
Pull Request resolved: https://github.com/facebook/duckling/pull/533
In recent versions of Data.Some the name of the constructor, `This` has changed name to `Some`. This has become rather problematic for us to migrate so we're just going to remove the dependency. The meat of this diff is adding the type `Seal` to `Duckling.Types`. That type replaces `Some`.
Reviewed By: pepeiborra
Differential Revision: D23929459
fbshipit-source-id: 8ff4146ecba4f1119a17899961b2d877547f6e4f
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
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
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
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
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
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
Summary: In south Netherlands and in Belgium, Sinterklaas is celebrated on December 6.
Reviewed By: mullender
Differential Revision: D8281767
fbshipit-source-id: 4fc71783b9f543c4dfb04b8ba8481935cfb30dd8
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
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: Add an option to return latent time entities. This can be used when one is pretty certain that the input contains a datetime.
Reviewed By: patapizza
Differential Revision: D7254245
fbshipit-source-id: e9e0503cace2691804056fcebdc18fd9090fb181
Summary: "yesterday" would resolve to an entity without any `values`.
Reviewed By: JonCoens
Differential Revision: D6697432
fbshipit-source-id: 7b15727f92703842a2995210fdeb99c00be74bc3
Summary:
Hi, in this pr:
* Added time dimension to Arabic language, thanks to Hussein-Dahir & Yazeed-Obaid for writing time corpus.
* Fixed some bugs in numeral & ordinals and added more test cases for them.
Also, I don't really understand why do we use classifiers in time dimension?
Closes https://github.com/facebook/duckling/pull/123
Reviewed By: blandinw
Differential Revision: D6583313
Pulled By: patapizza
fbshipit-source-id: f7acdef0c032d7b7fd7d224832fdaf484d2df825
Summary:
This adds support for greek times.
There are still some issues with expressions of the form:
```
9:30 - 11:00 την πέμπτη
```
Where `11:00 την πέμπτη` is parsed first (as 11:30 on Thu), instead of prioritizing `9:30 - 11:00` as the training data suggests. These tests are for the moment excluded from the corpus.
Reviewed By: patapizza
Differential Revision: D6376271
fbshipit-source-id: 2f31e058fb88386429070e3b51cd33f93b9c5936
Summary:
When using speech recognition, we might see things like "six thirty six a m" or
"ten thirty p m".
Also fixed the argument order of `timeOfDayAMPM` to be more idiomatic.
Reviewed By: blandinw
Differential Revision: D6316542
fbshipit-source-id: 0008c049040219b3a1dd80d9e4661ba8a246fa7f
Summary:
* add flag for this/next/last time
* fix thanskgiving in EN locales
* `analyzedRangeTest` helper with `rangeTests` for `Time/EN`
Reviewed By: blandinw
Differential Revision: D6191209
fbshipit-source-id: 6eaa117
Summary: The date format changes between EN locales (https://en.wikipedia.org/wiki/Date_format_by_country). This diff fixes how dates are handled in each locale.
Reviewed By: patapizza
Differential Revision: D6156147
fbshipit-source-id: 22f296c
Summary:
* `en_CA` locale
* In Canada, Thanksgiving Day is the second Monday of October.
* Black Friday is the same as the US.
* However Canada observes both DDMM and MMDD formats. Defer to later, falling back to US.
Reviewed By: blandinw
Differential Revision: D6058909
fbshipit-source-id: 3d4e05e
Summary:
* Moving `ruleNationalDay` from `ZH` rules to specific locales: `zh_CN`, `zh_HK`, `zh_MO`
* Fixed National Day for `zh_TW`.
Reviewed By: blandinw
Differential Revision: D6057565
fbshipit-source-id: 8f9f2ab
Summary:
* Locales support for the library, following `<Lang>_<Region>` with ISO 639-1 code for `<Lang>` and ISO 3166-1 alpha-2 code for `<Region>` (#33)
* `Locale` opaque type (composite of `Lang` and `Region`) with `makeLocale` smart constructor to only allow valid `(Lang, Region)` combinations
* API: `Context`'s `lang` parameter has been replaced by `locale`, with optional `Region` and backward compatibility.
* `Rules/<Lang>.hs` exposes
- `langRules`: cross-locale rules for `<Lang>`, from `<Dimension>/<Lang>/Rules.hs`
- `localeRules`: locale-specific rules, from `<Dimension>/<Lang>/<Region>/Rules.hs`
- `defaultRules`: `langRules` + specific rules from select locales to ensure backward-compatibility
* Corpus, tests & classifiers
- 1 classifier per locale, with default classifier (`<Lang>_XX`) when no locale provided (backward-compatible)
- Default classifiers are built on existing corpus
- Locale classifiers are built on
- `<Dimension>/<Lang>/Corpus.hs` exposes a common `corpus` to all locales of `<Lang>`
- `<Dimension>/<Lang>/<Region>/Corpus.hs` exposes `allExamples`: a list of examples specific to the locale (following `<Dimension>/<Lang>/<Region>/Rules.hs`).
- Locale classifiers use the language corpus extended with the locale examples as training set.
- Locale examples need to use the same `Context` (i.e. reference time) as the language corpus.
- For backward compatibility, `<Dimension>/<Lang>/Corpus.hs` can expose also `defaultCorpus`, which is `corpus` augmented with specific examples. This is controlled by `getDefaultCorpusForLang` in `Duckling.Ranking.Generate`.
- Tests run against each classifier to make sure runtime works as expected.
* MM/DD (en_US) vs DD/MM (en_GB) example to illustrate
Reviewed By: JonCoens, blandinw
Differential Revision: D6038096
fbshipit-source-id: f29c28d
Summary: In Romanian, `sa` is fairly common: hai sa ne vedem (let's see), hai sa mergem (let's go).
Reviewed By: blandinw
Differential Revision: D5801345
fbshipit-source-id: db677e4
Summary: 'nie' means 'no' in Polish, and isn't a common abbreviation for 'niedziela' (Sunday).
Reviewed By: blandinw
Differential Revision: D5587036
fbshipit-source-id: bfda7fc
Summary:
In French, the form "at hh" is not valid (it requires an hour indicator).
This fixes false positives such as in "John a un rendez-vous."
Fixes https://github.com/wit-ai/wit/issues/666.
Reviewed By: JonCoens
Differential Revision: D5530713
fbshipit-source-id: ecee1e5
Summary:
Time dimension for Hebrew.
Commented out the failing tests that actually also fail in Clojure.
Reviewed By: JonCoens
Differential Revision: D4970308
fbshipit-source-id: b455142
Summary:
This works around https://github.com/haskell/cabal/issues/4350
If we don't do this files get compiled multiple times
and cabal is unhappy.
Reviewed By: patapizza
Differential Revision: D4782749
fbshipit-source-id: 5bbe425