diff --git a/Duckling/Api.hs b/Duckling/Api.hs index 0582cd64..389684c1 100644 --- a/Duckling/Api.hs +++ b/Duckling/Api.hs @@ -49,7 +49,7 @@ analyze :: Text -> Context -> HashSet (Some Dimension) -> [ResolvedToken] analyze input context@Context{..} targets = rank (classifiers lang) targets . filter (\(Resolved{node = Node{token = (Token d _)}}) -> - HashSet.null targets || HashSet.member (Some d) targets + HashSet.null targets || HashSet.member (This d) targets ) $ parseAndResolve (rulesFor lang targets) input context diff --git a/Duckling/Api/Tests.hs b/Duckling/Api/Tests.hs index 23e31e0f..e07c1e08 100644 --- a/Duckling/Api/Tests.hs +++ b/Duckling/Api/Tests.hs @@ -38,7 +38,7 @@ tests = testGroup "API Tests" parseTest :: TestTree parseTest = testCase "Parse Test" $ - case parse sentence testContext [Some Numeral] of + case parse sentence testContext [This Numeral] of [] -> assertFailure "empty result" (Entity dim body value start end:_) -> do assertEqual "dim" "number" dim @@ -60,39 +60,39 @@ rankFilterTest :: TestTree rankFilterTest = testCase "Rank Filter Tests" $ do mapM_ check [ ( "in 2 minutes" - , [Some Numeral, Some Duration, Some Time] - , [Some Time] + , [This Numeral, This Duration, This Time] + , [This Time] ) , ( "in 2 minutes, about 42 degrees" - , [Some Numeral, Some Temperature, Some Time] - , [Some Time, Some Temperature] + , [This Numeral, This Temperature, This Time] + , [This Time, This Temperature] ) , ( "today works... and tomorrow at 9pm too" - , [Some Numeral, Some Time] - , [Some Time, Some Time] + , [This Numeral, This Time] + , [This Time, This Time] ) , ( "between 9:30 and 11:00 on thursday or Saturday and Thanksgiving Day" - , [Some Numeral, Some Time] - , [Some Time, Some Time, Some Time] + , [This Numeral, This Time] + , [This Time, This Time, This Time] ) - , ("the day after tomorrow 5pm", [Some Time], [Some Time]) - , ("the day after tomorrow 5pm", [Some Time, Some Numeral], [Some Time]) - , ("the day after tomorrow 5pm", [], [Some Time]) + , ("the day after tomorrow 5pm", [This Time], [This Time]) + , ("the day after tomorrow 5pm", [This Time, This Numeral], [This Time]) + , ("the day after tomorrow 5pm", [], [This Time]) ] where check :: (Text, [Some Dimension], [Some Dimension]) -> IO () check (sentence, targets, expected) = let go = analyze sentence testContext $ HashSet.fromList targets actual = flip map go $ - \(Resolved{node=Node{token=Token d _}}) -> Some d + \(Resolved{node=Node{token=Token d _}}) -> This d in assertEqual ("wrong winners for " ++ show sentence) expected actual rankOrderTest :: TestTree rankOrderTest = testCase "Rank Order Tests" $ do mapM_ check - [ ("tomorrow at 5PM or 8PM", [Some Time]) - , ("321 12 3456 ... 7", [Some Numeral]) - , ("42 today 23 tomorrow", [Some Numeral, Some Time]) + [ ("tomorrow at 5PM or 8PM", [This Time]) + , ("321 12 3456 ... 7", [This Numeral]) + , ("42 today 23 tomorrow", [This Numeral, This Time]) ] where check (s, targets) = @@ -104,13 +104,13 @@ rangeTest = testCase "Range Tests" $ do mapM_ (analyzedFirstTest testContext) xs where xs = map (\(input, targets, range) -> (input, targets, f range)) - [ ( "order status 3233763377", [Some PhoneNumber], Range 13 23 ) - , ( " 3233763377 " , [Some PhoneNumber], Range 2 12 ) - , ( " -3233763377" , [Some PhoneNumber], Range 2 12 ) - , ( " now" , [Some Time] , Range 2 5 ) - , ( " Monday " , [Some Time] , Range 3 9 ) - , ( " next week " , [Some Time] , Range 2 13 ) - , ( " 42\n\n" , [Some Numeral] , Range 3 5 ) + [ ( "order status 3233763377", [This PhoneNumber], Range 13 23 ) + , ( " 3233763377 " , [This PhoneNumber], Range 2 12 ) + , ( " -3233763377" , [This PhoneNumber], Range 2 12 ) + , ( " now" , [This Time] , Range 2 5 ) + , ( " Monday " , [This Time] , Range 3 9 ) + , ( " next week " , [This Time] , Range 2 13 ) + , ( " 42\n\n" , [This Numeral] , Range 3 5 ) ] f :: Range -> TestPredicate f expected _ (Resolved {range = actual}) = expected == actual @@ -119,13 +119,13 @@ supportedDimensionsTest :: TestTree supportedDimensionsTest = testCase "Supported Dimensions Test" $ do mapM_ check [ ( AR - , [ Some Email, Some Finance, Some PhoneNumber, Some Url, Some Numeral - , Some Ordinal + , [ This Email, This Finance, This PhoneNumber, This Url, This Numeral + , This Ordinal ] ) , ( PL - , [ Some Email, Some Finance, Some PhoneNumber, Some Url, Some Duration - , Some Numeral, Some Ordinal, Some Time + , [ This Email, This Finance, This PhoneNumber, This Url, This Duration + , This Numeral, This Ordinal, This Time ] ) ] diff --git a/Duckling/Core.hs b/Duckling/Core.hs index 8d0d8437..0d1e82ff 100644 --- a/Duckling/Core.hs +++ b/Duckling/Core.hs @@ -13,6 +13,7 @@ module Duckling.Core ( Context(..) , Dimension(..) + , fromName , Entity(..) , Lang(..) , Some(..) diff --git a/Duckling/Debug.hs b/Duckling/Debug.hs index aeac4f64..92a68041 100644 --- a/Duckling/Debug.hs +++ b/Duckling/Debug.hs @@ -60,7 +60,7 @@ parses l sentence targets = flip filter tokens $ \(Resolved {node = Node{token = (Token d _)}}) -> case targets of [] -> True - _ -> elem (Some d) targets + _ -> elem (This d) targets where tokens = parseAndResolve rules sentence testContext {lang = l} rules = rulesFor l $ HashSet.fromList targets diff --git a/Duckling/Dimensions.hs b/Duckling/Dimensions.hs index 0b8aff67..ac9d7719 100644 --- a/Duckling/Dimensions.hs +++ b/Duckling/Dimensions.hs @@ -56,21 +56,21 @@ explicitDimensions targets = HashSet.union targets deps -- | Ordinal depends on Numeral for JA, KO, and ZH. dependents :: Some Dimension -> HashSet (Some Dimension) -dependents (Some Distance) = HashSet.singleton (Some Numeral) -dependents (Some Duration) = HashSet.fromList [Some Numeral, Some TimeGrain] -dependents (Some Numeral) = HashSet.empty -dependents (Some Email) = HashSet.empty -dependents (Some Finance) = HashSet.singleton (Some Numeral) -dependents (Some Ordinal) = HashSet.singleton (Some Numeral) -dependents (Some PhoneNumber) = HashSet.empty -dependents (Some Quantity) = HashSet.singleton (Some Numeral) -dependents (Some RegexMatch) = HashSet.empty -dependents (Some Temperature) = HashSet.singleton (Some Numeral) -dependents (Some Time) = - HashSet.fromList [Some Numeral, Some Duration, Some Ordinal, Some TimeGrain] -dependents (Some TimeGrain) = HashSet.empty -dependents (Some Url) = HashSet.empty -dependents (Some Volume) = HashSet.singleton (Some Numeral) +dependents (This Distance) = HashSet.singleton (This Numeral) +dependents (This Duration) = HashSet.fromList [This Numeral, This TimeGrain] +dependents (This Numeral) = HashSet.empty +dependents (This Email) = HashSet.empty +dependents (This Finance) = HashSet.singleton (This Numeral) +dependents (This Ordinal) = HashSet.singleton (This Numeral) +dependents (This PhoneNumber) = HashSet.empty +dependents (This Quantity) = HashSet.singleton (This Numeral) +dependents (This RegexMatch) = HashSet.empty +dependents (This Temperature) = HashSet.singleton (This Numeral) +dependents (This Time) = + HashSet.fromList [This Numeral, This Duration, This Ordinal, This TimeGrain] +dependents (This TimeGrain) = HashSet.empty +dependents (This Url) = HashSet.empty +dependents (This Volume) = HashSet.singleton (This Numeral) langDimensions :: Lang -> [Some Dimension] langDimensions AR = ARDimensions.allDimensions diff --git a/Duckling/Dimensions/AR.hs b/Duckling/Dimensions/AR.hs index aa70b89c..7510bcc5 100644 --- a/Duckling/Dimensions/AR.hs +++ b/Duckling/Dimensions/AR.hs @@ -14,6 +14,6 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral - , Some Ordinal + [ This Numeral + , This Ordinal ] diff --git a/Duckling/Dimensions/Common.hs b/Duckling/Dimensions/Common.hs index fb741ea9..b7f0df97 100644 --- a/Duckling/Dimensions/Common.hs +++ b/Duckling/Dimensions/Common.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Email - , Some Finance - , Some PhoneNumber - , Some Url + [ This Email + , This Finance + , This PhoneNumber + , This Url ] diff --git a/Duckling/Dimensions/DA.hs b/Duckling/Dimensions/DA.hs index a5d4022b..fc9640f5 100644 --- a/Duckling/Dimensions/DA.hs +++ b/Duckling/Dimensions/DA.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Time ] diff --git a/Duckling/Dimensions/DE.hs b/Duckling/Dimensions/DE.hs index 3df9a44b..c91a8a09 100644 --- a/Duckling/Dimensions/DE.hs +++ b/Duckling/Dimensions/DE.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Time ] diff --git a/Duckling/Dimensions/EN.hs b/Duckling/Dimensions/EN.hs index 164bd4c8..321261db 100644 --- a/Duckling/Dimensions/EN.hs +++ b/Duckling/Dimensions/EN.hs @@ -14,12 +14,12 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Duration - , Some Numeral - , Some Ordinal - , Some Quantity - , Some Temperature - , Some Time - , Some Volume + [ This Distance + , This Duration + , This Numeral + , This Ordinal + , This Quantity + , This Temperature + , This Time + , This Volume ] diff --git a/Duckling/Dimensions/ES.hs b/Duckling/Dimensions/ES.hs index acb27d3f..d57cf896 100644 --- a/Duckling/Dimensions/ES.hs +++ b/Duckling/Dimensions/ES.hs @@ -14,11 +14,11 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Duration - , Some Numeral - , Some Ordinal - , Some Temperature - , Some Time - , Some Volume + [ This Distance + , This Duration + , This Numeral + , This Ordinal + , This Temperature + , This Time + , This Volume ] diff --git a/Duckling/Dimensions/ET.hs b/Duckling/Dimensions/ET.hs index 77ab09ef..9bdad709 100644 --- a/Duckling/Dimensions/ET.hs +++ b/Duckling/Dimensions/ET.hs @@ -14,6 +14,6 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral - , Some Ordinal + [ This Numeral + , This Ordinal ] diff --git a/Duckling/Dimensions/FR.hs b/Duckling/Dimensions/FR.hs index d4c697ce..6ab2afc0 100644 --- a/Duckling/Dimensions/FR.hs +++ b/Duckling/Dimensions/FR.hs @@ -14,12 +14,12 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Duration - , Some Numeral - , Some Ordinal - , Some Quantity - , Some Temperature - , Some Time - , Some Volume + [ This Distance + , This Duration + , This Numeral + , This Ordinal + , This Quantity + , This Temperature + , This Time + , This Volume ] diff --git a/Duckling/Dimensions/GA.hs b/Duckling/Dimensions/GA.hs index e885dcdb..0f77172b 100644 --- a/Duckling/Dimensions/GA.hs +++ b/Duckling/Dimensions/GA.hs @@ -14,11 +14,11 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Duration - , Some Numeral - , Some Ordinal - , Some Temperature - , Some Time - , Some Volume + [ This Distance + , This Duration + , This Numeral + , This Ordinal + , This Temperature + , This Time + , This Volume ] diff --git a/Duckling/Dimensions/ID.hs b/Duckling/Dimensions/ID.hs index 214ab427..bda515bd 100644 --- a/Duckling/Dimensions/ID.hs +++ b/Duckling/Dimensions/ID.hs @@ -14,6 +14,6 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral - , Some Ordinal + [ This Numeral + , This Ordinal ] diff --git a/Duckling/Dimensions/IT.hs b/Duckling/Dimensions/IT.hs index 251f3fbb..84e00bd3 100644 --- a/Duckling/Dimensions/IT.hs +++ b/Duckling/Dimensions/IT.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Time ] diff --git a/Duckling/Dimensions/JA.hs b/Duckling/Dimensions/JA.hs index ba3dc605..7484d53d 100644 --- a/Duckling/Dimensions/JA.hs +++ b/Duckling/Dimensions/JA.hs @@ -14,9 +14,9 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Temperature - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Temperature + , This Time ] diff --git a/Duckling/Dimensions/KO.hs b/Duckling/Dimensions/KO.hs index f8f934db..d001da59 100644 --- a/Duckling/Dimensions/KO.hs +++ b/Duckling/Dimensions/KO.hs @@ -14,12 +14,12 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Duration - , Some Numeral - , Some Ordinal - , Some Quantity - , Some Temperature - , Some Time - , Some Volume + [ This Distance + , This Duration + , This Numeral + , This Ordinal + , This Quantity + , This Temperature + , This Time + , This Volume ] diff --git a/Duckling/Dimensions/MY.hs b/Duckling/Dimensions/MY.hs index 96a3194d..4142f7e9 100644 --- a/Duckling/Dimensions/MY.hs +++ b/Duckling/Dimensions/MY.hs @@ -14,5 +14,5 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral + [ This Numeral ] diff --git a/Duckling/Dimensions/NB.hs b/Duckling/Dimensions/NB.hs index 22861c78..2ed4a4a1 100644 --- a/Duckling/Dimensions/NB.hs +++ b/Duckling/Dimensions/NB.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Time ] diff --git a/Duckling/Dimensions/NL.hs b/Duckling/Dimensions/NL.hs index 2f6690f1..00ab5124 100644 --- a/Duckling/Dimensions/NL.hs +++ b/Duckling/Dimensions/NL.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Numeral - , Some Ordinal - , Some Volume + [ This Distance + , This Numeral + , This Ordinal + , This Volume ] diff --git a/Duckling/Dimensions/PL.hs b/Duckling/Dimensions/PL.hs index caea9bf8..4c53c078 100644 --- a/Duckling/Dimensions/PL.hs +++ b/Duckling/Dimensions/PL.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Time ] diff --git a/Duckling/Dimensions/PT.hs b/Duckling/Dimensions/PT.hs index 262c8514..f894b9a7 100644 --- a/Duckling/Dimensions/PT.hs +++ b/Duckling/Dimensions/PT.hs @@ -14,12 +14,12 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Duration - , Some Numeral - , Some Ordinal - , Some Quantity - , Some Temperature - , Some Time - , Some Volume + [ This Distance + , This Duration + , This Numeral + , This Ordinal + , This Quantity + , This Temperature + , This Time + , This Volume ] diff --git a/Duckling/Dimensions/RO.hs b/Duckling/Dimensions/RO.hs index 7377cff7..d634424a 100644 --- a/Duckling/Dimensions/RO.hs +++ b/Duckling/Dimensions/RO.hs @@ -14,12 +14,12 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Distance - , Some Duration - , Some Numeral - , Some Ordinal - , Some Quantity - , Some Temperature - , Some Time - , Some Volume + [ This Distance + , This Duration + , This Numeral + , This Ordinal + , This Quantity + , This Temperature + , This Time + , This Volume ] diff --git a/Duckling/Dimensions/RU.hs b/Duckling/Dimensions/RU.hs index d28a6a7f..50bfba19 100644 --- a/Duckling/Dimensions/RU.hs +++ b/Duckling/Dimensions/RU.hs @@ -14,6 +14,6 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral - , Some Ordinal + [ This Numeral + , This Ordinal ] diff --git a/Duckling/Dimensions/SV.hs b/Duckling/Dimensions/SV.hs index 9f8a6881..0b68395f 100644 --- a/Duckling/Dimensions/SV.hs +++ b/Duckling/Dimensions/SV.hs @@ -14,8 +14,8 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Time ] diff --git a/Duckling/Dimensions/TR.hs b/Duckling/Dimensions/TR.hs index 1577ac46..fa5e50e5 100644 --- a/Duckling/Dimensions/TR.hs +++ b/Duckling/Dimensions/TR.hs @@ -14,6 +14,6 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral - , Some Ordinal + [ This Numeral + , This Ordinal ] diff --git a/Duckling/Dimensions/Types.hs b/Duckling/Dimensions/Types.hs index f860be9a..3148befb 100644 --- a/Duckling/Dimensions/Types.hs +++ b/Duckling/Dimensions/Types.hs @@ -12,16 +12,22 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE NoRebindableSyntax #-} {-# LANGUAGE TypeOperators #-} -{-# LANGUAGE StandaloneDeriving #-} + module Duckling.Dimensions.Types ( Some(..) , Dimension(..) - , dimEq + + , fromName ) where +import Data.GADT.Compare +import Data.GADT.Show import Data.Hashable +import qualified Data.HashMap.Strict as HashMap import Data.Maybe +import Data.Some +import Data.Text (Text) -- Intentionally limit use of Typeable to avoid casting or typeOf usage import Data.Typeable ((:~:)(..)) import TextShow (TextShow(..)) @@ -43,11 +49,6 @@ import Duckling.TimeGrain.Types (Grain) import Duckling.Url.Types (UrlData) import Duckling.Volume.Types (VolumeData) --- ----------------------------------------------------------------- --- Wrapper to house the existential - -data Some t = forall a . Some (t a) - -- ----------------------------------------------------------------- -- Dimension @@ -71,7 +72,6 @@ data Dimension a where Volume :: Dimension VolumeData -- Show -deriving instance Show (Some Dimension) instance Show (Dimension a) where show RegexMatch = "regex" show Distance = "distance" @@ -87,21 +87,17 @@ instance Show (Dimension a) where show TimeGrain = "time-grain" show Url = "url" show Volume = "volume" +instance GShow Dimension where gshowsPrec = showsPrec -- TextShow instance TextShow (Dimension a) where showb d = TS.fromString $ show d instance TextShow (Some Dimension) where - showb (Some d) = showb d - --- Eq -deriving instance Eq (Dimension a) -instance Eq (Some Dimension) where - (==) (Some a) (Some b) = isJust $ dimEq a b + showb (This d) = showb d -- Hashable instance Hashable (Some Dimension) where - hashWithSalt s (Some a) = hashWithSalt s a + hashWithSalt s (This a) = hashWithSalt s a instance Hashable (Dimension a) where hashWithSalt s RegexMatch = hashWithSalt s (0::Int) hashWithSalt s Distance = hashWithSalt s (1::Int) @@ -118,50 +114,51 @@ instance Hashable (Dimension a) where hashWithSalt s Url = hashWithSalt s (12::Int) hashWithSalt s Volume = hashWithSalt s (13::Int) -instance Read (Some Dimension) where - -- Regex is intentionally ignored - readsPrec _ "amount-of-money" = [(Some Finance, "")] - readsPrec _ "distance" = [(Some Distance, "")] - readsPrec _ "duration" = [(Some Duration, "")] - readsPrec _ "email" = [(Some Email, "")] - readsPrec _ "number" = [(Some Numeral, "")] - readsPrec _ "ordinal" = [(Some Ordinal, "")] - readsPrec _ "phone-number" = [(Some PhoneNumber, "")] - readsPrec _ "quantity" = [(Some Quantity, "")] - readsPrec _ "temperature" = [(Some Temperature, "")] - readsPrec _ "time" = [(Some Time, "")] - readsPrec _ "url" = [(Some Url, "")] - readsPrec _ "volume" = [(Some Volume, "")] - readsPrec _ _ = [] --- | Proof that 2 dimensions are the same Type --- 2 matches per dimension for pattern exhaustiveness sake -dimEq :: Dimension a -> Dimension b -> Maybe (a :~: b) -dimEq RegexMatch RegexMatch = Just Refl -dimEq RegexMatch _ = Nothing -dimEq Distance Distance = Just Refl -dimEq Distance _ = Nothing -dimEq Duration Duration = Just Refl -dimEq Duration _ = Nothing -dimEq Email Email = Just Refl -dimEq Email _ = Nothing -dimEq Finance Finance = Just Refl -dimEq Finance _ = Nothing -dimEq Numeral Numeral = Just Refl -dimEq Numeral _ = Nothing -dimEq Ordinal Ordinal = Just Refl -dimEq Ordinal _ = Nothing -dimEq PhoneNumber PhoneNumber = Just Refl -dimEq PhoneNumber _ = Nothing -dimEq Quantity Quantity = Just Refl -dimEq Quantity _ = Nothing -dimEq Temperature Temperature = Just Refl -dimEq Temperature _ = Nothing -dimEq Time Time = Just Refl -dimEq Time _ = Nothing -dimEq TimeGrain TimeGrain = Just Refl -dimEq TimeGrain _ = Nothing -dimEq Url Url = Just Refl -dimEq Url _ = Nothing -dimEq Volume Volume = Just Refl -dimEq Volume _ = Nothing +fromName :: Text -> Maybe (Some Dimension) +fromName name = HashMap.lookup name m + where + m = HashMap.fromList + [ ("amount-of-money", This Finance) + , ("distance", This Distance) + , ("duration", This Duration) + , ("email", This Email) + , ("number", This Numeral) + , ("ordinal", This Ordinal) + , ("phone-number", This PhoneNumber) + , ("quantity", This Quantity) + , ("temperature", This Temperature) + , ("time", This Time) + , ("url", This Url) + , ("volume", This Volume) + ] + +instance GEq Dimension where + geq RegexMatch RegexMatch = Just Refl + geq RegexMatch _ = Nothing + geq Distance Distance = Just Refl + geq Distance _ = Nothing + geq Duration Duration = Just Refl + geq Duration _ = Nothing + geq Email Email = Just Refl + geq Email _ = Nothing + geq Finance Finance = Just Refl + geq Finance _ = Nothing + geq Numeral Numeral = Just Refl + geq Numeral _ = Nothing + geq Ordinal Ordinal = Just Refl + geq Ordinal _ = Nothing + geq PhoneNumber PhoneNumber = Just Refl + geq PhoneNumber _ = Nothing + geq Quantity Quantity = Just Refl + geq Quantity _ = Nothing + geq Temperature Temperature = Just Refl + geq Temperature _ = Nothing + geq Time Time = Just Refl + geq Time _ = Nothing + geq TimeGrain TimeGrain = Just Refl + geq TimeGrain _ = Nothing + geq Url Url = Just Refl + geq Url _ = Nothing + geq Volume Volume = Just Refl + geq Volume _ = Nothing diff --git a/Duckling/Dimensions/UK.hs b/Duckling/Dimensions/UK.hs index 8f07dee2..e5e2b612 100644 --- a/Duckling/Dimensions/UK.hs +++ b/Duckling/Dimensions/UK.hs @@ -14,6 +14,6 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral - , Some Ordinal + [ This Numeral + , This Ordinal ] diff --git a/Duckling/Dimensions/VI.hs b/Duckling/Dimensions/VI.hs index be1efdd4..ef78e6f9 100644 --- a/Duckling/Dimensions/VI.hs +++ b/Duckling/Dimensions/VI.hs @@ -14,5 +14,5 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Numeral + [ This Numeral ] diff --git a/Duckling/Dimensions/ZH.hs b/Duckling/Dimensions/ZH.hs index f9ce2316..9cc490a1 100644 --- a/Duckling/Dimensions/ZH.hs +++ b/Duckling/Dimensions/ZH.hs @@ -14,9 +14,9 @@ import Duckling.Dimensions.Types allDimensions :: [Some Dimension] allDimensions = - [ Some Duration - , Some Numeral - , Some Ordinal - , Some Temperature - , Some Time + [ This Duration + , This Numeral + , This Ordinal + , This Temperature + , This Time ] diff --git a/Duckling/Distance/EN/Tests.hs b/Duckling/Distance/EN/Tests.hs index 8b996c65..52a2fe64 100644 --- a/Duckling/Distance/EN/Tests.hs +++ b/Duckling/Distance/EN/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Distance/ES/Tests.hs b/Duckling/Distance/ES/Tests.hs index 2489eb14..cc75e049 100644 --- a/Duckling/Distance/ES/Tests.hs +++ b/Duckling/Distance/ES/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Distance.ES.Corpus tests :: TestTree tests = testGroup "ES Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Distance/FR/Tests.hs b/Duckling/Distance/FR/Tests.hs index 74545577..4952acf3 100644 --- a/Duckling/Distance/FR/Tests.hs +++ b/Duckling/Distance/FR/Tests.hs @@ -17,5 +17,5 @@ import Duckling.Distance.FR.Corpus tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Distance/GA/Tests.hs b/Duckling/Distance/GA/Tests.hs index a973c067..d45d8151 100644 --- a/Duckling/Distance/GA/Tests.hs +++ b/Duckling/Distance/GA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Distance/KO/Tests.hs b/Duckling/Distance/KO/Tests.hs index 293af2e5..c84b4f41 100644 --- a/Duckling/Distance/KO/Tests.hs +++ b/Duckling/Distance/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Distance.KO.Corpus tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Distance/NL/Tests.hs b/Duckling/Distance/NL/Tests.hs index 8776df3d..396c695c 100644 --- a/Duckling/Distance/NL/Tests.hs +++ b/Duckling/Distance/NL/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Distance.NL.Corpus tests :: TestTree tests = testGroup "NL Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Distance/PT/Tests.hs b/Duckling/Distance/PT/Tests.hs index d3802c1c..80f91032 100644 --- a/Duckling/Distance/PT/Tests.hs +++ b/Duckling/Distance/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Distance.PT.Corpus tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Distance/RO/Tests.hs b/Duckling/Distance/RO/Tests.hs index 61eab102..a0a362f9 100644 --- a/Duckling/Distance/RO/Tests.hs +++ b/Duckling/Distance/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Distance.RO.Corpus tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Distance] corpus + [ makeCorpusTest [This Distance] corpus ] diff --git a/Duckling/Duration/EN/Tests.hs b/Duckling/Duration/EN/Tests.hs index 2849ea23..fa6c0b11 100644 --- a/Duckling/Duration/EN/Tests.hs +++ b/Duckling/Duration/EN/Tests.hs @@ -20,6 +20,6 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Duration] corpus - , makeNegativeCorpusTest [Some Duration] negativeCorpus + [ makeCorpusTest [This Duration] corpus + , makeNegativeCorpusTest [This Duration] negativeCorpus ] diff --git a/Duckling/Duration/FR/Tests.hs b/Duckling/Duration/FR/Tests.hs index 5c67dbb3..fb60c0d0 100644 --- a/Duckling/Duration/FR/Tests.hs +++ b/Duckling/Duration/FR/Tests.hs @@ -20,6 +20,6 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Duration] corpus - , makeNegativeCorpusTest [Some Duration] negativeCorpus + [ makeCorpusTest [This Duration] corpus + , makeNegativeCorpusTest [This Duration] negativeCorpus ] diff --git a/Duckling/Duration/GA/Tests.hs b/Duckling/Duration/GA/Tests.hs index 2bbb3c82..8dba6b12 100644 --- a/Duckling/Duration/GA/Tests.hs +++ b/Duckling/Duration/GA/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/JA/Tests.hs b/Duckling/Duration/JA/Tests.hs index 5510336a..de05fb2f 100644 --- a/Duckling/Duration/JA/Tests.hs +++ b/Duckling/Duration/JA/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "JA Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/KO/Tests.hs b/Duckling/Duration/KO/Tests.hs index c69b2a68..af4a503b 100644 --- a/Duckling/Duration/KO/Tests.hs +++ b/Duckling/Duration/KO/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/NB/Tests.hs b/Duckling/Duration/NB/Tests.hs index 690f01e5..f3bafaae 100644 --- a/Duckling/Duration/NB/Tests.hs +++ b/Duckling/Duration/NB/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "NB Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/PL/Tests.hs b/Duckling/Duration/PL/Tests.hs index ef216b3f..03e7b741 100644 --- a/Duckling/Duration/PL/Tests.hs +++ b/Duckling/Duration/PL/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PL Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/PT/Tests.hs b/Duckling/Duration/PT/Tests.hs index b1ade5a4..3813b7b4 100644 --- a/Duckling/Duration/PT/Tests.hs +++ b/Duckling/Duration/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/RO/Tests.hs b/Duckling/Duration/RO/Tests.hs index 177cc54f..77c3e31c 100644 --- a/Duckling/Duration/RO/Tests.hs +++ b/Duckling/Duration/RO/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/SV/Tests.hs b/Duckling/Duration/SV/Tests.hs index 2ff2b834..61333b23 100644 --- a/Duckling/Duration/SV/Tests.hs +++ b/Duckling/Duration/SV/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "SV Tests" - [ makeCorpusTest [Some Duration] corpus + [ makeCorpusTest [This Duration] corpus ] diff --git a/Duckling/Duration/ZH/Tests.hs b/Duckling/Duration/ZH/Tests.hs index 69dbe13a..11a09815 100644 --- a/Duckling/Duration/ZH/Tests.hs +++ b/Duckling/Duration/ZH/Tests.hs @@ -24,7 +24,7 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ZH Tests" [ testCase "Corpus Tests" $ - mapM_ (analyzedFirstTest context {lang = ZH} . withTargets [Some Duration]) + mapM_ (analyzedFirstTest context {lang = ZH} . withTargets [This Duration]) xs ] where diff --git a/Duckling/Email/EN/Tests.hs b/Duckling/Email/EN/Tests.hs index 4eb2f916..27ca3136 100644 --- a/Duckling/Email/EN/Tests.hs +++ b/Duckling/Email/EN/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "Email Tests" - [ makeCorpusTest [Some Email] corpus + [ makeCorpusTest [This Email] corpus ] diff --git a/Duckling/Email/FR/Tests.hs b/Duckling/Email/FR/Tests.hs index 03b13a0a..faecc472 100644 --- a/Duckling/Email/FR/Tests.hs +++ b/Duckling/Email/FR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "Email Tests" - [ makeCorpusTest [Some Email] corpus + [ makeCorpusTest [This Email] corpus ] diff --git a/Duckling/Email/IT/Tests.hs b/Duckling/Email/IT/Tests.hs index fe1b7d5f..60a1e0c3 100644 --- a/Duckling/Email/IT/Tests.hs +++ b/Duckling/Email/IT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "Email Tests" - [ makeCorpusTest [Some Email] corpus + [ makeCorpusTest [This Email] corpus ] diff --git a/Duckling/Email/Tests.hs b/Duckling/Email/Tests.hs index 1cb26f9d..9042f9b1 100644 --- a/Duckling/Email/Tests.hs +++ b/Duckling/Email/Tests.hs @@ -21,8 +21,8 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "Email Tests" - [ makeCorpusTest [Some Email] corpus - , makeNegativeCorpusTest [Some Email] negativeCorpus + [ makeCorpusTest [This Email] corpus + , makeNegativeCorpusTest [This Email] negativeCorpus , EN.tests , FR.tests , IT.tests diff --git a/Duckling/Finance/EN/Tests.hs b/Duckling/Finance/EN/Tests.hs index 489dd8e2..b6e1fe14 100644 --- a/Duckling/Finance/EN/Tests.hs +++ b/Duckling/Finance/EN/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/ES/Tests.hs b/Duckling/Finance/ES/Tests.hs index 00e7d3fe..b2b92b4d 100644 --- a/Duckling/Finance/ES/Tests.hs +++ b/Duckling/Finance/ES/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Finance.ES.Corpus tests :: TestTree tests = testGroup "ES Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/FR/Tests.hs b/Duckling/Finance/FR/Tests.hs index a305f48b..26bf8fd1 100644 --- a/Duckling/Finance/FR/Tests.hs +++ b/Duckling/Finance/FR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Finance.FR.Corpus tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/GA/Tests.hs b/Duckling/Finance/GA/Tests.hs index 935e60cc..c56ac514 100644 --- a/Duckling/Finance/GA/Tests.hs +++ b/Duckling/Finance/GA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Finance.GA.Corpus tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/ID/Tests.hs b/Duckling/Finance/ID/Tests.hs index 25aa085b..dc6ecb9e 100644 --- a/Duckling/Finance/ID/Tests.hs +++ b/Duckling/Finance/ID/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Finance.ID.Corpus tests :: TestTree tests = testGroup "ID Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/KO/Tests.hs b/Duckling/Finance/KO/Tests.hs index 2efb5ea4..88ec6eda 100644 --- a/Duckling/Finance/KO/Tests.hs +++ b/Duckling/Finance/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Finance.KO.Corpus tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/NB/Tests.hs b/Duckling/Finance/NB/Tests.hs index b8b95f09..2d1e1f4f 100644 --- a/Duckling/Finance/NB/Tests.hs +++ b/Duckling/Finance/NB/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "NB Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/PT/Tests.hs b/Duckling/Finance/PT/Tests.hs index 786d535c..8eb016ca 100644 --- a/Duckling/Finance/PT/Tests.hs +++ b/Duckling/Finance/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/RO/Tests.hs b/Duckling/Finance/RO/Tests.hs index 1bf308d7..c8fc5d77 100644 --- a/Duckling/Finance/RO/Tests.hs +++ b/Duckling/Finance/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Finance.RO.Corpus tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/SV/Tests.hs b/Duckling/Finance/SV/Tests.hs index 27aef74a..27c53445 100644 --- a/Duckling/Finance/SV/Tests.hs +++ b/Duckling/Finance/SV/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "SV Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Finance/VI/Tests.hs b/Duckling/Finance/VI/Tests.hs index de8ff143..e4fe0788 100644 --- a/Duckling/Finance/VI/Tests.hs +++ b/Duckling/Finance/VI/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "VI Tests" - [ makeCorpusTest [Some Finance] corpus + [ makeCorpusTest [This Finance] corpus ] diff --git a/Duckling/Number/AR/Tests.hs b/Duckling/Number/AR/Tests.hs index ea146509..65fb9d5a 100644 --- a/Duckling/Number/AR/Tests.hs +++ b/Duckling/Number/AR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "AR Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/DA/Tests.hs b/Duckling/Number/DA/Tests.hs index 07f9c402..0efe2727 100644 --- a/Duckling/Number/DA/Tests.hs +++ b/Duckling/Number/DA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "DA Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/DE/Tests.hs b/Duckling/Number/DE/Tests.hs index a14928ea..b4fba315 100644 --- a/Duckling/Number/DE/Tests.hs +++ b/Duckling/Number/DE/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "DE Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/EN/Tests.hs b/Duckling/Number/EN/Tests.hs index 270e9ff6..fa8c1416 100644 --- a/Duckling/Number/EN/Tests.hs +++ b/Duckling/Number/EN/Tests.hs @@ -25,13 +25,13 @@ import Duckling.Testing.Types tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus , surroundTests ] surroundTests :: TestTree surroundTests = testCase "Surround Tests" $ - mapM_ (analyzedFirstTest testContext . withTargets [Some Numeral]) xs + mapM_ (analyzedFirstTest testContext . withTargets [This Numeral]) xs where xs = concat [ examples (NumberValue 3) diff --git a/Duckling/Number/ES/Tests.hs b/Duckling/Number/ES/Tests.hs index 0aead2de..d4d14c63 100644 --- a/Duckling/Number/ES/Tests.hs +++ b/Duckling/Number/ES/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ES Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/ET/Tests.hs b/Duckling/Number/ET/Tests.hs index c946b894..5614dd7a 100644 --- a/Duckling/Number/ET/Tests.hs +++ b/Duckling/Number/ET/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ET Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/FR/Tests.hs b/Duckling/Number/FR/Tests.hs index 60fe6691..2491c3a3 100644 --- a/Duckling/Number/FR/Tests.hs +++ b/Duckling/Number/FR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/GA/Tests.hs b/Duckling/Number/GA/Tests.hs index 5b863cc9..1bff1cb2 100644 --- a/Duckling/Number/GA/Tests.hs +++ b/Duckling/Number/GA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/ID/Tests.hs b/Duckling/Number/ID/Tests.hs index 9b44350c..10ed1267 100644 --- a/Duckling/Number/ID/Tests.hs +++ b/Duckling/Number/ID/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ID Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/IT/Tests.hs b/Duckling/Number/IT/Tests.hs index 8f563ef9..78f2ef8c 100644 --- a/Duckling/Number/IT/Tests.hs +++ b/Duckling/Number/IT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "IT Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/JA/Tests.hs b/Duckling/Number/JA/Tests.hs index 74ac7bec..a0edf77f 100644 --- a/Duckling/Number/JA/Tests.hs +++ b/Duckling/Number/JA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "JA Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/KO/Tests.hs b/Duckling/Number/KO/Tests.hs index 5aebb596..d8b104cb 100644 --- a/Duckling/Number/KO/Tests.hs +++ b/Duckling/Number/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/MY/Tests.hs b/Duckling/Number/MY/Tests.hs index f08471a7..f632d066 100644 --- a/Duckling/Number/MY/Tests.hs +++ b/Duckling/Number/MY/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "MY Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/NB/Tests.hs b/Duckling/Number/NB/Tests.hs index b2539d7b..63f089bf 100644 --- a/Duckling/Number/NB/Tests.hs +++ b/Duckling/Number/NB/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "NB Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/NL/Tests.hs b/Duckling/Number/NL/Tests.hs index 729cfe12..bf709f99 100644 --- a/Duckling/Number/NL/Tests.hs +++ b/Duckling/Number/NL/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "NL Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/PL/Tests.hs b/Duckling/Number/PL/Tests.hs index 29ae2328..c6a8032c 100644 --- a/Duckling/Number/PL/Tests.hs +++ b/Duckling/Number/PL/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PL Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/PT/Tests.hs b/Duckling/Number/PT/Tests.hs index 08de2ad7..6239b743 100644 --- a/Duckling/Number/PT/Tests.hs +++ b/Duckling/Number/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/RO/Tests.hs b/Duckling/Number/RO/Tests.hs index 1ada7a09..3537f7f3 100644 --- a/Duckling/Number/RO/Tests.hs +++ b/Duckling/Number/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/RU/Tests.hs b/Duckling/Number/RU/Tests.hs index 1907c6f9..88e9ea04 100644 --- a/Duckling/Number/RU/Tests.hs +++ b/Duckling/Number/RU/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "RU Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/SV/Tests.hs b/Duckling/Number/SV/Tests.hs index 2b184300..422c3a58 100644 --- a/Duckling/Number/SV/Tests.hs +++ b/Duckling/Number/SV/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "SV Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/TR/Tests.hs b/Duckling/Number/TR/Tests.hs index f0b99f00..374acd9e 100644 --- a/Duckling/Number/TR/Tests.hs +++ b/Duckling/Number/TR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "TR Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/UK/Tests.hs b/Duckling/Number/UK/Tests.hs index 6fc81e21..4e7285e9 100644 --- a/Duckling/Number/UK/Tests.hs +++ b/Duckling/Number/UK/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "UK Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/VI/Tests.hs b/Duckling/Number/VI/Tests.hs index 7674524c..f6739a21 100644 --- a/Duckling/Number/VI/Tests.hs +++ b/Duckling/Number/VI/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "VI Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Number/ZH/Tests.hs b/Duckling/Number/ZH/Tests.hs index 898fe5c5..100a266e 100644 --- a/Duckling/Number/ZH/Tests.hs +++ b/Duckling/Number/ZH/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ZH Tests" - [ makeCorpusTest [Some Numeral] corpus + [ makeCorpusTest [This Numeral] corpus ] diff --git a/Duckling/Ordinal/AR/Tests.hs b/Duckling/Ordinal/AR/Tests.hs index 6687fb1e..a871218c 100644 --- a/Duckling/Ordinal/AR/Tests.hs +++ b/Duckling/Ordinal/AR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "AR Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/DA/Tests.hs b/Duckling/Ordinal/DA/Tests.hs index 3fb682f5..71822dc6 100644 --- a/Duckling/Ordinal/DA/Tests.hs +++ b/Duckling/Ordinal/DA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "DA Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/DE/Tests.hs b/Duckling/Ordinal/DE/Tests.hs index 8b42f1e5..eafd1a39 100644 --- a/Duckling/Ordinal/DE/Tests.hs +++ b/Duckling/Ordinal/DE/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "DE Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/EN/Tests.hs b/Duckling/Ordinal/EN/Tests.hs index f993405f..3312517d 100644 --- a/Duckling/Ordinal/EN/Tests.hs +++ b/Duckling/Ordinal/EN/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/ET/Tests.hs b/Duckling/Ordinal/ET/Tests.hs index f22404b1..36da1409 100644 --- a/Duckling/Ordinal/ET/Tests.hs +++ b/Duckling/Ordinal/ET/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ET Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/FR/Tests.hs b/Duckling/Ordinal/FR/Tests.hs index fb577e93..b0798798 100644 --- a/Duckling/Ordinal/FR/Tests.hs +++ b/Duckling/Ordinal/FR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/GA/Tests.hs b/Duckling/Ordinal/GA/Tests.hs index cce0b22f..9ea78887 100644 --- a/Duckling/Ordinal/GA/Tests.hs +++ b/Duckling/Ordinal/GA/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/ID/Tests.hs b/Duckling/Ordinal/ID/Tests.hs index 56fe7dc8..2c405af6 100644 --- a/Duckling/Ordinal/ID/Tests.hs +++ b/Duckling/Ordinal/ID/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ID Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/IT/Tests.hs b/Duckling/Ordinal/IT/Tests.hs index 9f130226..1bd2b192 100644 --- a/Duckling/Ordinal/IT/Tests.hs +++ b/Duckling/Ordinal/IT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "IT Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/JA/Tests.hs b/Duckling/Ordinal/JA/Tests.hs index c3234c95..947ef53d 100644 --- a/Duckling/Ordinal/JA/Tests.hs +++ b/Duckling/Ordinal/JA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "JA Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/KO/Tests.hs b/Duckling/Ordinal/KO/Tests.hs index f7021cac..203d4be7 100644 --- a/Duckling/Ordinal/KO/Tests.hs +++ b/Duckling/Ordinal/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/NB/Tests.hs b/Duckling/Ordinal/NB/Tests.hs index 8f580efa..5aea822a 100644 --- a/Duckling/Ordinal/NB/Tests.hs +++ b/Duckling/Ordinal/NB/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "NB Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/NL/Tests.hs b/Duckling/Ordinal/NL/Tests.hs index de7f4ae6..f48f9e49 100644 --- a/Duckling/Ordinal/NL/Tests.hs +++ b/Duckling/Ordinal/NL/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "NL Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/PL/Tests.hs b/Duckling/Ordinal/PL/Tests.hs index 52d05a01..2df7e6cf 100644 --- a/Duckling/Ordinal/PL/Tests.hs +++ b/Duckling/Ordinal/PL/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PL Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/PT/Tests.hs b/Duckling/Ordinal/PT/Tests.hs index 362c7d95..ab74660c 100644 --- a/Duckling/Ordinal/PT/Tests.hs +++ b/Duckling/Ordinal/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/RO/Tests.hs b/Duckling/Ordinal/RO/Tests.hs index 82f0be21..e15d036d 100644 --- a/Duckling/Ordinal/RO/Tests.hs +++ b/Duckling/Ordinal/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/RU/Tests.hs b/Duckling/Ordinal/RU/Tests.hs index 3cba4ede..ecc52075 100644 --- a/Duckling/Ordinal/RU/Tests.hs +++ b/Duckling/Ordinal/RU/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "RU Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/SV/Tests.hs b/Duckling/Ordinal/SV/Tests.hs index 8101cb03..55aecb92 100644 --- a/Duckling/Ordinal/SV/Tests.hs +++ b/Duckling/Ordinal/SV/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "SV Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/TR/Tests.hs b/Duckling/Ordinal/TR/Tests.hs index 0275d1ee..cf6b3f18 100644 --- a/Duckling/Ordinal/TR/Tests.hs +++ b/Duckling/Ordinal/TR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "TR Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/UK/Tests.hs b/Duckling/Ordinal/UK/Tests.hs index acbfc1c6..439858d1 100644 --- a/Duckling/Ordinal/UK/Tests.hs +++ b/Duckling/Ordinal/UK/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "UK Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/Ordinal/ZH/Tests.hs b/Duckling/Ordinal/ZH/Tests.hs index cd172ac2..9f80b018 100644 --- a/Duckling/Ordinal/ZH/Tests.hs +++ b/Duckling/Ordinal/ZH/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ZH Tests" - [ makeCorpusTest [Some Ordinal] corpus + [ makeCorpusTest [This Ordinal] corpus ] diff --git a/Duckling/PhoneNumber/Tests.hs b/Duckling/PhoneNumber/Tests.hs index 4a3ad821..08cd7764 100644 --- a/Duckling/PhoneNumber/Tests.hs +++ b/Duckling/PhoneNumber/Tests.hs @@ -25,14 +25,14 @@ import Duckling.Testing.Types tests :: TestTree tests = testGroup "PhoneNumber Tests" - [ makeCorpusTest [Some PhoneNumber] corpus - , makeNegativeCorpusTest [Some PhoneNumber] negativeCorpus + [ makeCorpusTest [This PhoneNumber] corpus + , makeNegativeCorpusTest [This PhoneNumber] negativeCorpus , surroundTests ] surroundTests :: TestTree surroundTests = testCase "Surround Tests" $ - mapM_ (analyzedFirstTest testContext . withTargets [Some PhoneNumber]) xs + mapM_ (analyzedFirstTest testContext . withTargets [This PhoneNumber]) xs where xs = examples (PhoneNumberValue "06354640807") [ "hey 06354640807" diff --git a/Duckling/Quantity/EN/Tests.hs b/Duckling/Quantity/EN/Tests.hs index f9922b60..fb953cf9 100644 --- a/Duckling/Quantity/EN/Tests.hs +++ b/Duckling/Quantity/EN/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Quantity] corpus + [ makeCorpusTest [This Quantity] corpus ] diff --git a/Duckling/Quantity/FR/Tests.hs b/Duckling/Quantity/FR/Tests.hs index 120ca570..bd44f5c9 100644 --- a/Duckling/Quantity/FR/Tests.hs +++ b/Duckling/Quantity/FR/Tests.hs @@ -17,5 +17,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Quantity] corpus + [ makeCorpusTest [This Quantity] corpus ] diff --git a/Duckling/Quantity/KO/Tests.hs b/Duckling/Quantity/KO/Tests.hs index 018e2d4a..103f40c9 100644 --- a/Duckling/Quantity/KO/Tests.hs +++ b/Duckling/Quantity/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Quantity] corpus + [ makeCorpusTest [This Quantity] corpus ] diff --git a/Duckling/Quantity/PT/Tests.hs b/Duckling/Quantity/PT/Tests.hs index cef9e65f..941628d9 100644 --- a/Duckling/Quantity/PT/Tests.hs +++ b/Duckling/Quantity/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Quantity] corpus + [ makeCorpusTest [This Quantity] corpus ] diff --git a/Duckling/Quantity/RO/Tests.hs b/Duckling/Quantity/RO/Tests.hs index 78f3b086..42068b96 100644 --- a/Duckling/Quantity/RO/Tests.hs +++ b/Duckling/Quantity/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Quantity] corpus + [ makeCorpusTest [This Quantity] corpus ] diff --git a/Duckling/Ranking/Generate.hs b/Duckling/Ranking/Generate.hs index a7d4d8fd..511aba93 100644 --- a/Duckling/Ranking/Generate.hs +++ b/Duckling/Ranking/Generate.hs @@ -58,7 +58,7 @@ regenClassifiers lang = do where filepath = "Duckling/Ranking/Classifiers/" ++ show lang ++ ".hs" - rules = rulesFor lang . HashSet.singleton $ Some Time + rules = rulesFor lang . HashSet.singleton $ This Time -- | The trained classifier to write out classifiers = makeClassifiers rules trainSet diff --git a/Duckling/Ranking/Rank.hs b/Duckling/Ranking/Rank.hs index 2fb56bff..58350855 100644 --- a/Duckling/Ranking/Rank.hs +++ b/Duckling/Ranking/Rank.hs @@ -65,4 +65,4 @@ rank classifiers targets tokens = where makeCandidate :: ResolvedToken -> Candidate makeCandidate token@Resolved {node = n@Node {token = Token d _}} = - Candidate token (score classifiers n) $ HashSet.member (Some d) targets + Candidate token (score classifiers n) $ HashSet.member (This d) targets diff --git a/Duckling/Rules/AR.hs b/Duckling/Rules/AR.hs index e7a4e583..4aa4d4bc 100644 --- a/Duckling/Rules/AR.hs +++ b/Duckling/Rules/AR.hs @@ -19,17 +19,17 @@ import qualified Duckling.Ordinal.AR.Rules as Ordinal import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/Common.hs b/Duckling/Rules/Common.hs index 89c0ddb9..852c8ad4 100644 --- a/Duckling/Rules/Common.hs +++ b/Duckling/Rules/Common.hs @@ -25,17 +25,17 @@ import qualified Duckling.Url.Rules as Url import qualified Duckling.Volume.Rules as Volume rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = Duration.rules -rules (Some Numeral) = [] -rules (Some Email) = Email.rules -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = [] -rules (Some PhoneNumber) = PhoneNumber.rules -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = Url.rules -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = Duration.rules +rules (This Numeral) = [] +rules (This Email) = Email.rules +rules (This Finance) = Finance.rules +rules (This Ordinal) = [] +rules (This PhoneNumber) = PhoneNumber.rules +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = Url.rules +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/DA.hs b/Duckling/Rules/DA.hs index 143dd7b7..5bdcbf00 100644 --- a/Duckling/Rules/DA.hs +++ b/Duckling/Rules/DA.hs @@ -22,17 +22,17 @@ import qualified Duckling.TimeGrain.DA.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/DE.hs b/Duckling/Rules/DE.hs index 7c9f7739..3dc6f5ca 100644 --- a/Duckling/Rules/DE.hs +++ b/Duckling/Rules/DE.hs @@ -22,17 +22,17 @@ import qualified Duckling.TimeGrain.DE.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/EN.hs b/Duckling/Rules/EN.hs index a48806ab..ef86efe3 100644 --- a/Duckling/Rules/EN.hs +++ b/Duckling/Rules/EN.hs @@ -28,17 +28,17 @@ import Duckling.Types import qualified Duckling.Volume.EN.Rules as Volume rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = Email.rules -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = Quantity.rules -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = Email.rules +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = Quantity.rules +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/ES.hs b/Duckling/Rules/ES.hs index 0c3d3bdf..a82c9672 100644 --- a/Duckling/Rules/ES.hs +++ b/Duckling/Rules/ES.hs @@ -25,17 +25,17 @@ import qualified Duckling.Volume.ES.Rules as Volume import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/ET.hs b/Duckling/Rules/ET.hs index adeae3c4..aa220645 100644 --- a/Duckling/Rules/ET.hs +++ b/Duckling/Rules/ET.hs @@ -19,17 +19,17 @@ import qualified Duckling.Ordinal.ET.Rules as Ordinal import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/FR.hs b/Duckling/Rules/FR.hs index cb3d6b26..61560aea 100644 --- a/Duckling/Rules/FR.hs +++ b/Duckling/Rules/FR.hs @@ -28,17 +28,17 @@ import qualified Duckling.Volume.FR.Rules as Volume import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = Email.rules -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = Quantity.rules -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = Email.rules +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = Quantity.rules +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/GA.hs b/Duckling/Rules/GA.hs index 71801f3d..42e206d8 100644 --- a/Duckling/Rules/GA.hs +++ b/Duckling/Rules/GA.hs @@ -26,17 +26,17 @@ import qualified Duckling.Volume.GA.Rules as Volume import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/ID.hs b/Duckling/Rules/ID.hs index 4072fe2e..ca8c329b 100644 --- a/Duckling/Rules/ID.hs +++ b/Duckling/Rules/ID.hs @@ -20,17 +20,17 @@ import qualified Duckling.Ordinal.ID.Rules as Ordinal import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/IT.hs b/Duckling/Rules/IT.hs index c044ccb1..ff0f1726 100644 --- a/Duckling/Rules/IT.hs +++ b/Duckling/Rules/IT.hs @@ -23,17 +23,17 @@ import qualified Duckling.TimeGrain.IT.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = Email.rules -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = Email.rules +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/JA.hs b/Duckling/Rules/JA.hs index 7f8c73b1..dd85f926 100644 --- a/Duckling/Rules/JA.hs +++ b/Duckling/Rules/JA.hs @@ -21,17 +21,17 @@ import qualified Duckling.TimeGrain.JA.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = [] -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = [] +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/KO.hs b/Duckling/Rules/KO.hs index b300193d..46a755e9 100644 --- a/Duckling/Rules/KO.hs +++ b/Duckling/Rules/KO.hs @@ -27,17 +27,17 @@ import Duckling.Types import qualified Duckling.Volume.KO.Rules as Volume rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = Quantity.rules -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = Quantity.rules +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/MY.hs b/Duckling/Rules/MY.hs index 9878761a..57018c9b 100644 --- a/Duckling/Rules/MY.hs +++ b/Duckling/Rules/MY.hs @@ -18,17 +18,17 @@ import qualified Duckling.Number.MY.Rules as Number import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = [] -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = [] +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/NB.hs b/Duckling/Rules/NB.hs index e018911f..4b849733 100644 --- a/Duckling/Rules/NB.hs +++ b/Duckling/Rules/NB.hs @@ -23,17 +23,17 @@ import qualified Duckling.TimeGrain.NB.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/NL.hs b/Duckling/Rules/NL.hs index 0fc8dc85..a81013c1 100644 --- a/Duckling/Rules/NL.hs +++ b/Duckling/Rules/NL.hs @@ -21,17 +21,17 @@ import qualified Duckling.Volume.NL.Rules as Volume import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/PL.hs b/Duckling/Rules/PL.hs index 2856f027..98f26723 100644 --- a/Duckling/Rules/PL.hs +++ b/Duckling/Rules/PL.hs @@ -22,17 +22,17 @@ import qualified Duckling.TimeGrain.PL.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/PT.hs b/Duckling/Rules/PT.hs index 877b424d..8618f907 100644 --- a/Duckling/Rules/PT.hs +++ b/Duckling/Rules/PT.hs @@ -26,17 +26,17 @@ import Duckling.Types import qualified Duckling.Volume.PT.Rules as Volume rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = Quantity.rules -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = Quantity.rules +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/RO.hs b/Duckling/Rules/RO.hs index 39ffb856..5f922822 100644 --- a/Duckling/Rules/RO.hs +++ b/Duckling/Rules/RO.hs @@ -27,17 +27,17 @@ import qualified Duckling.Volume.RO.Rules as Volume import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = Distance.rules -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = Quantity.rules -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = Volume.rules +rules (This Distance) = Distance.rules +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = Quantity.rules +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = Volume.rules diff --git a/Duckling/Rules/RU.hs b/Duckling/Rules/RU.hs index 0a4d3fae..5c65d245 100644 --- a/Duckling/Rules/RU.hs +++ b/Duckling/Rules/RU.hs @@ -19,17 +19,17 @@ import qualified Duckling.Ordinal.RU.Rules as Ordinal import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/SV.hs b/Duckling/Rules/SV.hs index 83364205..13f2048e 100644 --- a/Duckling/Rules/SV.hs +++ b/Duckling/Rules/SV.hs @@ -23,17 +23,17 @@ import qualified Duckling.TimeGrain.SV.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = Duration.rules -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = Duration.rules +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/TR.hs b/Duckling/Rules/TR.hs index 35443d2f..2479f953 100644 --- a/Duckling/Rules/TR.hs +++ b/Duckling/Rules/TR.hs @@ -19,17 +19,17 @@ import qualified Duckling.Ordinal.TR.Rules as Ordinal import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/UK.hs b/Duckling/Rules/UK.hs index a9e8d1ca..d2191bb8 100644 --- a/Duckling/Rules/UK.hs +++ b/Duckling/Rules/UK.hs @@ -19,17 +19,17 @@ import qualified Duckling.Ordinal.UK.Rules as Ordinal import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/VI.hs b/Duckling/Rules/VI.hs index 4bc9a600..8b30256d 100644 --- a/Duckling/Rules/VI.hs +++ b/Duckling/Rules/VI.hs @@ -19,17 +19,17 @@ import qualified Duckling.Number.VI.Rules as Number import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = Finance.rules -rules (Some Ordinal) = [] -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = [] -rules (Some Time) = [] -rules (Some TimeGrain) = [] -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = Finance.rules +rules (This Ordinal) = [] +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = [] +rules (This Time) = [] +rules (This TimeGrain) = [] +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Rules/ZH.hs b/Duckling/Rules/ZH.hs index 260d39a0..229218f2 100644 --- a/Duckling/Rules/ZH.hs +++ b/Duckling/Rules/ZH.hs @@ -22,17 +22,17 @@ import qualified Duckling.TimeGrain.ZH.Rules as TimeGrain import Duckling.Types rules :: Some Dimension -> [Rule] -rules (Some Distance) = [] -rules (Some Duration) = [] -rules (Some Numeral) = Number.rules -rules (Some Email) = [] -rules (Some Finance) = [] -rules (Some Ordinal) = Ordinal.rules -rules (Some PhoneNumber) = [] -rules (Some Quantity) = [] -rules (Some RegexMatch) = [] -rules (Some Temperature) = Temperature.rules -rules (Some Time) = Time.rules -rules (Some TimeGrain) = TimeGrain.rules -rules (Some Url) = [] -rules (Some Volume) = [] +rules (This Distance) = [] +rules (This Duration) = [] +rules (This Numeral) = Number.rules +rules (This Email) = [] +rules (This Finance) = [] +rules (This Ordinal) = Ordinal.rules +rules (This PhoneNumber) = [] +rules (This Quantity) = [] +rules (This RegexMatch) = [] +rules (This Temperature) = Temperature.rules +rules (This Time) = Time.rules +rules (This TimeGrain) = TimeGrain.rules +rules (This Url) = [] +rules (This Volume) = [] diff --git a/Duckling/Temperature/EN/Tests.hs b/Duckling/Temperature/EN/Tests.hs index 3d441b54..d39176eb 100644 --- a/Duckling/Temperature/EN/Tests.hs +++ b/Duckling/Temperature/EN/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/ES/Tests.hs b/Duckling/Temperature/ES/Tests.hs index cb730f22..d5a183e4 100644 --- a/Duckling/Temperature/ES/Tests.hs +++ b/Duckling/Temperature/ES/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ES Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/FR/Tests.hs b/Duckling/Temperature/FR/Tests.hs index 17b0e4e6..72d1194a 100644 --- a/Duckling/Temperature/FR/Tests.hs +++ b/Duckling/Temperature/FR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/GA/Tests.hs b/Duckling/Temperature/GA/Tests.hs index de3f08bd..76e52aa6 100644 --- a/Duckling/Temperature/GA/Tests.hs +++ b/Duckling/Temperature/GA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/JA/Tests.hs b/Duckling/Temperature/JA/Tests.hs index 1157c632..a0453ce1 100644 --- a/Duckling/Temperature/JA/Tests.hs +++ b/Duckling/Temperature/JA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "JA Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/KO/Tests.hs b/Duckling/Temperature/KO/Tests.hs index 8c612ef5..19baafda 100644 --- a/Duckling/Temperature/KO/Tests.hs +++ b/Duckling/Temperature/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/PT/Tests.hs b/Duckling/Temperature/PT/Tests.hs index d91a2533..740844e6 100644 --- a/Duckling/Temperature/PT/Tests.hs +++ b/Duckling/Temperature/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/RO/Tests.hs b/Duckling/Temperature/RO/Tests.hs index 7e1b70e8..0c8eb195 100644 --- a/Duckling/Temperature/RO/Tests.hs +++ b/Duckling/Temperature/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Temperature/ZH/Tests.hs b/Duckling/Temperature/ZH/Tests.hs index 320019c5..4c954c7d 100644 --- a/Duckling/Temperature/ZH/Tests.hs +++ b/Duckling/Temperature/ZH/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Testing.Asserts tests :: TestTree tests = testGroup "ZH Tests" - [ makeCorpusTest [Some Temperature] corpus + [ makeCorpusTest [This Temperature] corpus ] diff --git a/Duckling/Testing/Asserts.hs b/Duckling/Testing/Asserts.hs index ca905524..434842e4 100644 --- a/Duckling/Testing/Asserts.hs +++ b/Duckling/Testing/Asserts.hs @@ -42,7 +42,7 @@ analyzedTargetTest context (input, target) = msg = "analyze " ++ show (input, [target]) ++ "dimensions = " ++ show dimensions dimensions = flip map (analyze input context $ HashSet.singleton target) $ - \(Resolved{node=Node{token=Token dimension _}}) -> Some dimension + \(Resolved{node=Node{token=Token dimension _}}) -> This dimension analyzedFirstTest :: Context -> (Text, [Some Dimension], TestPredicate) -> IO () analyzedFirstTest context (input, targets, predicate) = diff --git a/Duckling/Time/DA/Tests.hs b/Duckling/Time/DA/Tests.hs index 068d97b2..a91ad601 100644 --- a/Duckling/Time/DA/Tests.hs +++ b/Duckling/Time/DA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.DA.Corpus tests :: TestTree tests = testGroup "DA Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/DE/Tests.hs b/Duckling/Time/DE/Tests.hs index 3a3dd7ed..175f3e8f 100644 --- a/Duckling/Time/DE/Tests.hs +++ b/Duckling/Time/DE/Tests.hs @@ -19,6 +19,6 @@ import Duckling.Time.DE.Corpus tests :: TestTree tests = testGroup "DE Tests" - [ makeCorpusTest [Some Time] corpus - , makeNegativeCorpusTest [Some Time] negativeCorpus + [ makeCorpusTest [This Time] corpus + , makeNegativeCorpusTest [This Time] negativeCorpus ] diff --git a/Duckling/Time/EN/Tests.hs b/Duckling/Time/EN/Tests.hs index e2592473..de32327d 100644 --- a/Duckling/Time/EN/Tests.hs +++ b/Duckling/Time/EN/Tests.hs @@ -31,8 +31,8 @@ import Duckling.TimeGrain.Types (Grain(..)) tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Time] corpus - , makeNegativeCorpusTest [Some Time] negativeCorpus + [ makeCorpusTest [This Time] corpus + , makeNegativeCorpusTest [This Time] negativeCorpus , exactSecondTests , valuesTest , intersectTests @@ -40,7 +40,7 @@ tests = testGroup "EN Tests" exactSecondTests :: TestTree exactSecondTests = testCase "Exact Second Tests" $ - mapM_ (analyzedFirstTest context . withTargets [Some Time]) xs + mapM_ (analyzedFirstTest context . withTargets [This Time]) xs where context = testContext {referenceTime = refTime (2016, 12, 6, 13, 21, 42) 1} xs = concat @@ -58,7 +58,7 @@ exactSecondTests = testCase "Exact Second Tests" $ valuesTest :: TestTree valuesTest = testCase "Values Test" $ - mapM_ (analyzedFirstTest testContext . withTargets [Some Time]) xs + mapM_ (analyzedFirstTest testContext . withTargets [This Time]) xs where xs = examplesCustom (parserCheck 1 parseValuesSize) [ "now" @@ -72,7 +72,7 @@ valuesTest = testCase "Values Test" $ intersectTests :: TestTree intersectTests = testCase "Intersect Test" $ - mapM_ (analyzedNTest testContext . withTargets [Some Time]) xs + mapM_ (analyzedNTest testContext . withTargets [This Time]) xs where xs = [ ("tomorrow July", 2) , ("Mar tonight", 2) diff --git a/Duckling/Time/ES/Tests.hs b/Duckling/Time/ES/Tests.hs index 2c831770..a98913ab 100644 --- a/Duckling/Time/ES/Tests.hs +++ b/Duckling/Time/ES/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.ES.Corpus tests :: TestTree tests = testGroup "ES Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/FR/Tests.hs b/Duckling/Time/FR/Tests.hs index 8424e4ec..161b2591 100644 --- a/Duckling/Time/FR/Tests.hs +++ b/Duckling/Time/FR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.FR.Corpus tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/GA/Tests.hs b/Duckling/Time/GA/Tests.hs index 7ea1d88b..7f80543e 100644 --- a/Duckling/Time/GA/Tests.hs +++ b/Duckling/Time/GA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.GA.Corpus tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/IT/Tests.hs b/Duckling/Time/IT/Tests.hs index 1689ebf2..03dacaa0 100644 --- a/Duckling/Time/IT/Tests.hs +++ b/Duckling/Time/IT/Tests.hs @@ -19,6 +19,6 @@ import Duckling.Time.IT.Corpus tests :: TestTree tests = testGroup "IT Tests" - [ makeCorpusTest [Some Time] corpus - , makeNegativeCorpusTest [Some Time] negativeCorpus + [ makeCorpusTest [This Time] corpus + , makeNegativeCorpusTest [This Time] negativeCorpus ] diff --git a/Duckling/Time/KO/Tests.hs b/Duckling/Time/KO/Tests.hs index c0edbfc2..33d6a834 100644 --- a/Duckling/Time/KO/Tests.hs +++ b/Duckling/Time/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.KO.Corpus tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/NB/Tests.hs b/Duckling/Time/NB/Tests.hs index 495f454b..ca00dab6 100644 --- a/Duckling/Time/NB/Tests.hs +++ b/Duckling/Time/NB/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.NB.Corpus tests :: TestTree tests = testGroup "NB Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/PL/Tests.hs b/Duckling/Time/PL/Tests.hs index 1c50e16d..67d1b7d8 100644 --- a/Duckling/Time/PL/Tests.hs +++ b/Duckling/Time/PL/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.PL.Corpus tests :: TestTree tests = testGroup "PL Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/PT/Tests.hs b/Duckling/Time/PT/Tests.hs index c91b3011..df4ea8c4 100644 --- a/Duckling/Time/PT/Tests.hs +++ b/Duckling/Time/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.PT.Corpus tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/RO/Tests.hs b/Duckling/Time/RO/Tests.hs index 88c1c927..93511376 100644 --- a/Duckling/Time/RO/Tests.hs +++ b/Duckling/Time/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.RO.Corpus tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Time/SV/Tests.hs b/Duckling/Time/SV/Tests.hs index 28d989af..69d6a54a 100644 --- a/Duckling/Time/SV/Tests.hs +++ b/Duckling/Time/SV/Tests.hs @@ -30,7 +30,7 @@ import Duckling.TimeGrain.Types (Grain(..)) tests :: TestTree tests = testGroup "SV Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus , ambiguousTests ] @@ -44,7 +44,7 @@ ambiguousTests = testCase "Ambiguous Tests" $ mapM_ check xs [ "i morgonen" ] ctx = testContext {lang = SV} - dims = HashSet.singleton $ Some Time + dims = HashSet.singleton $ This Time check :: Example -> IO () check (input, predicate) = case analyze input ctx dims of [] -> assertFailure $ "empty result on " ++ show input diff --git a/Duckling/Time/Tests.hs b/Duckling/Time/Tests.hs index 91d5ac37..43d761a9 100644 --- a/Duckling/Time/Tests.hs +++ b/Duckling/Time/Tests.hs @@ -61,7 +61,7 @@ tests = testGroup "Time Tests" timeFormatTest :: TestTree timeFormatTest = testCase "Format Test" $ - mapM_ (analyzedFirstTest testContext . withTargets [Some Time]) xs + mapM_ (analyzedFirstTest testContext . withTargets [This Time]) xs where xs = examplesCustom (parserCheck expected parseValue) ["now"] expected = "2013-02-12T04:30:00.000-02:00" diff --git a/Duckling/Time/ZH/Tests.hs b/Duckling/Time/ZH/Tests.hs index 138d31aa..cd1cb6c1 100644 --- a/Duckling/Time/ZH/Tests.hs +++ b/Duckling/Time/ZH/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Time.ZH.Corpus tests :: TestTree tests = testGroup "ZH Tests" - [ makeCorpusTest [Some Time] corpus + [ makeCorpusTest [This Time] corpus ] diff --git a/Duckling/Types.hs b/Duckling/Types.hs index d16469e8..add146d9 100644 --- a/Duckling/Types.hs +++ b/Duckling/Types.hs @@ -20,6 +20,7 @@ module Duckling.Types where import Control.DeepSeq import Data.Aeson import qualified Data.ByteString.Lazy as LB +import Data.GADT.Compare import Data.Hashable import Data.Maybe import Data.Text (Text) @@ -41,7 +42,7 @@ data Token = forall a . (Resolve a, Eq a, Hashable a, Show a, NFData a) => deriving instance Show Token instance Eq Token where - Token d1 v1 == Token d2 v2 = case dimEq d1 d2 of + Token d1 v1 == Token d2 v2 = case geq d1 d2 of Just Refl -> v1 == v2 Nothing -> False @@ -52,7 +53,7 @@ instance NFData Token where rnf (Token _ v) = rnf v isDimension :: Dimension a -> Token -> Bool -isDimension dim (Token dim' _) = isJust $ dimEq dim dim' +isDimension dim (Token dim' _) = isJust $ geq dim dim' data Node = Node { nodeRange :: Range diff --git a/Duckling/Url/Tests.hs b/Duckling/Url/Tests.hs index bbd9c4cc..6c61a620 100644 --- a/Duckling/Url/Tests.hs +++ b/Duckling/Url/Tests.hs @@ -25,14 +25,14 @@ import Duckling.Url.Types tests :: TestTree tests = testGroup "Url Tests" - [ makeCorpusTest [Some Url] corpus - , makeNegativeCorpusTest [Some Url] negativeCorpus + [ makeCorpusTest [This Url] corpus + , makeNegativeCorpusTest [This Url] negativeCorpus , surroundTests ] surroundTests :: TestTree surroundTests = testCase "Surround Tests" $ - mapM_ (analyzedFirstTest testContext . withTargets [Some Url]) xs + mapM_ (analyzedFirstTest testContext . withTargets [This Url]) xs where xs = examples (UrlData "www.lets-try-this-one.co.uk/episode-7" "lets-try-this-one.co.uk") [ "phishing link: www.lets-try-this-one.co.uk/episode-7 If you want my job" diff --git a/Duckling/Volume/EN/Tests.hs b/Duckling/Volume/EN/Tests.hs index 97a36d33..005f15b4 100644 --- a/Duckling/Volume/EN/Tests.hs +++ b/Duckling/Volume/EN/Tests.hs @@ -20,5 +20,5 @@ import Duckling.Volume.EN.Corpus tests :: TestTree tests = testGroup "EN Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/Duckling/Volume/ES/Tests.hs b/Duckling/Volume/ES/Tests.hs index 06244244..5192f20d 100644 --- a/Duckling/Volume/ES/Tests.hs +++ b/Duckling/Volume/ES/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Volume.ES.Corpus tests :: TestTree tests = testGroup "ES Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/Duckling/Volume/FR/Tests.hs b/Duckling/Volume/FR/Tests.hs index 3a56b4ee..1d7730b8 100644 --- a/Duckling/Volume/FR/Tests.hs +++ b/Duckling/Volume/FR/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Volume.FR.Corpus tests :: TestTree tests = testGroup "FR Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/Duckling/Volume/GA/Tests.hs b/Duckling/Volume/GA/Tests.hs index 650972f7..8388b08a 100644 --- a/Duckling/Volume/GA/Tests.hs +++ b/Duckling/Volume/GA/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Volume.GA.Corpus tests :: TestTree tests = testGroup "GA Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/Duckling/Volume/KO/Tests.hs b/Duckling/Volume/KO/Tests.hs index 50ebfe46..145e8d6c 100644 --- a/Duckling/Volume/KO/Tests.hs +++ b/Duckling/Volume/KO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Volume.KO.Corpus tests :: TestTree tests = testGroup "KO Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/Duckling/Volume/NL/Tests.hs b/Duckling/Volume/NL/Tests.hs index f903aa35..893e2d3f 100644 --- a/Duckling/Volume/NL/Tests.hs +++ b/Duckling/Volume/NL/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Volume.NL.Corpus tests :: TestTree tests = testGroup "NL Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/Duckling/Volume/PT/Tests.hs b/Duckling/Volume/PT/Tests.hs index 6d5bdc3a..02f7abdb 100644 --- a/Duckling/Volume/PT/Tests.hs +++ b/Duckling/Volume/PT/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Volume.PT.Corpus tests :: TestTree tests = testGroup "PT Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/Duckling/Volume/RO/Tests.hs b/Duckling/Volume/RO/Tests.hs index 85996045..c185fedd 100644 --- a/Duckling/Volume/RO/Tests.hs +++ b/Duckling/Volume/RO/Tests.hs @@ -19,5 +19,5 @@ import Duckling.Volume.RO.Corpus tests :: TestTree tests = testGroup "RO Tests" - [ makeCorpusTest [Some Volume] corpus + [ makeCorpusTest [This Volume] corpus ] diff --git a/ExampleMain.hs b/ExampleMain.hs index e7747fdd..8d9148dd 100644 --- a/ExampleMain.hs +++ b/ExampleMain.hs @@ -19,4 +19,4 @@ main = do tzs <- loadTimeZoneSeries "/usr/share/zoneinfo/" refTime <- currentReftime tzs "America/Los_Angeles" let context = Context {referenceTime = refTime, lang = EN} - print $ parse "tomorrow at 6ish pm" context [Some Time] + print $ parse "tomorrow at 6ish pm" context [This Time] diff --git a/duckling.cabal b/duckling.cabal index 90ce0395..e5051d2c 100644 --- a/duckling.cabal +++ b/duckling.cabal @@ -437,6 +437,7 @@ library , bytestring >= 0.10.6.0 && < 0.11 , containers >= 0.5.6.2 && < 0.6 , deepseq >= 1.4.1.1 && < 1.5 + , dependent-sum >= 0.3.2.2 && < 0.5 , hashable >= 1.2.4.0 && < 1.3 , regex-base >= 0.93.2 && < 0.94 , regex-pcre >= 0.94.4 && < 0.95 @@ -459,6 +460,7 @@ test-suite duckling-test , bytestring >= 0.10.6.0 && < 0.11 , containers >= 0.5.6.2 && < 0.6 , deepseq >= 1.4.1.1 && < 1.5 + , dependent-sum >= 0.3.2.2 && < 0.5 , hashable >= 1.2.4.0 && < 1.3 , regex-base >= 0.93.2 && < 0.94 , regex-pcre >= 0.94.4 && < 0.95 @@ -644,6 +646,7 @@ executable duckling-regen-exe , bytestring >= 0.10.6.0 && < 0.11 , containers >= 0.5.6.2 && < 0.6 , deepseq >= 1.4.1.1 && < 1.5 + , dependent-sum >= 0.3.2.2 && < 0.5 , hashable >= 1.2.4.0 && < 1.3 , haskell-src-exts >= 1.17.1 && < 1.18 , regex-base >= 0.93.2 && < 0.94 @@ -667,6 +670,7 @@ executable duckling-example-exe , bytestring >= 0.10.6.0 && < 0.11 , containers >= 0.5.6.2 && < 0.6 , deepseq >= 1.4.1.1 && < 1.5 + , dependent-sum >= 0.3.2.2 && < 0.5 , directory >= 1.2.2.0 && < 1.3 , extra >= 1.4.10 && < 1.5 , filepath >= 1.4.0.0 && < 1.5