Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Go to file
Bartosz Nitka 003604dce7 Optimize simple time predicates
Summary:
This is the next step for:
https://fb.facebook.com/groups/527352907463243/permalink/600056483526218/

This:
* changes the time language to be able to track contradictions (`EmptyPredicate`)
* changes the time language to be able to collect non-contradicting pieces, like month and hour and unify them
* provides an efficient way to convert those pieces into (past,future) time series
* adds AMPM predicate runner - there's a bit of overlap with is12H, but it basically works
* changes a test case that was wrong before
* regenerates classifiers, I'm not sure why they changed exactly

Before:
```
res <- H.io $ let sentence = "10am thurs 4.30 thurs 12pm sat" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(15.50 secs, 6,171,188,928 bytes)

res <- H.io $ let sentence = "I have 9 am 12 pm 1 pm 2pm 4 pm 3 pm on Saturday" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(110.82 secs, 44,031,569,512 bytes)
```

After:
```
res <- H.io $ let sentence = "10am thurs 4.30 thurs 12pm sat" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(1.24 secs, 703,020,912 bytes)

res <- H.io $ let sentence = "I have 9 am 12 pm 1 pm 2pm 4 pm 3 pm on Saturday" in (debugTokens sentence $ analyze sentence (testContext {lang = EN}) HashSet.empty)
(9.51 secs, 5,891,109,592 bytes)
```

Reviewed By: JonCoens

Differential Revision: D4676812

fbshipit-source-id: 9810203
2017-03-13 17:04:10 -07:00
Duckling Optimize simple time predicates 2017-03-13 17:04:10 -07:00
CONTRIBUTING.md CONTRIBUTING.md 2017-03-10 14:49:18 -08:00
duckling.cabal Make the license field more precise 2017-03-13 06:04:10 -07:00
ExampleMain.hs Initial commit 2017-03-08 10:33:56 -08:00
LICENSE Initial commit 2017-03-08 10:33:56 -08:00
PATENTS Initial commit 2017-03-08 10:33:56 -08:00
README.md README.md + updating cabal 2017-03-10 15:04:23 -08:00
RegenMain.hs Initial commit 2017-03-08 10:33:56 -08:00
stack.yaml Initial commit 2017-03-08 10:33:56 -08:00
TestMain.hs Initial commit 2017-03-08 10:33:56 -08:00

Duckling

Duckling is a Haskell library that parses text into structured data.

Requirements

A Haskell environment is required. We recommend using stack.

Quickstart

To compile and run the binary:

$ stack build
$ stack exec duckling-example-exec

The first time you run it, it will download all required packages.

To run a source file directly (after compiling once):

$ stack ExampleMain.hs

See ExampleMain.hs for an example on how to integrate Duckling in your project.

To regenerate the classifiers and run the tests:

$ stack RegenMain.hs && stack TestMain.hs

License

Duckling is BSD-licensed. We also provide an additional patent grant.