Commit Graph

28 Commits

Author SHA1 Message Date
Julien Odent
8325fc0c5e README: custom dimensions and updated new lang instructions
Summary: .

Reviewed By: haoxuany

Differential Revision: D7937075

fbshipit-source-id: 3ae51e893773ca75cdd31e5c9bfde78077447f1b
2018-05-09 15:15:29 -07:00
Ziyang Liu
a3b35880e5 Change value in Entity to typed value instead of JSON
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
2018-04-20 14:18:47 -07:00
Mateusz Kwapich
c875ffbce6 test commit
fbshipit-source-id: 42e3e4df7f8ea21241b5706338d8f3b456e4cf05
2018-03-06 05:00:29 -08:00
Mateusz Kwapich
ed7eeb4cad test commit
fbshipit-source-id: 7b1864d58dbcf5454b8576ff1e4df6aef93f7647
2018-03-06 05:00:29 -08:00
Julien Odent
cc7cf74ff4 New locale instruction
Summary: to be more specific

Reviewed By: blandinw

Differential Revision: D6391421

fbshipit-source-id: 5c8e34b7a072ad2820a064c66a2364e866147630
2017-11-22 17:02:55 -08:00
Julien Odent
98ff268918 Point to language-specific support in README
Summary: Highlights opportunities.

Reviewed By: JonCoens

Differential Revision: D6312814

fbshipit-source-id: dfa1f9a6bf6d83d7dfc69b88209a7242ad2f4aef
2017-11-13 10:00:37 -08:00
Julien Odent
277895193f Link to wit.ai in README
Summary:
Suggest to use wit.ai's built-in entities if running Duckling is not
an option.

Reviewed By: JonCoens

Differential Revision: D6312789

fbshipit-source-id: 08f1c5759cdd7761b456914cd5c42e1c111c6408
2017-11-13 10:00:37 -08:00
Julien Odent
87c875f1e5 Fix Travis links in README
Summary: We've graduated from `facebookincubator` to `facebook`.

Reviewed By: JonCoens

Differential Revision: D6272667

fbshipit-source-id: d433c8f1417d94f703fc455a466be64253ed85b8
2017-11-08 10:00:36 -08:00
Ilya Murzinov
5c390c6cc7 Fixed example in readme
Summary: Closes https://github.com/facebookincubator/duckling/pull/93

Differential Revision: D6065706

Pulled By: patapizza

fbshipit-source-id: e9ef61b
2017-10-16 11:04:25 -07:00
Julien Odent
ab0ad0256e Locales support
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
2017-10-13 08:34:21 -07:00
Julien Odent
b5e646d8f6 New language instructions
Summary: Updated `README.md` with instructions on how to add a new language in Duckling.

Reviewed By: JonCoens

Differential Revision: D5712523

fbshipit-source-id: 6f5eda0
2017-08-25 17:34:26 -07:00
Julien Odent
7364955b35 Add lang to Quickstart
Summary: Fixes #77.

Reviewed By: JonCoens

Differential Revision: D5574087

fbshipit-source-id: 46ccf86
2017-08-07 10:04:26 -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
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
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
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
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
78228dea83 Update email
Summary: Setup the correct email.

Reviewed By: JonCoens

Differential Revision: D4806876

fbshipit-source-id: a52f9f8
2017-03-30 16:20:08 -07:00
Bartosz Nitka
a1917a53f3 Make sure regen is rebuilt
Summary:
`stack exe/RegenMain.hs` uses runghc which is a tool
we don't test with often. Making sure the executable
is rebuilt and using it should be enough.

Reviewed By: patapizza

Differential Revision: D4783844

fbshipit-source-id: 459dbc4
2017-03-28 07:49:19 -07:00
Bartosz Nitka
bd94622f64 Move tests to tests and exes to exe
Summary:
This works around https://github.com/haskell/cabal/issues/4350
If we don't do this files get compiled multiple times
and cabal is unhappy.

Reviewed By: patapizza

Differential Revision: D4782749

fbshipit-source-id: 5bbe425
2017-03-27 16:04:24 -07:00
Julien Odent
e76cee3a6d Rename Finance to AmountOfMoney
Summary: Because it makes more sense.

Reviewed By: JonCoens

Differential Revision: D4721646

fbshipit-source-id: 449bfb4
2017-03-16 14:49:44 -07:00
Julien Odent
1c98c0308c Fix Some in README
Summary: #accept2ship

Reviewed By: niteria

Differential Revision: D4715804

fbshipit-source-id: d53ca9a
2017-03-15 13:19:36 -07:00
Julien Odent
1edf62f347 Adding logo
Summary: happy_duck

Reviewed By: niteria

Differential Revision: D4713395

fbshipit-source-id: dd1c141
2017-03-15 08:04:31 -07:00
Jonathan Coens
1b91b70c58 codemod DNumber to Numeral
Summary: `DNumber` is a terrible name and was only there because legacy. `Numeral` makes more sense for this dimension, so let's use that instead.

Reviewed By: patapizza

Differential Revision: D4707167

fbshipit-source-id: cd78aa3
2017-03-14 13:34:11 -07:00
Julien Odent
2f4ecfba08 Update README
Summary: Doc to extend existing dimension/language support

Reviewed By: JonCoens

Differential Revision: D4706035

fbshipit-source-id: a8ecca4
2017-03-14 11:34:11 -07:00
Julien Odent
161889c3e6 README.md + updating cabal
Summary:
* basic `README.md`
* updated `duckling.cabal`

Reviewed By: JonCoens

Differential Revision: D4691967

fbshipit-source-id: 0a5cdf7
2017-03-10 15:04:23 -08:00
FBShipIt
3f8e52e70a Initial commit
fbshipit-source-id: 301a10f448e9623aa1c953544f42de562909e192
2017-03-08 10:33:56 -08:00