facebook/duckling được TopGit xếp vào nhóm dự án mã nguồn mở, với 4.3k sao trên GitHub, viết chủ yếu bằng Haskell. Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Duckling is a Haskell library that parses text into structured data.
"the first Tuesday of October"
=> {"value":"2017-10-03T00:00:00.000-07:00","grain":"day"}
Requirements
A Haskell environment is required. We recommend using
stack.
On Linux and MacOS you'll need to install PCRE development headers. On Linux,
use your package manager to install them. On MacOS, the easiest way to install
them is with Homebrew:
brew install pcre
If that doesn't help, try running brew doctor and fix the issues it finds.
Quickstart
To compile and run the binary:
stack build
stack exec duckling-example-exe
The first time you run it, it will download all required packages.
This runs a basic HTTP server. Example request:
curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_GB&text=tomorrow at eight'
In the example application, all dimensions are enabled by default. Provide the
parameter dims to specify which ones you want. Examples:
Identify credit card numbers only:
$ curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_US&text="4111-1111-1111-1111"&dims="["credit-card-number"]"'
If you want multiple dimensions, comma-separate them in the array:
$ curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_US&text="3 cups of sugar"&dims="["quantity","numeral"]"'
See exe/ExampleMain.hs for an example on how to integrate Duckling in your
project. If your backend doesn't run Haskell or if you don't want to spin your
own Duckling server, you can directly use wit.ai's built-in
entities.
Supported dimensions
Duckling supports many languages, but most don't support all dimensions yet
(we need your help!). Please look into
this directory
for language-specific support.
To regenerate the classifiers and run the test suite:
stack build :duckling-regen-exe && stack exec duckling-regen-exe && stack test
It's important to regenerate the classifiers after updating the code and before
running the test suite.
To extend Duckling's support for a dimension in a given language, typically 4
files need to be updated:
Duckling/<Dimension>/<Lang>/Rules.hs
Duckling/<Dimension>/<Lang>/Corpus.hs
Duckling/Dimensions/<Lang>.hs (if not already present in
Duckling/Dimensions/Common.hs)
Duckling/Rules/<Lang>.hs
To add a new language:
Make sure that the language code used follows the
ISO-639-1 standard.
The first dimension to implement is Numeral.
Follow
this example.
To add a new locale:
There should be a need for diverging rules between the locale and the
language.
Make sure that the locale code is a valid
ISO3166 alpha2 country code.
Follow
this example.
Rules have a name, a pattern and a production. Patterns are used to perform
character-level matching (regexes on input) and concept-level matching
(predicates on tokens). Productions are arbitrary functions that take a list of
tokens and return a new token.
The corpus (resp. negative corpus) is a list of examples that should (resp.
shouldn't) parse. The reference time for the corpus is Tuesday Feb 12, 2013 at
4:30am.
Duckling.Debug provides a few debugging tools:
$ stack repl --no-load
> :l Duckling.Debug
> debug (makeLocale EN $ Just US) "in two minutes" [Seal Time]
in|within|after <duration> (in two minutes)
-- regex (in)
-- <integer> <unit-of-duration> (two minutes)
-- -- integer (0..19) (two)
-- -- -- regex (two)
-- -- minute (grain) (minutes)
-- -- -- regex (minutes)
[Entity {dim = "time", body = "in two minutes", value = RVal Time (TimeValue (SimpleValue (InstantValue {vValue = 2013-02-12 04:32:00 -0200, vGrain = Second})) [SimpleValue (InstantValue {vValue = 2013-02-12 04:32:00 -0200, vGrain = Second})] Nothing), start = 0, end = 14}]
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/facebook/duckling là nguồn chính thức.
facebook/duckling có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho facebook/duckling. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
facebook/duckling là gì?
facebook/duckling (facebook/duckling) là dự án Haskell trên GitHub. Theo mô tả gốc: Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về duckling?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về duckling.