mirror of
https://github.com/facebook/duckling.git
synced 2024-11-30 23:33:33 +03:00
Return latent entities
Summary: Add an option to return latent time entities. This can be used when one is pretty certain that the input contains a datetime. Reviewed By: patapizza Differential Revision: D7254245 fbshipit-source-id: e9e0503cace2691804056fcebdc18fd9090fb181
This commit is contained in:
parent
490799fe4a
commit
5ac990bbe2
@ -21,7 +21,8 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale AR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale AR Nothing},
|
||||||
|
testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale BG Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale BG Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,14 +20,14 @@ import Duckling.AmountOfMoney.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (testContext, examples)
|
negativeCorpus = (testContext, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "exactly dollars"
|
[ "exactly dollars"
|
||||||
]
|
]
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext, allExamples)
|
corpus = (testContext, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ES Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale FR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale GA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale HR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ID Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ID Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale KO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale NB Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale NB Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale PT Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RU Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RU Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale SV Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale SV Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -118,19 +118,19 @@ data AmountOfMoneyData = AmountOfMoneyData
|
|||||||
|
|
||||||
instance Resolve AmountOfMoneyData where
|
instance Resolve AmountOfMoneyData where
|
||||||
type ResolvedValue AmountOfMoneyData = AmountOfMoneyValue
|
type ResolvedValue AmountOfMoneyData = AmountOfMoneyValue
|
||||||
resolve _ AmountOfMoneyData {value = Nothing, minValue = Nothing
|
resolve _ _ AmountOfMoneyData {value = Nothing, minValue = Nothing
|
||||||
, maxValue = Nothing} = Nothing
|
, maxValue = Nothing} = Nothing
|
||||||
resolve _ AmountOfMoneyData {value = Just value, currency} =
|
resolve _ _ AmountOfMoneyData {value = Just value, currency} =
|
||||||
Just $ simple currency value
|
Just (simple currency value, False)
|
||||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c
|
resolve _ _ AmountOfMoneyData {value = Nothing, currency = c
|
||||||
, minValue = Just from, maxValue = Just to} =
|
, minValue = Just from, maxValue = Just to} =
|
||||||
Just $ between c (from, to)
|
Just (between c (from, to), False)
|
||||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c
|
resolve _ _ AmountOfMoneyData {value = Nothing, currency = c
|
||||||
, minValue = Just v, maxValue = Nothing} =
|
, minValue = Just v, maxValue = Nothing} =
|
||||||
Just $ above c v
|
Just (above c v, False)
|
||||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c
|
resolve _ _ AmountOfMoneyData {value = Nothing, currency = c
|
||||||
, minValue = Nothing, maxValue = Just v} =
|
, minValue = Nothing, maxValue = Just v} =
|
||||||
Just $ under c v
|
Just (under c v, False)
|
||||||
|
|
||||||
data IntervalDirection = Above | Under
|
data IntervalDirection = Above | Under
|
||||||
deriving (Eq, Generic, Hashable, Ord, Show, NFData)
|
deriving (Eq, Generic, Hashable, Ord, Show, NFData)
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale VI Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale VI Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -37,8 +37,9 @@ import Duckling.Rules
|
|||||||
import Duckling.Types
|
import Duckling.Types
|
||||||
|
|
||||||
-- | Parses `input` and returns a curated list of entities found.
|
-- | Parses `input` and returns a curated list of entities found.
|
||||||
parse :: Text -> Context -> [Some Dimension] -> [Entity]
|
parse :: Text -> Context -> Options -> [Some Dimension] -> [Entity]
|
||||||
parse input ctx = map (formatToken input) . analyze input ctx . HashSet.fromList
|
parse input ctx options = map (formatToken input) . analyze input ctx options .
|
||||||
|
HashSet.fromList
|
||||||
|
|
||||||
supportedDimensions :: HashMap Lang [Some Dimension]
|
supportedDimensions :: HashMap Lang [Some Dimension]
|
||||||
supportedDimensions =
|
supportedDimensions =
|
||||||
@ -46,18 +47,19 @@ supportedDimensions =
|
|||||||
|
|
||||||
-- | Returns a curated list of resolved tokens found
|
-- | Returns a curated list of resolved tokens found
|
||||||
-- When `targets` is non-empty, returns only tokens of such dimensions.
|
-- When `targets` is non-empty, returns only tokens of such dimensions.
|
||||||
analyze :: Text -> Context -> HashSet (Some Dimension) -> [ResolvedToken]
|
analyze :: Text -> Context -> Options -> HashSet (Some Dimension)
|
||||||
analyze input context@Context{..} targets =
|
-> [ResolvedToken]
|
||||||
|
analyze input context@Context{..} options targets =
|
||||||
rank (classifiers locale) targets
|
rank (classifiers locale) targets
|
||||||
. filter (\Resolved{node = Node{token = (Token d _)}} ->
|
. filter (\Resolved{node = Node{token = (Token d _)}} ->
|
||||||
HashSet.null targets || HashSet.member (This d) targets
|
HashSet.null targets || HashSet.member (This d) targets
|
||||||
)
|
)
|
||||||
$ parseAndResolve (rulesFor locale targets) input context
|
$ parseAndResolve (rulesFor locale targets) input context options
|
||||||
|
|
||||||
-- | Converts the resolved token to the API format
|
-- | Converts the resolved token to the API format
|
||||||
formatToken :: Text -> ResolvedToken -> Entity
|
formatToken :: Text -> ResolvedToken -> Entity
|
||||||
formatToken sentence
|
formatToken sentence
|
||||||
(Resolved (Range start end) node@Node{token = Token dimension _} value) =
|
(Resolved (Range start end) node@Node{token = Token dimension _} value latent)
|
||||||
Entity (toName dimension) body value start end node
|
= Entity (toName dimension) body value start end latent node
|
||||||
where
|
where
|
||||||
body = Text.drop start $ Text.take end sentence
|
body = Text.drop start $ Text.take end sentence
|
||||||
|
@ -12,13 +12,14 @@
|
|||||||
|
|
||||||
module Duckling.Core
|
module Duckling.Core
|
||||||
( Context(..)
|
( Context(..)
|
||||||
, Region(..)
|
|
||||||
, Dimension(..)
|
, Dimension(..)
|
||||||
, Entity(..)
|
, Entity(..)
|
||||||
, Node(..)
|
|
||||||
, Range(..)
|
|
||||||
, Lang(..)
|
, Lang(..)
|
||||||
, Locale
|
, Locale
|
||||||
|
, Node(..)
|
||||||
|
, Options(..)
|
||||||
|
, Range(..)
|
||||||
|
, Region(..)
|
||||||
, Some(..)
|
, Some(..)
|
||||||
, fromName
|
, fromName
|
||||||
, makeLocale
|
, makeLocale
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
module Duckling.Debug
|
module Duckling.Debug
|
||||||
( allParses
|
( allParses
|
||||||
, debug
|
, debug
|
||||||
, debugContext
|
, debugCustom
|
||||||
, fullParses
|
, fullParses
|
||||||
, ptree
|
, ptree
|
||||||
) where
|
) where
|
||||||
@ -38,7 +38,7 @@ import Duckling.Types
|
|||||||
-- API
|
-- API
|
||||||
|
|
||||||
debug :: Locale -> Text -> [Some Dimension] -> IO [Entity]
|
debug :: Locale -> Text -> [Some Dimension] -> IO [Entity]
|
||||||
debug locale = debugContext testContext {locale = locale}
|
debug locale = debugCustom testContext {locale = locale} testOptions
|
||||||
|
|
||||||
allParses :: Locale -> Text -> [Some Dimension] -> IO [Entity]
|
allParses :: Locale -> Text -> [Some Dimension] -> IO [Entity]
|
||||||
allParses l sentence targets = debugTokens sentence $ parses l sentence targets
|
allParses l sentence targets = debugTokens sentence $ parses l sentence targets
|
||||||
@ -62,12 +62,12 @@ parses l sentence targets = flip filter tokens $
|
|||||||
[] -> True
|
[] -> True
|
||||||
_ -> elem (This d) targets
|
_ -> elem (This d) targets
|
||||||
where
|
where
|
||||||
tokens = parseAndResolve rules sentence testContext {locale = l}
|
tokens = parseAndResolve rules sentence testContext {locale = l} testOptions
|
||||||
rules = rulesFor l $ HashSet.fromList targets
|
rules = rulesFor l $ HashSet.fromList targets
|
||||||
|
|
||||||
debugContext :: Context -> Text -> [Some Dimension] -> IO [Entity]
|
debugCustom :: Context -> Options -> Text -> [Some Dimension] -> IO [Entity]
|
||||||
debugContext context sentence targets =
|
debugCustom context options sentence targets = debugTokens sentence .
|
||||||
debugTokens sentence . analyze sentence context $ HashSet.fromList targets
|
analyze sentence context options $ HashSet.fromList targets
|
||||||
|
|
||||||
debugTokens :: Text -> [ResolvedToken] -> IO [Entity]
|
debugTokens :: Text -> [ResolvedToken] -> IO [Entity]
|
||||||
debugTokens sentence tokens = do
|
debugTokens sentence tokens = do
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Distance.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale BG Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale BG Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale CS Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale CS Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -18,7 +18,7 @@ import Duckling.Distance.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext, allExamples)
|
corpus = (testContext, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ES Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale FR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale GA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -19,7 +19,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale HR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale KO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale NL Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale NL Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale PT Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Distance.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RU Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RU Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale TR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale TR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -51,18 +51,18 @@ data DistanceData = DistanceData
|
|||||||
|
|
||||||
instance Resolve DistanceData where
|
instance Resolve DistanceData where
|
||||||
type ResolvedValue DistanceData = DistanceValue
|
type ResolvedValue DistanceData = DistanceValue
|
||||||
resolve _ DistanceData {unit = Just unit, value = Just val} =
|
resolve _ _ DistanceData {unit = Just unit, value = Just val} =
|
||||||
Just $ simple unit val
|
Just (simple unit val, False)
|
||||||
resolve _ DistanceData {unit = Just unit, value = Nothing
|
resolve _ _ DistanceData {unit = Just unit, value = Nothing
|
||||||
, minValue = Just from, maxValue = Just to} =
|
, minValue = Just from, maxValue = Just to} =
|
||||||
Just $ between unit (from, to)
|
Just (between unit (from, to), False)
|
||||||
resolve _ DistanceData {unit = Just unit, value = Nothing
|
resolve _ _ DistanceData {unit = Just unit, value = Nothing
|
||||||
, minValue = Just from, maxValue = Nothing} =
|
, minValue = Just from, maxValue = Nothing} =
|
||||||
Just $ above unit from
|
Just (above unit from, False)
|
||||||
resolve _ DistanceData {unit = Just unit, value = Nothing
|
resolve _ _ DistanceData {unit = Just unit, value = Nothing
|
||||||
, minValue = Nothing, maxValue = Just to} =
|
, minValue = Nothing, maxValue = Just to} =
|
||||||
Just $ under unit to
|
Just (under unit to, False)
|
||||||
resolve _ _ = Nothing
|
resolve _ _ _ = Nothing
|
||||||
|
|
||||||
data IntervalDirection = Above | Under
|
data IntervalDirection = Above | Under
|
||||||
deriving (Eq, Generic, Hashable, Ord, Show, NFData)
|
deriving (Eq, Generic, Hashable, Ord, Show, NFData)
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale AR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale AR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -26,10 +26,10 @@ context :: Context
|
|||||||
context = testContext {locale = makeLocale EL Nothing}
|
context = testContext {locale = makeLocale EL Nothing}
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (context, allExamples)
|
corpus = (context, testOptions, allExamples)
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (context, examples)
|
negativeCorpus = (context, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "για μήνες"
|
[ "για μήνες"
|
||||||
|
@ -21,10 +21,10 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext, allExamples)
|
corpus = (testContext, testOptions, allExamples)
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (testContext, examples)
|
negativeCorpus = (testContext, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "for months"
|
[ "for months"
|
||||||
|
@ -23,10 +23,10 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale FR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (testContext {locale = makeLocale FR Nothing}, examples)
|
negativeCorpus = (testContext {locale = makeLocale FR Nothing}, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "les jours"
|
[ "les jours"
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale GA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale HU Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale HU Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale JA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale JA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale KO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale NB Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale NB Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -23,10 +23,10 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale NL Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale NL Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (testContext {locale = makeLocale NL Nothing}, examples)
|
negativeCorpus = (testContext {locale = makeLocale NL Nothing}, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "voor maanden"
|
[ "voor maanden"
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale PL Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale PL Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale PT Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RU Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RU Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale SV Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale SV Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain (..))
|
import Duckling.TimeGrain.Types (Grain (..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale TR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale TR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -34,7 +34,7 @@ data DurationData = DurationData
|
|||||||
|
|
||||||
instance Resolve DurationData where
|
instance Resolve DurationData where
|
||||||
type ResolvedValue DurationData = DurationData
|
type ResolvedValue DurationData = DurationData
|
||||||
resolve _ x = Just x
|
resolve _ _ x = Just (x, False)
|
||||||
|
|
||||||
instance ToJSON DurationData where
|
instance ToJSON DurationData where
|
||||||
toJSON DurationData {value, grain} = object
|
toJSON DurationData {value, grain} = object
|
||||||
|
@ -22,7 +22,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.TimeGrain.Types (Grain(..))
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ZH Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ZH Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,10 +20,10 @@ import Duckling.Email.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext, allExamples)
|
corpus = (testContext, testOptions, allExamples)
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (testContext, examples)
|
negativeCorpus = (testContext, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "hey@6"
|
[ "hey@6"
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Email.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (testContext, examples)
|
negativeCorpus = (testContext, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "fitness at 6.40"
|
[ "fitness at 6.40"
|
||||||
@ -35,7 +35,7 @@ negativeCorpus = (testContext, examples)
|
|||||||
]
|
]
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext, allExamples)
|
corpus = (testContext, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale FR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale IT Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale IT Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -29,7 +29,7 @@ newtype EmailData = EmailData { value :: Text }
|
|||||||
|
|
||||||
instance Resolve EmailData where
|
instance Resolve EmailData where
|
||||||
type ResolvedValue EmailData = EmailData
|
type ResolvedValue EmailData = EmailData
|
||||||
resolve _ x = Just x
|
resolve _ _ x = Just (x, False)
|
||||||
|
|
||||||
instance ToJSON EmailData where
|
instance ToJSON EmailData where
|
||||||
toJSON EmailData {value} = object [ "value" .= value ]
|
toJSON EmailData {value} = object [ "value" .= value ]
|
||||||
|
@ -48,10 +48,10 @@ type Duckling a = Identity a
|
|||||||
runDuckling :: Duckling a -> a
|
runDuckling :: Duckling a -> a
|
||||||
runDuckling ma = runIdentity ma
|
runDuckling ma = runIdentity ma
|
||||||
|
|
||||||
parseAndResolve :: [Rule] -> Text -> Context -> [ResolvedToken]
|
parseAndResolve :: [Rule] -> Text -> Context -> Options -> [ResolvedToken]
|
||||||
parseAndResolve rules input context = mapMaybe (resolveNode context) .
|
parseAndResolve rules input context options =
|
||||||
force $ Stash.toPosOrderedList $ runDuckling $
|
mapMaybe (resolveNode context options) . force $ Stash.toPosOrderedList $
|
||||||
parseString rules (Document.fromText input)
|
runDuckling $ parseString rules (Document.fromText input)
|
||||||
|
|
||||||
produce :: Match -> Maybe Node
|
produce :: Match -> Maybe Node
|
||||||
produce (_, _, []) = Nothing
|
produce (_, _, []) = Nothing
|
||||||
@ -218,11 +218,13 @@ parseString rules sentence = do
|
|||||||
headPredicateRules =
|
headPredicateRules =
|
||||||
[ rule | rule@Rule{pattern = (Predicate _ : _)} <- rules ]
|
[ rule | rule@Rule{pattern = (Predicate _ : _)} <- rules ]
|
||||||
|
|
||||||
resolveNode :: Context -> Node -> Maybe ResolvedToken
|
resolveNode :: Context -> Options -> Node -> Maybe ResolvedToken
|
||||||
resolveNode context n@Node{token = (Token _ dd), nodeRange = nodeRange} = do
|
resolveNode context options n@Node{token = (Token _ dd), nodeRange = nodeRange}
|
||||||
val <- resolve context dd
|
= do
|
||||||
|
(val, latent) <- resolve context options dd
|
||||||
Just Resolved
|
Just Resolved
|
||||||
{ range = nodeRange
|
{ range = nodeRange
|
||||||
, node = n
|
, node = n
|
||||||
, jsonValue = toJSON val
|
, jsonValue = toJSON val
|
||||||
|
, isLatent = latent
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale AR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale AR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale BG Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale BG Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale CS Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale CS Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale DA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale DA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale DE Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale DE Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale EL Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale EL Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -18,7 +18,7 @@ import Duckling.Numeral.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext, allExamples)
|
corpus = (testContext, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ES Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ET Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ET Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale FR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale GA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -19,7 +19,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale HE Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale HE Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale HI Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale HI Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -19,7 +19,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale HR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale HR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale HU Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale HU Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ID Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ID Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale IT Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale IT Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale JA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale JA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale KA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale KA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale KO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale KO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale MY Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale MY Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale NB Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale NB Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale NE Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale NE Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale NL Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale NL Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale PL Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale PL Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale PT Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale PT Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RO Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RO Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale RU Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale RU Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale SV Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale SV Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale TR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale TR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -39,7 +39,7 @@ data NumeralData = NumeralData
|
|||||||
|
|
||||||
instance Resolve NumeralData where
|
instance Resolve NumeralData where
|
||||||
type ResolvedValue NumeralData = NumeralValue
|
type ResolvedValue NumeralData = NumeralValue
|
||||||
resolve _ NumeralData {value} = Just NumeralValue {vValue = value}
|
resolve _ _ NumeralData {value} = Just (NumeralValue {vValue = value}, False)
|
||||||
|
|
||||||
newtype NumeralValue = NumeralValue { vValue :: Double }
|
newtype NumeralValue = NumeralValue { vValue :: Double }
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale UK Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale UK Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale VI Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale VI Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ZH Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ZH Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -21,7 +21,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale AR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale AR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale DA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale DA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples =
|
allExamples =
|
||||||
|
@ -22,10 +22,10 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale DE Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale DE Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
negativeCorpus :: NegativeCorpus
|
negativeCorpus :: NegativeCorpus
|
||||||
negativeCorpus = (testContext {locale = makeLocale DE Nothing}, examples)
|
negativeCorpus = (testContext {locale = makeLocale DE Nothing}, testOptions, examples)
|
||||||
where
|
where
|
||||||
examples =
|
examples =
|
||||||
[ "1.1"
|
[ "1.1"
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale EL Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale EL Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -18,7 +18,7 @@ import Duckling.Ordinal.Types
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext, allExamples)
|
corpus = (testContext, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ES Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ES Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale ET Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale ET Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples =
|
allExamples =
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale FR Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale FR Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
@ -20,7 +20,7 @@ import Duckling.Resolve
|
|||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
|
|
||||||
corpus :: Corpus
|
corpus :: Corpus
|
||||||
corpus = (testContext {locale = makeLocale GA Nothing}, allExamples)
|
corpus = (testContext {locale = makeLocale GA Nothing}, testOptions, allExamples)
|
||||||
|
|
||||||
allExamples :: [Example]
|
allExamples :: [Example]
|
||||||
allExamples = concat
|
allExamples = concat
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user