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
This commit is contained in:
Julien Odent 2017-10-13 08:15:32 -07:00 committed by Facebook Github Bot
parent ddefc949e2
commit ab0ad0256e
247 changed files with 6954 additions and 1474 deletions

View File

@ -8,18 +8,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.BG.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.Lang
import Duckling.AmountOfMoney.Types
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = BG}, allExamples)
corpus = (testContext {locale = makeLocale BG Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,10 +9,11 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.EN.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Testing.Types

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.ES.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ES}, allExamples)
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.FR.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = FR}, allExamples)
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.GA.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = GA}, allExamples)
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -8,18 +8,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.HR.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.Lang
import Duckling.AmountOfMoney.Types
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HR}, allExamples)
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.ID.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ID}, allExamples)
corpus = (testContext {locale = makeLocale ID Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.KO.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = KO}, allExamples)
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.NB.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = NB}, allExamples)
corpus = (testContext {locale = makeLocale NB Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.PT.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = PT}, allExamples)
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.RO.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = RO}, allExamples)
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.SV.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = SV}, allExamples)
corpus = (testContext {locale = makeLocale SV Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.VI.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.AmountOfMoney.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = VI}, allExamples)
corpus = (testContext {locale = makeLocale VI Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -17,18 +17,18 @@ module Duckling.Api
) where
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HashMap
import Data.HashSet (HashSet)
import qualified Data.HashSet as HashSet
import Data.Text (Text)
import qualified Data.Text as Text
import Prelude
import TextShow
import qualified Data.HashMap.Strict as HashMap
import qualified Data.HashSet as HashSet
import qualified Data.Text as Text
import Duckling.Dimensions.Types
import Duckling.Dimensions
import Duckling.Engine
import Duckling.Lang
import Duckling.Locale
import Duckling.Ranking.Classifiers
import Duckling.Ranking.Rank
import Duckling.Resolve
@ -47,11 +47,11 @@ supportedDimensions =
-- When `targets` is non-empty, returns only tokens of such dimensions.
analyze :: Text -> Context -> HashSet (Some Dimension) -> [ResolvedToken]
analyze input context@Context{..} targets =
rank (classifiers lang) targets
rank (classifiers locale) targets
. filter (\(Resolved{node = Node{token = (Token d _)}}) ->
HashSet.null targets || HashSet.member (This d) targets
)
$ parseAndResolve (rulesFor lang targets) input context
$ parseAndResolve (rulesFor locale targets) input context
-- | Converts the resolved token to the API format
formatToken :: Text -> ResolvedToken -> Entity

View File

@ -12,16 +12,20 @@
module Duckling.Core
( Context(..)
, Region(..)
, Dimension(..)
, fromName
, Entity(..)
, Lang(..)
, Locale
, Some(..)
, fromName
, makeLocale
, toName
-- Duckling API
, parse
, supportedDimensions
, allLocales
-- Reference time builders
, currentReftime
@ -39,7 +43,7 @@ import qualified Data.HashMap.Strict as HashMap
import Duckling.Api
import Duckling.Dimensions.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Types

View File

@ -18,17 +18,17 @@ module Duckling.Debug
, ptree
) where
import qualified Data.HashSet as HashSet
import Data.Maybe
import Data.Text (Text)
import Prelude
import qualified Data.HashSet as HashSet
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import Prelude
import Duckling.Api
import Duckling.Dimensions.Types
import Duckling.Engine
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Rules
import Duckling.Testing.Types
@ -37,13 +37,13 @@ import Duckling.Types
-- -----------------------------------------------------------------
-- API
debug :: Lang -> Text -> [Some Dimension] -> IO [Entity]
debug l = debugContext testContext {lang = l}
debug :: Locale -> Text -> [Some Dimension] -> IO [Entity]
debug locale = debugContext testContext {locale = locale}
allParses :: Lang -> Text -> [Some Dimension] -> IO [Entity]
allParses :: Locale -> Text -> [Some Dimension] -> IO [Entity]
allParses l sentence targets = debugTokens sentence $ parses l sentence targets
fullParses :: Lang -> Text -> [Some Dimension] -> IO [Entity]
fullParses :: Locale -> Text -> [Some Dimension] -> IO [Entity]
fullParses l sentence targets = debugTokens sentence .
filter (\(Resolved {range = Range start end}) -> start == 0 && end == n) $
parses l sentence targets
@ -56,14 +56,14 @@ ptree sentence Resolved {node} = pnode sentence 0 node
-- -----------------------------------------------------------------
-- Internals
parses :: Lang -> Text -> [Some Dimension] -> [ResolvedToken]
parses :: Locale -> Text -> [Some Dimension] -> [ResolvedToken]
parses l sentence targets = flip filter tokens $
\(Resolved {node = Node{token = (Token d _)}}) ->
case targets of
[] -> True
_ -> elem (This d) targets
where
tokens = parseAndResolve rules sentence testContext {lang = l}
tokens = parseAndResolve rules sentence testContext {locale = l}
rules = rulesFor l $ HashSet.fromList targets
debugContext :: Context -> Text -> [Some Dimension] -> IO [Entity]

View File

@ -50,7 +50,7 @@ import qualified Duckling.Dimensions.TR as TRDimensions
import qualified Duckling.Dimensions.UK as UKDimensions
import qualified Duckling.Dimensions.VI as VIDimensions
import qualified Duckling.Dimensions.ZH as ZHDimensions
import Duckling.Lang
import Duckling.Locale
allDimensions :: Lang -> [Some Dimension]
allDimensions lang = CommonDimensions.allDimensions ++ langDimensions lang

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Distance.CS.Corpus
( corpus ) where
( corpus
) where
import Data.String
import Prelude
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = CS}, allExamples)
corpus = (testContext {locale = makeLocale CS Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -9,18 +9,19 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Distance.ES.Corpus
( corpus ) where
( corpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ES}, allExamples)
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,12 +15,12 @@ import Prelude
import Data.String
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = FR}, allExamples)
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,12 +15,12 @@ import Prelude
import Data.String
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = GA}, allExamples)
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,12 +14,12 @@ import Prelude
import Data.String
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HR}, allExamples)
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,12 +15,12 @@ import Prelude
import Data.String
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = KO}, allExamples)
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,12 +15,12 @@ import Prelude
import Data.String
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = NL}, allExamples)
corpus = (testContext {locale = makeLocale NL Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,12 +15,12 @@ import Prelude
import Data.String
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = PT}, allExamples)
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,12 +15,12 @@ import Prelude
import Data.String
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = RO}, allExamples)
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,12 +15,12 @@ import Data.String
import Prelude
import Duckling.Distance.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = TR}, allExamples)
corpus = (testContext {locale = makeLocale TR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -17,16 +17,16 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = FR}, allExamples)
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
negativeCorpus :: NegativeCorpus
negativeCorpus = (testContext {lang = FR}, examples)
negativeCorpus = (testContext {locale = makeLocale FR Nothing}, examples)
where
examples =
[ "les jours"

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = GA}, allExamples)
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ import Data.String
import Prelude
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = HU}, allExamples)
corpus = (testContext {locale = makeLocale HU Nothing}, allExamples)
allExamples :: [Example]

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = JA}, allExamples)
corpus = (testContext {locale = makeLocale JA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = KO}, allExamples)
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = NB}, allExamples)
corpus = (testContext {locale = makeLocale NB Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = PL}, allExamples)
corpus = (testContext {locale = makeLocale PL Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = PT}, allExamples)
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = RO}, allExamples)
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,13 +16,13 @@ import Prelude
import Data.String
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain(..))
corpus :: Corpus
corpus = (testContext {lang = SV}, allExamples)
corpus = (testContext {locale = makeLocale SV Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,13 +16,13 @@ import Data.String
import Prelude
import Duckling.Duration.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.TimeGrain.Types (Grain (..))
corpus :: Corpus
corpus = (testContext {lang = TR}, allExamples)
corpus = (testContext {locale = makeLocale TR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,12 +16,12 @@ import Data.String
import Prelude
import Duckling.Email.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = FR}, allExamples)
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -16,12 +16,12 @@ import Data.String
import Prelude
import Duckling.Email.Types
import Duckling.Lang
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = IT}, allExamples)
corpus = (testContext {locale = makeLocale IT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -20,25 +20,25 @@ module Duckling.Engine
import Control.DeepSeq
import Control.Monad.Extra
import Data.Aeson
import qualified Data.Array as Array
import Data.ByteString (ByteString)
import Data.Functor.Identity
import qualified Data.Foldable as Foldable
import Data.Maybe
import Data.Text (Text)
import qualified Data.List as L
import Prelude
import qualified Data.Array as Array
import qualified Data.Foldable as Foldable
import qualified Data.List as L
import qualified Text.Regex.PCRE as PCRE
import Duckling.Dimensions.Types
import qualified Duckling.Engine.Regex as Regex
import Duckling.Regex.Types
import Duckling.Resolve
import Duckling.Types
import qualified Duckling.Types.Document as Document
import Duckling.Types.Document (Document)
import qualified Duckling.Types.Stash as Stash
import Duckling.Types.Stash (Stash)
import qualified Duckling.Engine.Regex as Regex
import qualified Duckling.Types.Document as Document
import qualified Duckling.Types.Stash as Stash
-- -----------------------------------------------------------------
-- Engine

View File

@ -1,58 +0,0 @@
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoRebindableSyntax #-}
module Duckling.Lang
( Lang(..)
) where
import Prelude
import Data.Hashable
import GHC.Generics
import TextShow (TextShow)
import qualified TextShow as TS
data Lang
= AR
| BG
| CS
| DA
| DE
| EN
| ES
| ET
| FR
| GA
| HE
| HR
| HU
| ID
| IT
| JA
| KA
| KO
| MY
| NB
| NL
| PL
| PT
| RO
| RU
| SV
| TR
| UK
| VI
| ZH
deriving (Bounded, Enum, Eq, Generic, Hashable, Ord, Read, Show)
instance TextShow Lang where
showb = TS.fromString . show

100
Duckling/Locale.hs Normal file
View File

@ -0,0 +1,100 @@
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoRebindableSyntax #-}
module Duckling.Locale
( Lang(..)
, Locale(..)
, Region(..)
, allLocales
, makeLocale
) where
import Data.Hashable
import Data.HashMap.Strict (HashMap)
import Data.HashSet (HashSet)
import GHC.Generics
import Prelude
import TextShow (TextShow)
import qualified Data.HashMap.Strict as HashMap
import qualified Data.HashSet as HashSet
import qualified TextShow as TS
-- | ISO 639-1 Language.
-- See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
data Lang
= AR
| BG
| CS
| DA
| DE
| EN
| ES
| ET
| FR
| GA
| HE
| HR
| HU
| ID
| IT
| JA
| KA
| KO
| MY
| NB
| NL
| PL
| PT
| RO
| RU
| SV
| TR
| UK
| VI
| ZH
deriving (Bounded, Enum, Eq, Generic, Hashable, Ord, Read, Show)
instance TextShow Lang where
showb = TS.fromString . show
-- | ISO 3166-1 alpha-2 Country code (includes regions and territories).
-- See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
data Region
= GB
| US
deriving (Bounded, Enum, Eq, Generic, Hashable, Ord, Read, Show)
instance TextShow Region where
showb = TS.fromString . show
data Locale = Locale Lang (Maybe Region)
deriving (Eq, Generic, Hashable, Ord)
instance Show Locale where
show (Locale lang Nothing) = show lang ++ "_XX"
show (Locale lang (Just region)) = show lang ++ "_" ++ show region
instance TextShow Locale where
showb = TS.fromString . show
makeLocale :: Lang -> Maybe Region -> Locale
makeLocale lang Nothing = Locale lang Nothing
makeLocale lang (Just region)
| HashSet.member region locales = Locale lang $ Just region
| otherwise = Locale lang Nothing
where
locales = HashMap.lookupDefault HashSet.empty lang allLocales
allLocales :: HashMap Lang (HashSet Region)
allLocales = HashMap.fromList
[ (EN, HashSet.fromList [GB, US])
]

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.AR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = AR}, allExamples)
corpus = (testContext {locale = makeLocale AR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.BG.Corpus
import Data.String
import Prelude
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = BG}, allExamples)
corpus = (testContext {locale = makeLocale BG Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.CS.Corpus
import Data.String
import Prelude
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = CS}, allExamples)
corpus = (testContext {locale = makeLocale CS Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.DA.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = DA}, allExamples)
corpus = (testContext {locale = makeLocale DA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.DE.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = DE}, allExamples)
corpus = (testContext {locale = makeLocale DE Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.ES.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ES}, allExamples)
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.ET.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ET}, allExamples)
corpus = (testContext {locale = makeLocale ET Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.FR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = FR}, allExamples)
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.GA.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = GA}, allExamples)
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -13,13 +13,13 @@ module Duckling.Numeral.HE.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HE}, allExamples)
corpus = (testContext {locale = makeLocale HE Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -13,13 +13,13 @@ module Duckling.Numeral.HR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HR}, allExamples)
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.HU.Corpus
import Data.String
import Prelude
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HU}, allExamples)
corpus = (testContext {locale = makeLocale HU Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.ID.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ID}, allExamples)
corpus = (testContext {locale = makeLocale ID Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.IT.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = IT}, allExamples)
corpus = (testContext {locale = makeLocale IT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.JA.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = JA}, allExamples)
corpus = (testContext {locale = makeLocale JA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.KA.Corpus
import Data.String
import Prelude
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = KA}, allExamples)
corpus = (testContext {locale = makeLocale KA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.KO.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = KO}, allExamples)
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.MY.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = MY}, allExamples)
corpus = (testContext {locale = makeLocale MY Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.NB.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = NB}, allExamples)
corpus = (testContext {locale = makeLocale NB Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.NL.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = NL}, allExamples)
corpus = (testContext {locale = makeLocale NL Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.PL.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = PL}, allExamples)
corpus = (testContext {locale = makeLocale PL Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.PT.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = PT}, allExamples)
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.RO.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = RO}, allExamples)
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.RU.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = RU}, allExamples)
corpus = (testContext {locale = makeLocale RU Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.SV.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = SV}, allExamples)
corpus = (testContext {locale = makeLocale SV Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.TR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = TR}, allExamples)
corpus = (testContext {locale = makeLocale TR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.UK.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = UK}, allExamples)
corpus = (testContext {locale = makeLocale UK Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.VI.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = VI}, allExamples)
corpus = (testContext {locale = makeLocale VI Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Numeral.ZH.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Numeral.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ZH}, allExamples)
corpus = (testContext {locale = makeLocale ZH Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.AR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = AR}, allExamples)
corpus = (testContext {locale = makeLocale AR Nothing}, allExamples)
allExamples :: [Example]
allExamples =

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.DA.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = DA}, allExamples)
corpus = (testContext {locale = makeLocale DA Nothing}, allExamples)
allExamples :: [Example]
allExamples =

