Commit Graph

123 Commits

Author SHA1 Message Date
Julien Odent
486ab645fc Quantity to accept any product for English
Summary:
* accepts any word besides meat/sugar
* allow for grams

Reviewed By: blandinw

Differential Revision: D5197073

fbshipit-source-id: f58aa54
2017-06-09 09:34:20 -07:00
Anand Bhaskar
b8277411e7 Refactor rule 'number.number hours'
Summary: Created a helper for the rule to reuse across languages.

Reviewed By: patapizza

Differential Revision: D5189741

fbshipit-source-id: 7b4dcd4
2017-06-06 09:34:22 -07:00
Heejin (macbook)
9a49b7652b KO/Time: Fix typo
Summary:
Found a common mistake.
Closes https://github.com/facebookincubator/duckling/pull/38

Reviewed By: niteria

Differential Revision: D5182189

Pulled By: patapizza

fbshipit-source-id: 182a325
2017-06-05 08:49:21 -07:00
Şeref R.Ayar
ba26ca7e91 Volume for TR
Summary: Closes https://github.com/facebookincubator/duckling/pull/34

Reviewed By: niteria

Differential Revision: D5168380

Pulled By: patapizza

fbshipit-source-id: 31d0a11
2017-06-02 12:49:20 -07:00
Julien Odent
4a1741528c Expose fromZonedTime
Summary: See #37

Reviewed By: JonCoens

Differential Revision: D5172801

fbshipit-source-id: bf63303
2017-06-02 11:19:30 -07:00
Şeref R.Ayar
b69874cd9f Duration for TR
Summary: Closes https://github.com/facebookincubator/duckling/pull/32

Reviewed By: niteria

Differential Revision: D5150778

Pulled By: patapizza

fbshipit-source-id: d156b0a
2017-05-31 02:19:40 -07:00
chao pan
292a94128f Generalize mm/dd rules to accept spaces like '05 / 27', '05/ 27'
Summary:
The existing "mm/dd" rules only accepts format like "05/27"; However, in practice there might be extra spaces like "05 / 27", "05/ 27". The pull requests tweaks the regex to accept extra space.
Closes https://github.com/facebookincubator/duckling/pull/31

Reviewed By: niteria

Differential Revision: D5147118

Pulled By: patapizza

fbshipit-source-id: f6a5069
2017-05-30 09:49:55 -07:00
serefayar
92a3e16886 Temperature for TR
Summary: Closes https://github.com/facebookincubator/duckling/pull/30

Reviewed By: niteria

Differential Revision: D5147114

Pulled By: patapizza

