mirror of
https://github.com/facebook/duckling.git
synced 2024-11-29 01:03:44 +03:00
Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
003604dce7
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 |
||
---|---|---|
Duckling | ||
CONTRIBUTING.md | ||
duckling.cabal | ||
ExampleMain.hs | ||
LICENSE | ||
PATENTS | ||
README.md | ||
RegenMain.hs | ||
stack.yaml | ||
TestMain.hs |
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.