View File

@ -16,16 +16,16 @@ module Duckling.Ordinal.DE.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = DE}, allExamples)
corpus = (testContext {locale = makeLocale DE Nothing}, allExamples)
negativeCorpus :: NegativeCorpus
negativeCorpus = (testContext {lang = DE}, examples)
negativeCorpus = (testContext {locale = makeLocale DE Nothing}, examples)
where
examples =
[ "1.1"

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.ES.Corpus
import Data.String
import Prelude
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ES}, allExamples)
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.ET.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ET}, allExamples)
corpus = (testContext {locale = makeLocale ET Nothing}, allExamples)
allExamples :: [Example]
allExamples =

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.FR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = FR}, allExamples)
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.GA.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = GA}, allExamples)
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -13,13 +13,13 @@ module Duckling.Ordinal.HE.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HE}, allExamples)
corpus = (testContext {locale = makeLocale HE Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -13,13 +13,13 @@ module Duckling.Ordinal.HR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HR}, allExamples)
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.HU.Corpus
import Data.String
import Prelude
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HU}, allExamples)
corpus = (testContext {locale = makeLocale HU Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.ID.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ID}, allExamples)
corpus = (testContext {locale = makeLocale ID Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.IT.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = IT}, allExamples)
corpus = (testContext {locale = makeLocale IT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.JA.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = JA}, allExamples)
corpus = (testContext {locale = makeLocale JA Nothing}, allExamples)
allExamples :: [Example]
allExamples =

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.KO.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = KO}, allExamples)
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.NB.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = NB}, allExamples)
corpus = (testContext {locale = makeLocale NB Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.NL.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = NL}, allExamples)
corpus = (testContext {locale = makeLocale NL Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.PL.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = PL}, allExamples)
corpus = (testContext {locale = makeLocale PL Nothing}, allExamples)
allExamples :: [Example]
allExamples =

