Commit Graph

37 Commits

Author SHA1 Message Date
Dmitry Vinnik
881d189d4b docs: add GH button in support of Ukraine (#687)
Summary:
Our mission at Meta Open Source is to empower communities through open source, and we believe that it means building a welcoming and safe environment for all. As a part of this work, we are adding this banner in support for Ukraine during this crisis.

Pull Request resolved: https://github.com/facebook/duckling/pull/687

Reviewed By: haoxuany

Differential Revision: D34630898

Pulled By: dmitryvinn-fb

fbshipit-source-id: 0b8a20d4eb2357319e021ee23e29460e80d0dbbc
2022-03-04 19:18:57 -08:00
Kantanat Wannapaka
a0c8a60975 Fix image link, add link to license & linting (fix-cla) (#675)
Summary:
This is documentation changes.
 _Note: This version is misname cla error_

- [x] Fix image link from master <https://github.com/facebook/duckling/raw/master/logo.png> to <https://github.com/facebook/duckling/raw/main/logo.png>

- [x] Add language to code fences
- [x] Add link to LICENSE file

Pull Request resolved: https://github.com/facebook/duckling/pull/675

Reviewed By: patapizza

Differential Revision: D33477985

Pulled By: stroxler

fbshipit-source-id: 52e4ad2546bd5e0d5799d3a876063f78dd919b16
2022-01-10 12:01:03 -08:00
Daniel Cartwright
84175d61d6 Specify that you need to install PCRE headers on linux as well
Summary: Some users have been confused by this in the past.

Reviewed By: stroxler

Differential Revision: D30685469

fbshipit-source-id: a4c190a4a2bc0c02cd9711422934bde27f9ec116
2021-08-31 17:20:43 -07:00
chessai
99e1dce9c4 restrict dimensions to only those specified (#625)
Summary:
Resolves https://github.com/facebook/duckling/issues/624

Before patch (specifying quantity and numeral, but time still shows up):
```
❯ curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_US&text="June 21 and 3 cups of sugar"&dims="[\"quantity\",\"numeral\"]"' | jq
[
  {
    "body": "June 21",
    "start": 1,
    "value": {
      "values": [
        {
          "value": "2021-06-21T00:00:00.000-07:00",
          "grain": "day",
          "type": "value"
        },
        {
          "value": "2022-06-21T00:00:00.000-07:00",
          "grain": "day",
          "type": "value"
        },
        {
          "value": "2023-06-21T00:00:00.000-07:00",
          "grain": "day",
          "type": "value"
        }
      ],
      "value": "2021-06-21T00:00:00.000-07:00",
      "grain": "day",
      "type": "value"
    },
    "end": 8,
    "dim": "time",
    "latent": false
  },
  {
    "body": "3 cups of sugar",
    "start": 13,
    "value": {
      "value": 3,
      "type": "value",
      "product": "sugar",
      "unit": "cup"
    },
    "end": 28,
    "dim": "quantity",
    "latent": false
  }
]
```

After patch (time no longer shows up):
```
❯ curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_US&text="June 21 and 3 cups of sugar"&dims="[\"quantity\",\"numeral\"]"' | jq
[
  {
    "body": "3 cups of sugar",
    "start": 13,
    "value": {
      "value": 3,
      "type": "value",
      "product": "sugar",
      "unit": "cup"
    },
    "end": 28,
    "dim": "quantity",
    "latent": false
  }
]
```

Pull Request resolved: https://github.com/facebook/duckling/pull/625

Reviewed By: stroxler

Differential Revision: D28851759

Pulled By: chessai

fbshipit-source-id: d3b3f33092c7e60bf29886939488ed562a213c35
2021-06-03 10:33:42 -07:00
Mustafa ALP
5385346e69 Update README.md (#585)
Summary:
Convert `This` to `Seal` in order to make this example working.

Pull Request resolved: https://github.com/facebook/duckling/pull/585

Reviewed By: girifb

Differential Revision: D27235685

Pulled By: chessai

fbshipit-source-id: 71a712a622b5d9d10f7842276a2b8f60f962477e
2021-03-26 14:33:53 -07:00
Daniel Cartwright
17f11135f2 Document how to pass dimensions to the example application
Summary: External users are repeatedly confused by lack of results from the duckling example executable. We should just go through all dimensions for the duckling call in the example app.

Reviewed By: patapizza

Differential Revision: D25468199

fbshipit-source-id: 6cf56b130d4d0aa3181f098d6a7c9a133bfa85ff
2020-12-14 15:02:37 -08:00
Amit Manchanda
e38a852138 Update: add new dimension to a language
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/384

Reviewed By: patapizza

Differential Revision: D16150013

Pulled By: haoxuany

fbshipit-source-id: 5ef22efb84120337749dd29c3d33d507502c3e4c
2019-07-09 15:21:34 -07:00
Julien Odent
bf89e34365 Relicense to BSD3
Reviewed By: JoelMarcey

Differential Revision: D15439223

fbshipit-source-id: c5af3cb06318748142fe503945b38beffadfc28a
2019-05-22 10:46:39 -07:00
Julien Odent
b6878b1b64 Adding CreditCardNumber to README
Summary: as title

Reviewed By: haoxuany

Differential Revision: D13605870

fbshipit-source-id: dee587bef35b8a27fcc9a73d3a3114d18b2ce3ac
2019-01-09 10:31:11 -08:00
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