fbshipit-source-id: 804f623
2017-05-30 09:34:17 -07:00
kkpoon
001ff291fc Add Cantonese support to date time into ZH
Summary:
Add the [Cantonese](https://en.wikipedia.org/wiki/Cantonese) (the official spoken language used in Hong Kong) support to date time

- updated Duration ZH corpus
- updated Time ZH rules and corpus
- updated TimeGrain ZH rules
Closes https://github.com/facebookincubator/duckling/pull/24

Reviewed By: patapizza

Differential Revision: D5143947

Pulled By: niteria

fbshipit-source-id: 9107d05
2017-05-30 07:49:19 -07:00
Mohankumar Dhayalan
21c9b8ed7a HashMap lookups for large regexes
Summary: Added Hashmap lookups for Regex for Numeral/ID

Reviewed By: patapizza

Differential Revision: D5128492

fbshipit-source-id: 5ab928b
2017-05-25 11:04:18 -07:00
Şeref R.Ayar
69ce841710 Comma as decimal mark for Numeral TR
Summary: Closes https://github.com/facebookincubator/duckling/pull/28

Differential Revision: D5120967

Pulled By: patapizza

fbshipit-source-id: 41a5e4b
2017-05-24 09:04:17 -07:00
Şeref R.Ayar
6de7c2142b Distance for TR
Summary: Closes https://github.com/facebookincubator/duckling/pull/26

Reviewed By: niteria

Differential Revision: D5112142

Pulled By: patapizza

fbshipit-source-id: d71f654
2017-05-23 10:49:18 -07:00
rfranek@email.cz
b64f72eb19 updated Distance for CS
Summary: Closes https://github.com/facebookincubator/duckling/pull/25

Reviewed By: niteria

Differential Revision: D5111890

Pulled By: patapizza

fbshipit-source-id: 2b69c0c
2017-05-23 09:04:22 -07:00
Eli Sadoff
bde1e07928 Correct cents to pence for GBP
Summary:
GBP are broken up into 100 pence (or p) but not cents.
Closes https://github.com/facebookincubator/duckling/pull/3

Reviewed By: niteria

Differential Revision: D5102940

Pulled By: patapizza

fbshipit-source-id: 1462440
2017-05-23 08:04:21 -07:00
Magnus Burton
9a21c53a7b Updated Swedish time
Summary:
Added `vid` to allow for sentences like `vid kl. 12` (-> `by 12 O'clock`)
Closes https://github.com/facebookincubator/duckling/pull/22

Differential Revision: D5105205

Pulled By: patapizza

fbshipit-source-id: 405575d
2017-05-22 12:49:28 -07:00
Julien Odent
4ed89d29de DE/Time: Convert unicode char to hexadecimal
Summary: I missed that one.

Reviewed By: niteria

Differential Revision: D5079134

fbshipit-source-id: 2eacbea
2017-05-18 08:04:45 -07:00
Ramtin Seraj
9b9f837e94 Adding dockerfile for the http server
Summary: Closes https://github.com/facebookincubator/duckling/pull/20

Differential Revision: D5078813

Pulled By: patapizza

fbshipit-source-id: a8f95ff
2017-05-17 10:19:44 -07:00
Sebastian Mika
39cb76024b Smaller improvements to DE about/before/after
Summary:
* In DE `frühestens` and `spätestens` act implicitly as `nach` and `vor` (after and before) on times and may also appear after the time

* The rule `ruleTimeofdayTimeofdayInterval` does match `9Uhr-10` but not the
way more common expression `9-10Uhr`; added the same rule with the
second time as non-latent; actually I am not sure whether the original
rule makes sense at all

* Simple extension of `intersect by ,` to THE formal way in DE to express
a date (i.e. `Freitag, der 13.03.2013`)

General remark: I used UTF-8 characters albeit I saw that the other rules and examples use escaped hex encoding for e.g. German umlaute. If there is any reason to do that (it is not very readable), I will of course change that.
Closes https://github.com/facebookincubator/duckling/pull/19

Reviewed By: niteria

Differential Revision: D5070052

Pulled By: patapizza

fbshipit-source-id: 990ad08
2017-05-17 10:19:44 -07:00
Sebastian Mika
b00e5faeac Fix DE numerical ordinal matching
Summary:
The numerical ordinal matching rule in DE is too broad. An ordinal like "1." may not be proceeded or followed by numbers.

* Added negative lookbehind - avoids matching the first "1." in "1.1" as an ordinal.
* Added negative lookahead - avoids matching the second "1." in "1.1. as an ordinal
Closes https://github.com/facebookincubator/duckling/pull/18

Reviewed By: patapizza

Differential Revision: D5069200

Pulled By: niteria

fbshipit-source-id: 0583076
2017-05-16 09:49:21 -07:00
rfranek@email.cz
325fa69304 added Distance for CZ language
Summary:
Added first Czech language file
Closes https://github.com/facebookincubator/duckling/pull/16

Reviewed By: niteria

Differential Revision: D5044499

Pulled By: patapizza

fbshipit-source-id: c736a35
2017-05-12 08:19:20 -07:00
Julien Odent
3b64603d81 Don't allow 0 as fraction denominator
Summary:
"1/0" was returning "null" -- this is not a valid fraction.
Now "1/0" returns 2 Numeral.

Reviewed By: niteria

Differential Revision: D5037579

fbshipit-source-id: 70fa4c9
2017-05-11 12:04:20 -07:00
Julien Odent
37829902b7 CS: Setup + basic Numeral
Summary:
* Setup for Czech
* Basic `Numeral` (0-10 integers + digits) from http://www.omniglot.com/language/numbers/czech.htm

Reviewed By: JonCoens

Differential Revision: D5044775

fbshipit-source-id: b5cd9d2
2017-05-11 09:49:27 -07:00
Bartosz Nitka
0cd42e9a32 Steps for using Duckling.Debug
Summary:
It's not quite clear how to use `Duckling.Debug` now,
see #17

Reviewed By: patapizza

Differential Revision: D5044254

fbshipit-source-id: 09f83cd
2017-05-11 07:34:22 -07:00
Bartosz Nitka
61e93fade5 Remove RebindableSyntax
Summary:
We don't use it and it breaks `stack repl --no-load` with:
```
<interactive>:1:6: error: Not in scope: ‘>>’

<interactive>:1:70: error: Not in scope: ‘>>’

<interactive>:1:135: error: Not in scope: ‘return’
```

I need this for #17

Reviewed By: simonmar

Differential Revision: D5044232

fbshipit-source-id: fce955c
2017-05-11 06:19:27 -07:00
Bartosz Nitka
cdd2f1c9cb Don't produce empty tokens from interval
Summary:
This is analogous to
[Duckling] Don't produce trivially empty Tokens
but that change did that for intersect, this one
deals with interval.

Reviewed By: patapizza

Differential Revision: D5039215

fbshipit-source-id: 95bd821
2017-05-10 16:04:22 -07:00
Bartosz Nitka
3650a5b5d1 Disallow nested intervals
Summary:
We already disallowed shallowly-nested intervals.
Interval of an intersection of an interval also seems
unlikely to produce anything useful.

For an input like:
"2016-Jul-29 07:00 - 2016-Jul-29 09:00 UTC"
it goes from:
```
(1.77 secs, 1,095,200,736 bytes)
```
to:
```
(1.33 secs, 857,167,480 bytes)
```
That's -25% time and -22% allocations.

Reviewed By: patapizza

Differential Revision: D5037492

fbshipit-source-id: 481dcdd
2017-05-10 12:04:18 -07:00
Bartosz Nitka
cb047b2f9d Smart constructor for mkEmptyPredicate
Summary:
I've found it useful for debugging to find out where
the EmptyPredicates are coming from.
This allows to change the code to track origin with minimal
amount of change.

One interesting subtlety is that we don't want to
create a new EmptyPredicate if one already exists

Reviewed By: patapizza

Differential Revision: D5037299

fbshipit-source-id: e2a2f5d
2017-05-10 11:04:20 -07:00
Bartosz Nitka
62f4d71454 Show for Predicate
Summary:
I find it useful for debugging and adding it in
every debugging session is getting old.

Reviewed By: JonCoens

Differential Revision: D5037181

fbshipit-source-id: 7804cc5
2017-05-10 10:34:17 -07:00
Matt Schultz
ff9b54ad43 Added English fractional Numeral rule (ex: "3/4", "1/2", "5/7")
Summary:
Also added real-world test to English `Quantity` corpus ("3/4 cup", as a culinary example)
Closes https://github.com/facebookincubator/duckling/pull/14

Reviewed By: patapizza

Differential Revision: D5035990

Pulled By: niteria

fbshipit-source-id: c1b8f65
2017-05-10 07:04:16 -07:00
Matt Schultz
e0d48b08a3 Expanded english matching rules for miles and inches
Summary:
Adds canonical abbreviation matching rules for miles ("mi",) and inches (" and "in".)
Closes https://github.com/facebookincubator/duckling/pull/11

Differential Revision: D5035991

Pulled By: niteria

fbshipit-source-id: 3a0c423
2017-05-10 06:49:33 -07:00
Bartosz Nitka
9e88e95faa More instructions for pcre on macOS
Summary:
Turns out that `brew` can succeed installing `pcre`, but still
not install development headers in `/usr/local/include/`
if that path is not writable. `brew doctor` should find that
and related problems.

Relevant ticket: #8

Reviewed By: patapizza, JonCoens

Differential Revision: D5031503

fbshipit-source-id: ba0b8e8
2017-05-09 14:34:21 -07:00
Bartosz Nitka
9ee46831da license-file: vs license-files:
Summary: Doh

Reviewed By: JonCoens

Differential Revision: D5011285

fbshipit-source-id: 8e980eb
2017-05-05 10:34:22 -07:00
Bartosz Nitka
46191fdcb8 Fix license spec in the .cabal file
Reviewed By: JonCoens

Differential Revision: D5011092

fbshipit-source-id: 432fe48
2017-05-05 09:52:09 -07:00
Bartosz Nitka
3cc5d85ebd Add a travis script
Summary:
This adds a travis script, so that we get feedback when
we push or on pull requests.

It builds and runs tests.

We currently only test with GHC 8.0.2, other versions
are broken for reasons given in the script.

I relaxed the version of `time` in preparation for GHC 8.2.

It also adds an icon in the README.md

Reviewed By: JonCoens

Differential Revision: D5002255

fbshipit-source-id: 47ff3af
2017-05-04 09:19:16 -07:00
Bartosz Nitka
d171c547dd Remove redundant constraints in .cabal
Summary: See title.

Reviewed By: JonCoens

Differential Revision: D5002238

fbshipit-source-id: 0de239c
2017-05-04 09:19:16 -07:00
Bartosz Nitka
6327b614f9 Add instructions about PCRE for macOS
Summary: This should resolve #8 and #6.

Reviewed By: xich

Differential Revision: D5000220

fbshipit-source-id: b713931
2017-05-03 18:04:19 -07:00
Matteo
e11014dc4b Volume for IT lang
Summary:
I notice that there are several missing dimensions for the IT language: this patch is for the Volume dimension

Regards
Matteo
Closes https://github.com/facebookincubator/duckling/pull/4

Reviewed By: JonCoens

Differential Revision: D4986389

Pulled By: patapizza

fbshipit-source-id: 314d33e
2017-05-02 11:19:14 -07:00
Noon van der Silk
88639e8a56 fix default port in doc
Summary:
when you run as-is it it launches on 8000 not 8080
Closes https://github.com/facebookincubator/duckling/pull/1

Differential Revision: D4981822

Pulled By: patapizza

fbshipit-source-id: 3352a80
2017-05-02 07:34:25 -07:00
Julien Odent
e85d2f507c README nits
Summary:
* moved `AmountOfMoney` up for alphabetical order
* added example request for HTTP server example

Reviewed By: JonCoens

Differential Revision: D4978108

fbshipit-source-id: e98de49
2017-05-01 09:19:18 -07:00
Julien Odent
1c3ccf671f Remove redundant duration rules
Summary: This rule was already present (in `Duckling/Duration/Rules.hs`).

Reviewed By: niteria

Differential Revision: D4956233

fbshipit-source-id: 9e8ca64
2017-04-28 11:34:40 -07:00
Julien Odent
d3d3703015 HE: Time
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
2017-04-28 10:04:35 -07:00
Julien Odent
ab2c89df4f IT: Temperature
Summary: Temperature dimension for Italian.

Reviewed By: JonCoens

Differential Revision: D4970338

fbshipit-source-id: 024802e
2017-04-28 10:04:35 -07:00
Bartosz Nitka
74936df848 Make matching anywhere vs at pos obvious
Summary:
This change refactors the Engine to use a different
code path for when we're calling `lookupItem` to find
a first token `Node` matching the rule and a different
one for subsequent ones.

This division lets us get better invariants and more importantly
do full text regexp matches only when necessary.

This should be particularly useful for longer texts.

Reviewed By: patapizza

Differential Revision: D4953918

fbshipit-source-id: e3a69ad
2017-04-28 09:19:20 -07:00
Julien Odent
9269727617 PT: Bring latest changes
Summary: * PhoneNumber: support for "ramal" as extension keyword

Reviewed By: niteria

Differential Revision: D4959209

fbshipit-source-id: cd12c1f
2017-04-28 08:04:22 -07:00
Julien Odent
5ba2c9e9a1 NB: Bringing latest changes
Summary:
* Numeral: fixed "hundre" (not "hundred")
* Numeral: added "tretti", "søtti"
* Time: updated last times to support "sist"
* Time: christmas days

Reviewed By: niteria

Differential Revision: D4958919

fbshipit-source-id: e4eecf5
2017-04-28 08:04:22 -07:00
Julien Odent
2182d94edb Bring latest updates for ID
Summary: * added one example in `AmountOfMoney`

Reviewed By: niteria

Differential Revision: D4958635

fbshipit-source-id: c70ce7c
2017-04-28 08:04:22 -07:00
Julien Odent
3f40625339 Temperature for Croatian
Summary: Temperature dimension for Croatian

Reviewed By: niteria

Differential Revision: D4958590

fbshipit-source-id: fe6c2e4
2017-04-28 08:04:22 -07:00
Julien Odent
3cc3266e28 Quantity for Croatian
Summary: Quantity dimension for Croatian.

Reviewed By: niteria

Differential Revision: D4958501

fbshipit-source-id: b90c8f6
2017-04-28 08:04:22 -07:00
Julien Odent
0372f4f3da Volume for Croatian
Summary: Volume dimension for Croatian

Reviewed By: niteria

Differential Revision: D4957186

fbshipit-source-id: 63012ad
2017-04-28 08:04:22 -07:00
Julien Odent
0aa4aa56bb Distance for Croatian
Summary: Distance dimension for Croatian.

Reviewed By: niteria

Differential Revision: D4957067

fbshipit-source-id: 232ce30
2017-04-28 08:04:21 -07:00