View File

@ -15,13 +15,13 @@ module Duckling.Ordinal.PT.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = PT}, allExamples)
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.RO.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = RO}, allExamples)
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.RU.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = RU}, allExamples)
corpus = (testContext {locale = makeLocale RU Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.SV.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = SV}, allExamples)
corpus = (testContext {locale = makeLocale SV Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.TR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = TR}, allExamples)
corpus = (testContext {locale = makeLocale TR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.UK.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = UK}, allExamples)
corpus = (testContext {locale = makeLocale UK Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -13,13 +13,13 @@ module Duckling.Ordinal.VI.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = VI}, allExamples)
corpus = (testContext {locale = makeLocale VI Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Ordinal.ZH.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Ordinal.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = ZH}, allExamples)
corpus = (testContext {locale = makeLocale ZH Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -15,13 +15,13 @@ module Duckling.PhoneNumber.PT.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.PhoneNumber.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = PT}, allExamples)
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -14,13 +14,13 @@ module Duckling.Quantity.FR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Quantity.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = FR}, allExamples)
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

View File

@ -13,13 +13,13 @@ module Duckling.Quantity.HR.Corpus
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Locale
import Duckling.Quantity.Types
import Duckling.Resolve
import Duckling.Testing.Types
corpus :: Corpus
corpus = (testContext {lang = HR}, allExamples)
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
allExamples :: [Example]
allExamples = concat

Some files were not shown because too many files have changed in this diff Show More