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
Summary:
Following other Jewish holidays convention, starting on sunset of
previous day.
Reviewed By: chinmay87
Differential Revision: D9315490
fbshipit-source-id: bdfef5ba0c7bca6601bb7557d30840b47734b819
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:
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
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
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
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
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
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
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
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:
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
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
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
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
Summary: 3rd full week in May, starting on a Sunday.
Reviewed By: chinmay87
Differential Revision: D7896050
fbshipit-source-id: aaae50b605a8d199b7134e90896da1de8785a11c
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
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
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
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
Summary: and National variant for US
Reviewed By: chinmay87
Differential Revision: D7879055
fbshipit-source-id: d1db9fb5a3c4a00cb7332979ec12bb2d9935ca4e
Summary: Make partial meridies latent to not flag spans like "A4 A5"
Reviewed By: patapizza
Differential Revision: D7866300
fbshipit-source-id: 2254750d643ca28474a5340731f9786617dcbadf
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
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: 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: 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:
* 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
Summary: Added rules for the beginning / end of year / month / week
Reviewed By: patapizza
Differential Revision: D7356994
fbshipit-source-id: 43489b3709b8ab586384321cf9bc79c45668162a
Summary:
Hello,
I wanted to fix problem with two months - May and November for PL language, since it is what I need to use in [wit.ai](http://wit.ai), but.. I'm not sure how to do that. I've created two failing tests, checked `Rules`, but there are already some rules which are responsible for that cases:
`20 listopada` :
`, ( "November" , "listopad|listopada|listopadowi|listopadem|listopadzie|lis\\.?|list\\.?" )`
`20 maja`:
`, ( "May" , "maj|maja|majowi|majem|maju" )`
Can you help me somehow fix that issues because I'm not sure how I can force Duckling to use proper regexp? :)
Closes https://github.com/facebook/duckling/pull/161
Reviewed By: patapizza
Differential Revision: D7353495
Pulled By: panagosg7
fbshipit-source-id: b0c70172e4cc9dbd4635ed64e89ffb463b643f90
Summary:
"DD MM YYYY", "MM DD YYYY" parsed only as a phone number, but it is also a popular datetime format.
I have added new time patterns and tests for this cases.
Closes https://github.com/facebook/duckling/pull/163
Reviewed By: patapizza
Differential Revision: D7320048
Pulled By: panagosg7
fbshipit-source-id: 5ccf1ccca173126f5d2b9b8b2664181f3b13f78b
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:
* added periodic holidays for all existing English locales
* moved Independence Day from common to US, as it is country-dependent
* moved Memorial Day from common to US, as it is country-dependent (fixed the one for Canada)
* added Decoration Day as an alias for US Memorial Day
Reviewed By: chinmay87
Differential Revision: D7294129
fbshipit-source-id: 89cdbf91b4c43e1996fa1f4509eac1d1b1978197
Summary: Support lowercase time zones
Reviewed By: patapizza
Differential Revision: D7114137
fbshipit-source-id: 906c4fa5305aea8990e8a5d480ceeec4b584d7db
Summary:
patapizza Did my best, but I'm neither fluent on Dutch or Haskell :) I tried keeping it consistent with the existing code, let me know if there's something I can improve!
Closes https://github.com/facebook/duckling/pull/149
Reviewed By: blandinw
Differential Revision: D6809767
Pulled By: patapizza
fbshipit-source-id: f92802b94ed7588a03219f63e74dbab475e950ab
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:
* Closes PRs #115, #116.
* `Numeral`: Moves `ruleFractions` to common
* `Numeral/PT`: fixes dot in regex
* `Time`: Moves `isNumeralSafeToUse` to `isIntegerBetween` (more robust and cleaner)
* `Time/EN`: refactored `ruleCycleLastNextN` to `ruleDurationLastNext` (so it also accounts for non-safe Numerals, like "in a few days")
Reviewed By: blandinw
Differential Revision: D6502958
fbshipit-source-id: 6d9c08a23dab88f441aadade08d663c8e0da415d
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: Refactor days of week and months rules to avoid mindless copy-pasta.
Reviewed By: patapizza
Differential Revision: D6438622
fbshipit-source-id: 489261b53ba50f6624996ad4581c2bf1206a8cc1
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:
"d" would parse as "dinsdag" (Tuesday), "zo" would parse as "zondag" (Sunday, also means "so").
Made dots mandatory, to prevent further issues (e.g. "zon" means "sun").
Reviewed By: mullender
Differential Revision: D6312693
fbshipit-source-id: 58c5824e3ff174fc9c293c3f2d13e152c60e51de
Summary: Some constructors for Time related rules are being reused among different language, so we can extract them in `Duckling/Time/Helpers.hs`.
Reviewed By: patapizza
Differential Revision: D6269106
fbshipit-source-id: 7d9969ce425ee27a2e1a32ea48932e16c7e6b1f1
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:
One of the most common ways of saying "last \<day-of-the-week\>" in Swedish is saying "i \<day-of-the-week\>s", for example "i tisdags" (last Tuesday) or "i lördags" (last Saturday). This pull request adds support for this.
Closes https://github.com/facebookincubator/duckling/pull/92
Reviewed By: blandinw, kodafb
Differential Revision: D6064814
Pulled By: patapizza
fbshipit-source-id: 6ea5466
Summary:
`ter` also means `to have`, which is very common.
`ter` is a very rare form for `Tuesday`, only used in calendar-like contexts
Reviewed By: blandinw
Differential Revision: D6066506
fbshipit-source-id: c8cd231
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:
- Fixes#89. "<number> <number>" would parse as Time if in the right range.
- Applied same rule for all languages. Note that for Italian and Polish, I updated "<hour> <minute>" tests to be in the form "at <hour> <minute>".
- Replaced `liftM2` with more generic `and|or . sequence [f1, f2, ...]`.
Reviewed By: blandinw
Differential Revision: D5992879
fbshipit-source-id: 5409ffb
Summary: Consolidate HE language named-months in the same style of other language, particularly EN. Translations were taken from previous namedMonth# rules and merged into the combined rule. Hebrew-speaking verification would be helpful to verify the integrity of the translations, although they were already taken from the existing code.
Reviewed By: blandinw
Differential Revision: D5839625
fbshipit-source-id: d53f9c7
Summary: Changed the duckling Polish days and months rules to be in line with the new style including all in one rules
Reviewed By: blandinw
Differential Revision: D5903171
fbshipit-source-id: 7f2ba60
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:
We noticed that using UTF-8 characters directly in regexes work.
Hence converting back the escaped characters for readability and maintenance.
Reviewed By: blandinw
Differential Revision: D5787146
fbshipit-source-id: e5a4b9a
Summary:
Remove hardcoded named-days and named-months, and
replace them with ruleDaysOfWeek and ruleMonths.
Reviewed By: patapizza
Differential Revision: D5742209
fbshipit-source-id: 339fc0a
Summary:
The Galeic ruleset has 12 separate rules for months, and 7 for days. This
change replaces those with a list of months/days and a single function
to create a list of rules from those. This is the same approach as is currently in the English ruleset.
Reviewed By: patapizza
Differential Revision: D5756222
fbshipit-source-id: ac4bc42
Summary:
Combined each of seasons, instants, and holidays into a data list and a
function to generate the list of Rules.
*Instants = today, tomorrow, now, end of year, etc.
Reviewed By: patapizza
Differential Revision: D5730896
fbshipit-source-id: 23170e7
Summary:
The German ruleset has 12 separate rules for months, and 7 for days. This
change replaces those with a list of months/days and a single function
to create a list of rules from those. This is the same approach as is currently in the English ruleset.
Reviewed By: patapizza
Differential Revision: D5728656
fbshipit-source-id: 8590f4a
Summary: Consolidated all the days of week rules into one rule, and did the same for all the month rules.
Reviewed By: patapizza
Differential Revision: D5721202
fbshipit-source-id: 2b4a56f
Summary: Consolidated the previous days of weeks and month names in french duckling file to become only 2 rules. Allows for more concise, updated code.
Reviewed By: patapizza
Differential Revision: D5710056
fbshipit-source-id: 816ef88
Summary: Changed Danish time rules to use ruleDaysOfWeek and ruleMonths.
Reviewed By: patapizza
Differential Revision: D5709782
fbshipit-source-id: aa03065
Summary:
There are problems in the ordinal recognition for Swedish. The most severe one is that all the numbers above 15 are actually Danish, not Swedish. Apart from that digits and digits followed by a dot are considered ordinals.
This pull request fixes this and also adds support for ordinals up to 100. The structure of the code is similar to in the ordinal recognition in English. Tests are also updated, both the ordinal tests and the time tests where incorrect ordinals were used.
Closes https://github.com/facebookincubator/duckling/pull/86
Reviewed By: JonCoens
Differential Revision: D5698145
Pulled By: patapizza
fbshipit-source-id: c31d7bc
Summary: In Portuguese, "um" means the numeral "one" and the article "a".
Reviewed By: bfiss
Differential Revision: D5703396
fbshipit-source-id: 92ed04f
Summary:
Remove hardcoded named-days and named-months, and
replace them with ruleDaysOfWeek and ruleMonths.
Reviewed By: patapizza
Differential Revision: D5695475
fbshipit-source-id: d30557f
Summary: Consolidating the rules for months and days of the week in Italian following the pattern seen in English.
Reviewed By: patapizza
Differential Revision: D5665259
fbshipit-source-id: 45d6c3b
Summary: This is a simple refactor that uses the weekend helper for all languages
Reviewed By: patapizza
Differential Revision: D5677330
fbshipit-source-id: 9984539
Summary:
We don't allow matches adjacent to a character of the same class.
We were treating uppercase and lowercase characters differently.
"jon Friday" wouldn't match "on" but "Jon Friday" would.
Reviewed By: blandinw
Differential Revision: D5653681
fbshipit-source-id: be67358
Summary: Added ruleIntervalDDDDMonth to EN to handle cases such as "23rd to 26th Oct" and "1-8 september"
Reviewed By: patapizza
Differential Revision: D5637280
fbshipit-source-id: a1fdcd2
Summary: Moved all named days to the same rule, moved all named months to the same rule. Kept same regexes, just consolidated them.
Reviewed By: patapizza
Differential Revision: D5637061
fbshipit-source-id: e08ecf9
Summary: Changed ruleIntervalMonthDDDD to use the ordinal predicate instead of ugly regex
Reviewed By: patapizza
Differential Revision: D5628188
fbshipit-source-id: 1dbe195
Summary: Added EN rule "ruleIntervalFromDDDDMonth" to support "from 10 to 16 August". Used "isDOMValue" helper rather than regex.
Reviewed By: patapizza
Differential Revision: D5610623
fbshipit-source-id: 00a5208
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:
Fixes#65.
* fixes US holidays
* Black Friday is actually the first day after Thanksgiving day (not necessary the fourth Friday of November)
Reviewed By: JonCoens
Differential Revision: D5533906
fbshipit-source-id: 1824cba
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:
* `Duration` before/after `Time` now resolves with the lowest grain
* "now" has an undefined grain `NoGrain`, as depending on the context it might mean different things, as opposed to "right now"
Before:
`day after tomorrow` -> `day` grain
`1 day after tomorrow` -> `hour` grain
Given that the reference date/time is `2013-02-12T04:30:00`.
`one year from now` -> `2014-02-01T00:00:00` with `month` grain.
`one year from today` -> `2014-02-01T00:00:00` with `month` grain.
After:
`day after tomorrow` -> `day` grain
`1 day after tomorrow` -> `day` grain
`one year from now` -> `2014-02-12T04:30:00` with `month` grain (remains the same).
`one year from today` -> `2014-02-12T00:00:00` with `day` grain.
For other `Time` entities involving `Duration`, such as "in + `Duration`", the behavior remains the same: shift to the lower grain (the intent is not precise).
Reviewed By: l5t, blandinw
Differential Revision: D5467164
fbshipit-source-id: b63b6a4
Summary:
MM/YY is a common format for dates in India,UK and other parts of the world.Have added testcases in `Time/EN/corpus.hs` ,however it conflicts with one of the original(2/15 is output now as Feb. 2015 and not the 15th of February).
Closes https://github.com/facebookincubator/duckling/pull/59
Reviewed By: niteria
Differential Revision: D5455881
Pulled By: patapizza
fbshipit-source-id: 23b73a5
Summary:
Today things like `at single`, `at a few`, `at a couple of` would return a `Time`.
Discussed with blandinw to do this very explicit hack right now until other use cases show up.
Reviewed By: niteria
Differential Revision: D5325369
fbshipit-source-id: aec0402
Summary:
This PR contains various smaller but - at least on my data - important performance improvements for matching of German time and time range expressions.
I evaluated this on approx 11.000 time and time range expressions taken from emails (rather formal business travel requests) that have been manually annotated with the "true" time. Comparing this branch to the current master (`d6f8dd`) I get e.g. approx. 80% of the duckling results within +/- 1h of the true value (hours are the smallest grain in my data), vs. only 70% in the master. Other indicators I checked (time/range confusion, other thresholds, failures to find anything in the first place, etc.) were all improved as well.
**Changes**:
* [significant performance plus] added a rule `ruleDateDateInterval` that handles variations of "13.-15.10." correctly. Here the common case is that "13." refers to "13.10." and not "13.CURRENTMONTH". I didn't see an obvious way to fix that in the `<datetime> - <datetime>` rule.
* [significant performance plus] In `ruleMmdd` (which matches expressions like "13.03." in German), I made the last dot optional. At least in less formal text this is quite common to be forgotten. Also here and in `ruleDateDateInterval` I changed the order of the terms in the regular expression matching the month to prefer matching e.g. "10" over matching "1"+"no dot".
* [minor] treat "14/15Uhr" the same as "14-15Uhr"
* [minor] Extended "bis" to also match "bis zum" and "auf den" (e.g. in "von Montag bis zum Freitag" or "von Dienstag auf Mittwoch")
* [minor] Changed `hh:mm` matching to also get the rather esoteric expression "17h00" - should do no harm.
Closes https://github.com/facebookincubator/duckling/pull/54
Reviewed By: blandinw
Differential Revision: D5301815
Pulled By: patapizza
fbshipit-source-id: 8766caf
Summary:
e.g. "New York from 10-6 to 10-22" currently extracts: HH-MM. Instead, it should extract mm-dd i.e. October 10th to October 22nd.
Closes https://github.com/facebookincubator/duckling/pull/48
Reviewed By: niteria
Differential Revision: D5292473
Pulled By: patapizza
fbshipit-source-id: 04f1a4b