Remove redundant brackets and language pragmas

Summary: .

Reviewed By: JonCoens

Differential Revision: D6838082

fbshipit-source-id: 94757bdb80c6d3c29a7a6554429940a1b7403108
This commit is contained in:
Julien Odent 2018-01-29 16:41:23 -08:00 committed by Facebook Github Bot
parent 81a97575f6
commit bef7a44fa8
134 changed files with 511 additions and 491 deletions

View File

@ -83,7 +83,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -97,7 +97,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -113,7 +113,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -129,7 +129,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -157,9 +157,10 @@ ruleIntervalBetweenNumeral = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = from}):
Token Numeral NumeralData{TNumeral.value = from}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c
_ -> Nothing
@ -176,9 +177,11 @@ ruleIntervalBetween = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just from,
TAmountOfMoney.currency = c1}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c2}:
_) | c1 == c2 ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1
_ -> Nothing
@ -193,9 +196,10 @@ ruleIntervalNumeralDash = Rule
, financeWith TAmountOfMoney.value isJust
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = from}):
(Token Numeral NumeralData{TNumeral.value = from}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c
_ -> Nothing
@ -210,9 +214,11 @@ ruleIntervalDash = Rule
, financeWith TAmountOfMoney.value isJust
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):
(Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just from,
TAmountOfMoney.currency = c1}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c2}:
_) | c1 == c2 ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1
_ -> Nothing
@ -227,7 +233,8 @@ ruleIntervalMax = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) -> Just . Token AmountOfMoney . withMax to $ currencyOnly c
_ -> Nothing
}
@ -241,7 +248,8 @@ ruleIntervalMin = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) -> Just . Token AmountOfMoney . withMin to $ currencyOnly c
_ -> Nothing
}

View File

@ -138,7 +138,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -152,7 +152,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -168,7 +168,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -184,7 +184,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -212,9 +212,10 @@ ruleIntervalBetweenNumeral = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = from}):
Token Numeral NumeralData{TNumeral.value = from}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c
_ -> Nothing
@ -231,9 +232,11 @@ ruleIntervalBetween = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just from,
TAmountOfMoney.currency = c1}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c2}:
_) | c1 == c2 ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1
_ -> Nothing
@ -248,9 +251,10 @@ ruleIntervalNumeralDash = Rule
, financeWith TAmountOfMoney.value isJust
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = from}):
(Token Numeral NumeralData{TNumeral.value = from}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c
_ -> Nothing
@ -265,9 +269,11 @@ ruleIntervalDash = Rule
, financeWith TAmountOfMoney.value isJust
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):
(Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just from,
TAmountOfMoney.currency = c1}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c2}:
_) | c1 == c2 ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1
_ -> Nothing
@ -282,7 +288,8 @@ ruleIntervalMax = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) -> Just . Token AmountOfMoney . withMax to $ currencyOnly c
_ -> Nothing
}
@ -296,7 +303,8 @@ ruleIntervalMin = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) -> Just . Token AmountOfMoney . withMin to $ currencyOnly c
_ -> Nothing
}

View File

@ -62,7 +62,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -76,7 +76,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -92,7 +92,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -106,7 +106,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -35,7 +35,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -70,7 +70,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -95,7 +95,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -109,7 +109,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -63,7 +63,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -88,7 +88,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -102,7 +102,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -127,7 +127,7 @@ ruleIntersectAgusNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -37,7 +37,7 @@ ruleIntersectAndNumber = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -80,7 +80,7 @@ ruleIntersectIXLipa = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -94,7 +94,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -126,7 +126,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.AmountOfMoney.Helpers
( currencyOnly

View File

@ -60,7 +60,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -94,7 +94,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -35,7 +35,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -70,7 +70,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -86,7 +86,7 @@ ruleIntersectXCentsWithAnd = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -120,7 +120,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -134,7 +134,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -35,7 +35,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -67,7 +67,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -92,7 +92,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -106,7 +106,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -37,7 +37,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -108,7 +108,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -122,7 +122,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -159,7 +159,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -91,7 +91,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -105,7 +105,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -121,7 +121,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -137,7 +137,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -165,9 +165,10 @@ ruleIntervalBetweenNumeral = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = from}):
Token Numeral NumeralData{TNumeral.value = from}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c
_ -> Nothing
@ -184,9 +185,10 @@ ruleIntervalBetweenNumeral2 = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just from,
TAmountOfMoney.currency = c}:
_:
Token Numeral (NumeralData {TNumeral.value = to}):
Token Numeral NumeralData{TNumeral.value = to}:
_) ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c
_ -> Nothing
@ -203,9 +205,11 @@ ruleIntervalBetween = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just from,
TAmountOfMoney.currency = c1}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c2}:
_) | c1 == c2 ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1
_ -> Nothing
@ -220,9 +224,10 @@ ruleIntervalNumeralDash = Rule
, financeWith TAmountOfMoney.value isJust
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = from}):
(Token Numeral NumeralData{TNumeral.value = from}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c
_ -> Nothing
@ -237,9 +242,11 @@ ruleIntervalDash = Rule
, financeWith TAmountOfMoney.value isJust
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):
(Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just from,
TAmountOfMoney.currency = c1}:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c2}:
_) | c1 == c2 ->
Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1
_ -> Nothing
@ -254,7 +261,8 @@ ruleIntervalMax = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) -> Just . Token AmountOfMoney . withMax to $ currencyOnly c
_ -> Nothing
}
@ -268,7 +276,8 @@ ruleIntervalMin = Rule
]
, prod = \tokens -> case tokens of
(_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just to,
TAmountOfMoney.currency = c}:
_) -> Just . Token AmountOfMoney . withMin to $ currencyOnly c
_ -> Nothing
}

View File

@ -119,8 +119,8 @@ ruleAmountUnit = Rule
, financeWith TAmountOfMoney.value isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.currency = c}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.currency = c}:
_) -> Just . Token AmountOfMoney . withValue v $ currencyOnly c
_ -> Nothing
}
@ -133,8 +133,8 @@ ruleUnitAmount = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.currency = c}):
Token Numeral (NumeralData {TNumeral.value = v}):
(Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.currency = c}:
Token Numeral NumeralData{TNumeral.value = v}:
_) -> Just . Token AmountOfMoney . withValue v $ currencyOnly c
_ -> Nothing
}

View File

@ -35,7 +35,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -82,7 +82,7 @@ ruleIntersectXCents = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -116,7 +116,7 @@ ruleIntersectAndXCents = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -130,7 +130,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -78,7 +78,7 @@ ruleIntersect = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -94,7 +94,7 @@ ruleIntersectAndNumeral = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token Numeral (NumeralData {TNumeral.value = c}):
Token Numeral NumeralData{TNumeral.value = c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -108,7 +108,7 @@ ruleIntersectXXuxen = Rule
]
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}
@ -124,7 +124,7 @@ ruleIntersectVXXuxen = Rule
, prod = \tokens -> case tokens of
(Token AmountOfMoney fd:
_:
Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just c}):
Token AmountOfMoney AmountOfMoneyData{TAmountOfMoney.value = Just c}:
_) -> Just . Token AmountOfMoney $ withCents c fd
_ -> Nothing
}

View File

@ -48,14 +48,14 @@ supportedDimensions =
analyze :: Text -> Context -> HashSet (Some Dimension) -> [ResolvedToken]
analyze input context@Context{..} targets =
rank (classifiers locale) targets
. filter (\(Resolved{node = Node{token = (Token d _)}}) ->
. filter (\Resolved{node = Node{token = (Token d _)}} ->
HashSet.null targets || HashSet.member (This d) targets
)
$ parseAndResolve (rulesFor locale targets) input context
-- | Converts the resolved token to the API format
formatToken :: Text -> ResolvedToken -> Entity
formatToken sentence (Resolved (Range start end) (Node{token=Token dimension _}) value) =
formatToken sentence (Resolved (Range start end) Node{token = Token dimension _} value) =
Entity (toName dimension) body value start end
where
body = Text.drop start $ Text.take end sentence

View File

@ -45,7 +45,7 @@ allParses l sentence targets = debugTokens sentence $ parses l sentence targets
fullParses :: Locale -> Text -> [Some Dimension] -> IO [Entity]
fullParses l sentence targets = debugTokens sentence .
filter (\(Resolved {range = Range start end}) -> start == 0 && end == n) $
filter (\Resolved{range = Range start end} -> start == 0 && end == n) $
parses l sentence targets
where
n = Text.length sentence
@ -58,7 +58,7 @@ ptree sentence Resolved {node} = pnode sentence 0 node
parses :: Locale -> Text -> [Some Dimension] -> [ResolvedToken]
parses l sentence targets = flip filter tokens $
\(Resolved {node = Node{token = (Token d _)}}) ->
\Resolved{node = Node{token = (Token d _)}} ->
case targets of
[] -> True
_ -> elem (This d) targets

View File

@ -6,7 +6,7 @@
-- of patent rights can be found in the PATENTS file in the same directory.
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Distance.Helpers
( distance

View File

@ -62,7 +62,7 @@ ruleNumeralQuotes = Rule
, regex "(['\"])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (x:_)):
_) -> case x of
"'" -> Just . Token Duration . duration TG.Minute $ floor v
@ -94,7 +94,7 @@ ruleDurationAndHalfHour = Rule
, regex "و ?نصف? ساع[ةه]"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -47,7 +47,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "og (en )?halv timer?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}
@ -73,7 +73,7 @@ ruleIntegerMoreUnitofduration = Rule
, regex "mere|mindre"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token TimeGrain grain:
_) -> Just . Token Duration . duration grain $ floor v
_ -> Nothing

View File

@ -53,7 +53,7 @@ ruleIntegerMoreUnitofduration = Rule
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
_:
Token TimeGrain grain:
_) -> Just . Token Duration . duration grain $ floor v
@ -83,7 +83,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "ein ?halb stunden?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -98,7 +98,7 @@ ruleNumeralQuotes = Rule
, regex "(['\"])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (x:_)):
_) -> case x of
"'" -> Just . Token Duration . duration TG.Minute $ floor v

View File

@ -71,7 +71,7 @@ ruleNumeralQuotes = Rule
, regex "(['\"])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (x:_)):
_) -> case x of
"'" -> Just . Token Duration . duration TG.Minute $ floor v
@ -117,7 +117,7 @@ ruleDurationAndHalfHour = Rule
, regex "and (an? )?half hours?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -31,7 +31,7 @@ ruleNumeralQuotes = Rule
, regex "(['\"])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (x:_)):
_) -> case x of
"'" -> Just . Token Duration . duration TG.Minute $ floor v

View File

@ -63,9 +63,9 @@ ruleIntegerUnitofdurationInteger = Rule
, numberWith TNumeral.value (`elem` [10, 20 .. 50])
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token TimeGrain grain:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> Just . Token Duration . duration grain . floor $ v1 + v2
_ -> Nothing
}

View File

@ -80,7 +80,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "וחצי (שעות|שעה)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -49,7 +49,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "i pol?a?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}
@ -63,7 +63,7 @@ ruleIntegerMoreUnitofduration = Rule
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
_:
Token TimeGrain grain:_) ->
Just . Token Duration . duration grain $ floor v

View File

@ -76,7 +76,7 @@ ruleDurationAndHalfHour = Rule
, regex "\x00E9s f\x00E9l[\\s-]?\x00F3ra"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -7,7 +7,6 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Duration.Helpers
( duration

View File

@ -69,7 +69,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "시간반"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -44,7 +44,7 @@ ruleIntegerMoreUnitofduration = Rule
, regex "mere?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token TimeGrain grain:
_) -> Just . Token Duration . duration grain $ floor v
_ -> Nothing
@ -73,7 +73,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "og (en )?halv time?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -41,7 +41,7 @@ ruleDurationKwartier = Rule
, regex "kwartier"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 15 * floor v
_ -> Nothing
}
@ -68,7 +68,7 @@ ruleNumeralQuotes = Rule
, regex "(['\"])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (x:_)):
_) -> case x of
"'" -> Just . Token Duration . duration TG.Minute $ floor v
@ -98,7 +98,7 @@ ruleDurationAndHalfHour = Rule
, regex "en een half (uur|uren)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -44,7 +44,7 @@ ruleIntegerMoreUnitofduration = Rule
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
_:
Token TimeGrain grain:
_) -> Just . Token Duration . duration grain $ floor v
@ -75,7 +75,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "i (p(o|ó)(l|ł)) godziny"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -62,7 +62,7 @@ ruleNumeralQuotes = Rule
, regex "(['\"])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (x:_)):
_) -> case x of
"'" -> Just . Token Duration . duration Minute $ floor v
@ -102,7 +102,7 @@ rulePositiveDuration = Rule
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token TimeGrain grain:
_) -> Just . Token Duration . duration Second . floor $ inSeconds grain v
_ -> Nothing

View File

@ -30,7 +30,7 @@ ruleIntegerUnitofduration = Rule
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token TimeGrain grain:
_) -> Just . Token Duration . duration grain $ floor v
_ -> Nothing

View File

@ -45,7 +45,7 @@ ruleIntegerMoreUnitofduration = Rule
, regex "fler|mer"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token TimeGrain grain:
_) -> Just . Token Duration . duration grain $ floor v
_ -> Nothing
@ -75,7 +75,7 @@ ruleIntegerAndAnHalfHours = Rule
, regex "och (en )?halv timme?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -63,7 +63,7 @@ ruleNumeralQuotes = Rule
, regex "(['\"])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (x:_)):
_) -> case x of
"'" -> Just . Token Duration . duration TG.Minute $ floor v
@ -93,7 +93,7 @@ ruleDurationAndHalfHour = Rule
, regex "buçeuk sa(at)?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v
_ -> Nothing
}

View File

@ -9,7 +9,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Engine
( parseAndResolve
@ -129,7 +129,7 @@ lookupItemAnywhere _doc (Predicate p) stash =
return $ filter (p . token) $ Stash.toPosOrderedList stash
isPositionValid :: Int -> Document -> Node -> Bool
isPositionValid position sentence (Node {nodeRange = Range start _}) =
isPositionValid position sentence Node{nodeRange = Range start _} =
Document.isAdjacent sentence position start
-- | A match is full if its rule pattern is empty.
@ -153,7 +153,7 @@ matchAll sentence stash matches = concatMapM mkNextMatches matches
-- resuming from a Match position
matchFirst :: Document -> Stash -> Match -> Duckling [Match]
matchFirst _ _ (Rule {pattern = []}, _, _) = return []
matchFirst sentence stash (rule@(Rule {pattern = p:ps}), position, route) =
matchFirst sentence stash (rule@Rule{pattern = p : ps}, position, route) =
map (mkMatch route newRule) <$> lookupItem sentence p stash position
where
newRule = rule { pattern = ps }
@ -162,7 +162,7 @@ matchFirst sentence stash (rule@(Rule {pattern = p:ps}), position, route) =
-- starting anywhere
matchFirstAnywhere :: Document -> Stash -> Rule -> Duckling [Match]
matchFirstAnywhere _sentence _stash Rule {pattern = []} = return []
matchFirstAnywhere sentence stash rule@(Rule {pattern = p:ps}) =
matchFirstAnywhere sentence stash rule@Rule{pattern = p : ps} =
map (mkMatch [] newRule) <$> lookupItemAnywhere sentence p stash
where
newRule = rule { pattern = ps }
@ -216,7 +216,7 @@ parseString rules sentence = do
saturateParseString headPredicateRules sentence new new partialMatches
where
headPredicateRules =
[ rule | rule@(Rule {pattern = (Predicate _:_)}) <- rules ]
[ rule | rule@Rule{pattern = (Predicate _ : _)} <- rules ]
resolveNode :: Context -> Node -> Maybe ResolvedToken
resolveNode context n@Node{token = (Token _ dd), nodeRange = nodeRange} = do

View File

@ -46,9 +46,9 @@ ruleInteger23 = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -105,9 +105,9 @@ ruleInteger22 = Rule
, oneOf [20, 30 .. 90]
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -120,7 +120,7 @@ ruleInteger21 = Rule
, numberWith TNumeral.value (== 10)
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 10
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 10
_ -> Nothing
}
@ -236,7 +236,7 @@ ruleNumeralsPrefixWithMinus = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double (v * (- 1))
_ -> Nothing
}
@ -313,9 +313,9 @@ ruleNumeralDotNumeral = Rule
, numberWith TNumeral.grain isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + decimalsToDouble v2
_ -> Nothing
}

View File

@ -116,9 +116,9 @@ ruleCompositeTens = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = tens}):
(Token Numeral NumeralData{TNumeral.value = tens}:
_:
Token Numeral (NumeralData {TNumeral.value = units}):
Token Numeral NumeralData{TNumeral.value = units}:
_) -> double $ tens + units
_ -> Nothing
}
@ -152,8 +152,8 @@ ruleCompositeHundreds = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = hundreds}):
Token Numeral (NumeralData {TNumeral.value = tens}):
(Token Numeral NumeralData{TNumeral.value = hundreds}:
Token Numeral NumeralData{TNumeral.value = tens}:
_) -> double $ hundreds + tens
_ -> Nothing
}

View File

@ -36,7 +36,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double $ v * (-1)
_ -> Nothing
}
@ -91,8 +91,8 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -114,8 +114,8 @@ ruleIntersect = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -128,7 +128,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -174,9 +174,9 @@ ruleNumeralsOg = Rule
, oneOf [70, 20, 60, 50, 40, 90, 30, 80]
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -272,9 +272,9 @@ ruleNumeralDotNumeral = Rule
, numberWith TNumeral.grain isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + decimalsToDouble v2
_ -> Nothing
}

View File

@ -37,7 +37,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double $ v * (- 1)
_ -> Nothing
}
@ -128,9 +128,9 @@ ruleNumeralsUnd = Rule
, oneOf [20, 30 .. 90]
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -155,8 +155,8 @@ ruleIntersect = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -169,7 +169,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -297,9 +297,9 @@ ruleNumeralDotNumeral = Rule
, numberWith TNumeral.grain isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + decimalsToDouble v2
_ -> Nothing
}

View File

@ -127,8 +127,8 @@ ruleCompositeTens = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData { TNumeral.value = tens }) :
Token Numeral (NumeralData { TNumeral.value = units }) :
(Token Numeral NumeralData{TNumeral.value = tens} :
Token Numeral NumeralData{TNumeral.value = units} :
_) -> double (tens + units)
_ -> Nothing
}
@ -193,13 +193,11 @@ ruleSum = Rule
[ numberWith (fromMaybe 0 . TNumeral.grain) (>1)
, numberWith TNumeral.multipliable not
]
, prod = \tokens ->
case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1,
TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
, prod = \tokens -> case tokens of
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
ruleMultiply :: Rule

View File

@ -151,8 +151,8 @@ ruleCompositeTens = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = tens}):
Token Numeral (NumeralData {TNumeral.value = units}):
(Token Numeral NumeralData{TNumeral.value = tens}:
Token Numeral NumeralData{TNumeral.value = units}:
_) -> double $ tens + units
_ -> Nothing
}
@ -165,8 +165,8 @@ ruleSkipHundreds = Rule
, numberBetween 10 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = hundreds}):
Token Numeral (NumeralData {TNumeral.value = rest}):
(Token Numeral NumeralData{TNumeral.value = hundreds}:
Token Numeral NumeralData{TNumeral.value = rest}:
_) -> double $ hundreds*100 + rest
_ -> Nothing
}
@ -258,8 +258,8 @@ ruleSum = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -273,9 +273,9 @@ ruleSumAnd = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}

View File

@ -34,7 +34,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double $ v * (- 1)
_ -> Nothing
}
@ -170,7 +170,7 @@ ruleNumeral3 = Rule
, numberBetween 6 10
]
, prod = \tokens -> case tokens of
(_:_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double $ 10 + v
_ -> Nothing
}
@ -183,7 +183,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -231,9 +231,9 @@ ruleNumeral4 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -247,9 +247,9 @@ ruleNumerals = Rule
, numberBetween 0 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ 100 * v1 + v2
_ -> Nothing
}
@ -263,9 +263,9 @@ ruleNumeralDotNumeral = Rule
, numberWith TNumeral.grain isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + decimalsToDouble v2
_ -> Nothing
}

View File

@ -37,7 +37,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = v}):
Token Numeral NumeralData{TNumeral.value = v}:
_) -> double $ v * (-1)
_ -> Nothing
}
@ -91,8 +91,8 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):_) -> double $ v1 + v2
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:_) -> double $ v1 + v2
_ -> Nothing
}
@ -125,8 +125,8 @@ ruleIntersect = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -139,7 +139,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -250,9 +250,9 @@ ruleNumeralDotNumeral = Rule
, numberWith TNumeral.grain isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + decimalsToDouble v2
_ -> Nothing
}

View File

@ -47,7 +47,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = v}):
Token Numeral NumeralData{TNumeral.value = v}:
_) -> double $ v * (-1)
_ -> Nothing
}
@ -60,8 +60,8 @@ ruleNumerals2 = Rule
, numberBetween 2 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -120,8 +120,8 @@ ruleNumerals5 = Rule
, numberBetween 2 20
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -170,7 +170,7 @@ ruleNumeral3 = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = v}):
Token Numeral NumeralData{TNumeral.value = v}:
_) -> double $ 10 + v
_ -> Nothing
}
@ -184,9 +184,9 @@ ruleNumerals3 = Rule
, oneOf [1, 11]
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -199,7 +199,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W$€¢£]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -228,9 +228,9 @@ ruleNumerals = Rule
, numberWith TNumeral.value (== 1)
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -274,8 +274,8 @@ ruleSum = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}

View File

@ -37,7 +37,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = v}):
Token Numeral NumeralData{TNumeral.value = v}:
_) -> double $ v * (-1)
_ -> Nothing
}
@ -112,7 +112,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3

View File

@ -42,8 +42,8 @@ ruleIntersectNumerals = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -57,9 +57,9 @@ ruleIntersectWithAnd = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -72,8 +72,8 @@ ruleCompositeTens = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = tens}):
Token Numeral (NumeralData {TNumeral.value = units}):
(Token Numeral NumeralData{TNumeral.value = tens}:
Token Numeral NumeralData{TNumeral.value = units}:
_) -> double $ tens + units
_ -> Nothing
}
@ -87,9 +87,9 @@ ruleCompositeTensWithAnd = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = tens}):
(Token Numeral NumeralData{TNumeral.value = tens}:
_:
Token Numeral (NumeralData {TNumeral.value = units}):
Token Numeral NumeralData{TNumeral.value = units}:
_) -> double $ tens + units
_ -> Nothing
}
@ -235,8 +235,8 @@ ruleInteger14 = Rule
, numberWith TNumeral.value (== 10)
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -267,8 +267,8 @@ ruleInteger16 = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}

View File

@ -147,9 +147,9 @@ ruleNumbersI = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -162,8 +162,8 @@ ruleSum = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -176,7 +176,7 @@ ruleNumbersSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -259,8 +259,8 @@ ruleInteger4 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -296,9 +296,9 @@ ruleNumbers = Rule
, numberBetween 0 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ 100 * v1 + v2
_ -> Nothing
}
@ -312,9 +312,9 @@ ruleNumberDotNumber = Rule
, numberWith TNumeral.grain isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + decimalsToDouble v2
_ -> Nothing
}

View File

@ -135,8 +135,8 @@ integer = double . fromIntegral
multiply :: Token -> Token -> Maybe Token
multiply
(Token Numeral (NumeralData {value = v1}))
(Token Numeral (NumeralData {value = v2, grain = g})) = case g of
(Token Numeral NumeralData{value = v1})
(Token Numeral NumeralData{value = v2, grain = g}) = case g of
Nothing -> double $ v1 * v2
Just grain | v2 > v1 -> double (v1 * v2) >>= withGrain grain
| otherwise -> Nothing
@ -144,8 +144,8 @@ multiply _ _ = Nothing
divide :: Token -> Token -> Maybe Token
divide
(Token Numeral (NumeralData {value = v1}))
(Token Numeral (NumeralData {value = v2})) = case v1 / v2 of
(Token Numeral NumeralData{value = v1})
(Token Numeral NumeralData{value = v2}) = case v1 / v2 of
x | isInfinite x || isNaN x -> Nothing
x -> double x
divide _ _ = Nothing

View File

@ -52,7 +52,7 @@ ruleTeen = Rule
, regex "belas"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 10
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 10
_ -> Nothing
}
@ -136,8 +136,8 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -150,8 +150,8 @@ ruleIntersect = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -173,7 +173,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -227,8 +227,8 @@ ruleInteger2 = Rule
, numberWith TNumeral.value (== 10)
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2, TNumeral.grain = Just g}:
_) -> double (v1 * v2) >>= withGrain g
_ -> Nothing
}

View File

@ -163,9 +163,9 @@ ruleNumeral3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -178,7 +178,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -293,9 +293,9 @@ ruleNumerals = Rule
, numberBetween 0 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral (NumeralData {TNumeral.value = v3}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
Token Numeral NumeralData{TNumeral.value = v3}:
_) -> double $ v1 * v2 + v3
_ -> Nothing
}

View File

@ -56,7 +56,7 @@ ruleInteger10 = Rule
, numberBetween 1 1000
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double $ v + 1000
_ -> Nothing
}
@ -81,7 +81,7 @@ ruleInteger15 = Rule
, regex ""
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10000
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 10000
_ -> Nothing
}
@ -116,7 +116,7 @@ ruleInteger3 = Rule
, regex ""
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 10
_ -> Nothing
}
@ -137,7 +137,7 @@ ruleInteger6 = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 100
(_:Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 100
_ -> Nothing
}
@ -149,8 +149,8 @@ ruleInteger12 = Rule
, numberBetween 1 1000
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -163,7 +163,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "(k|m|g|千|万)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -183,7 +183,7 @@ ruleInteger7 = Rule
, regex ""
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 100
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 100
_ -> Nothing
}
@ -195,7 +195,7 @@ ruleInteger14 = Rule
, numberBetween 1 10000
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double $ v + 10000
_ -> Nothing
}
@ -208,8 +208,8 @@ ruleInteger8 = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -222,8 +222,8 @@ ruleInteger16 = Rule
, numberBetween 1 10000
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -273,8 +273,8 @@ ruleInteger4 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -287,7 +287,7 @@ ruleInteger2 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 10
(_:Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 10
_ -> Nothing
}
@ -299,7 +299,7 @@ ruleInteger11 = Rule
, regex ""
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 1000
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 1000
_ -> Nothing
}

View File

@ -90,9 +90,9 @@ ruleFraction = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v2 / v1
_ -> Nothing
}
@ -209,13 +209,11 @@ ruleSum = Rule
[ numberWith (fromMaybe 0 . TNumeral.grain) (>1)
, numberWith TNumeral.multipliable not
]
, prod = \tokens ->
case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1,
TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
, prod = \tokens -> case tokens of
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
ruleMultiply :: Rule
@ -263,7 +261,7 @@ ruleNumeralDotNumeral = Rule
, regex "(점|쩜)((영|일|이|삼|사|오|육|칠|팔|구)+)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token RegexMatch (GroupMatch (_:match:_)):
_) -> do
let getDigit '영' = Just "0"
@ -290,8 +288,8 @@ ruleIntegerType3 = Rule
, oneOf [1 .. 9]
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}

View File

@ -35,9 +35,9 @@ ruleInteger5 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2 * 10
_ -> Nothing
}
@ -76,7 +76,7 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 10
(_:Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 10
_ -> Nothing
}
@ -107,7 +107,7 @@ ruleInteger6 = Rule
, regex "ရာ"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 100
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 100
_ -> Nothing
}
@ -119,7 +119,7 @@ ruleInteger7 = Rule
, regex "ထောင်"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 1000
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 1000
_ -> Nothing
}
@ -131,7 +131,7 @@ ruleInteger8 = Rule
, regex "သောင်း"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10000
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 10000
_ -> Nothing
}
@ -152,7 +152,7 @@ ruleInteger4 = Rule
, regex "ဆယ်"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 10
_ -> Nothing
}

View File

@ -37,9 +37,9 @@ ruleIntersectWithAnd = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -110,8 +110,8 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -133,8 +133,8 @@ ruleIntersect = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -147,7 +147,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3

View File

@ -119,8 +119,8 @@ ruleIntersect = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -133,7 +133,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -152,9 +152,9 @@ ruleNumeralsEn = Rule
, oneOf [20, 30 .. 90]
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}

View File

@ -70,9 +70,9 @@ ruleIntersectWithAnd = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -115,8 +115,8 @@ ruleSpecialCompositionForMissingHundredsLikeInOneTwentyTwo = Rule
, numberBetween 10 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double (v1 * 100 + v2)
_ -> Nothing
}
@ -332,8 +332,8 @@ ruleIntersect = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -376,7 +376,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -493,8 +493,8 @@ ruleInteger2 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}

View File

@ -177,8 +177,8 @@ ruleCompositeTens = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = tens}):
Token Numeral (NumeralData {TNumeral.value = units}):
(Token Numeral NumeralData{TNumeral.value = tens}:
Token Numeral NumeralData{TNumeral.value = units}:
_) -> double $ tens + units
_ -> Nothing
}
@ -192,9 +192,9 @@ ruleDecsAnd = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -207,8 +207,8 @@ ruleCompositeCents = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = hundreds}):
Token Numeral (NumeralData {TNumeral.value = units}):
(Token Numeral NumeralData{TNumeral.value = hundreds}:
Token Numeral NumeralData{TNumeral.value = units}:
_) -> double $ hundreds + units
_ -> Nothing
}
@ -222,9 +222,9 @@ ruleCentsAnd = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -237,8 +237,8 @@ ruleSkipHundreds = Rule
, numberBetween 10 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = hundreds}):
Token Numeral (NumeralData {TNumeral.value = rest}):
(Token Numeral NumeralData{TNumeral.value = hundreds}:
Token Numeral NumeralData{TNumeral.value = rest}:
_) -> double $ hundreds*100 + rest
_ -> Nothing
}
@ -300,7 +300,7 @@ ruleSuffixes = Rule
, regex "(k|m|g)(?=[\\W$€¢£]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -330,8 +330,8 @@ ruleSum = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -345,9 +345,9 @@ ruleSumAnd = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}

View File

@ -48,8 +48,8 @@ ruleSpecialCompositionForMissingHundredsLikeInOneTwentyTwo = Rule
, numberBetween 11 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = hundreds}):
Token Numeral (NumeralData {TNumeral.value = rest}):
(Token Numeral NumeralData{TNumeral.value = hundreds}:
Token Numeral NumeralData{TNumeral.value = rest}:
_) -> double $ hundreds * 100 + rest
_ -> Nothing
}
@ -87,8 +87,8 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -113,8 +113,8 @@ ruleIntersect = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -128,9 +128,9 @@ ruleIntersectCuI = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -143,7 +143,7 @@ ruleNumeralsSuffixesWithNegativ = Rule
, regex "(negativ|neg)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
_) -> double $ v * (-1)
_ -> Nothing
}

View File

@ -101,7 +101,7 @@ ruleIntegerAndAHalf = Rule
, regex "с половиной"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 0.5
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 0.5
_ -> Nothing
}
@ -150,7 +150,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "((к|м|г)|(К|М|Г))(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"к" -> double $ v * 1e3
@ -171,8 +171,8 @@ ruleInteger7 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -185,8 +185,8 @@ ruleInteger8 = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}

View File

@ -37,9 +37,9 @@ ruleIntersectWithAnd = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -53,7 +53,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
]
, prod = \tokens -> case tokens of
(_:
Token Numeral (NumeralData {TNumeral.value = v}):
Token Numeral NumeralData{TNumeral.value = v}:
_) -> double $ v * (-1)
_ -> Nothing
}
@ -100,8 +100,8 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -123,8 +123,8 @@ ruleIntersect = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -149,7 +149,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3

View File

@ -62,7 +62,7 @@ ruleNumeralsPrefixWithNegativeOrMinus = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
double (v * (- 1))
_ -> Nothing
}
@ -115,8 +115,8 @@ ruleMultiply = Rule
, numberWith TNumeral.multipliable id
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1}):
Token Numeral (NumeralData {TNumeral.value = val2, TNumeral.grain = g2}):
(Token Numeral NumeralData{TNumeral.value = val1}:
Token Numeral NumeralData{TNumeral.value = val2, TNumeral.grain = g2}:
_) | isNothing g2 || (isJust g2 && val2 > val1) -> case g2 of
Nothing -> double $ val1 * val2
Just g -> double (val1 * val2) >>= withGrain g
@ -309,8 +309,8 @@ ruleIntersect = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -323,7 +323,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmgb])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -598,7 +598,7 @@ ruleNumeralSuffixesHalfSuffix = Rule
, regex "(buçuk)(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 0.5
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 0.5
_ -> Nothing
}
@ -610,8 +610,8 @@ ruleInteger4 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -669,9 +669,9 @@ ruleNumeralDotNumeral = Rule
, numberWith TNumeral.grain isNothing
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
(Token Numeral NumeralData{TNumeral.value = v1}:
_:
Token Numeral (NumeralData {TNumeral.value = v2}):
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + decimalsToDouble v2
_ -> Nothing
}

View File

@ -128,7 +128,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "((к|м|г)|(К|М|Г))(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"к" -> double $ v * 1e3
@ -149,8 +149,8 @@ ruleInteger7 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -163,8 +163,8 @@ ruleInteger8 = Rule
, numberBetween 1 100
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}

View File

@ -61,9 +61,9 @@ ruleIntersectWithAnd = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
_:
Token Numeral (NumeralData {TNumeral.value = val2}):
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -88,7 +88,7 @@ ruleNumerals2 = Rule
, regex "lăm"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 5
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 5
_ -> Nothing
}
@ -123,8 +123,8 @@ ruleInteger3 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -151,8 +151,8 @@ ruleIntersect = Rule
, numberWith TNumeral.multipliable not
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = val1, TNumeral.grain = Just g}):
Token Numeral (NumeralData {TNumeral.value = val2}):
(Token Numeral NumeralData{TNumeral.value = val1, TNumeral.grain = Just g}:
Token Numeral NumeralData{TNumeral.value = val2}:
_) | (10 ** fromIntegral g) > val2 -> double $ val1 + val2
_ -> Nothing
}
@ -177,7 +177,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])(?=[\\W\\$€]|$)"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -195,8 +195,8 @@ ruleNumeralNghn = Rule
, numberWith TNumeral.value (== 1000)
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2, TNumeral.grain = Just g}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2, TNumeral.grain = Just g}:
_) -> double (v1 * v2) >>= withGrain g
_ -> Nothing
}
@ -289,7 +289,7 @@ ruleNumerals = Rule
, regex "mốt"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 1
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v + 1
_ -> Nothing
}

View File

@ -112,7 +112,7 @@ ruleInteger3 = Rule
, regex ""
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10
(Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 10
_ -> Nothing
}
@ -124,7 +124,7 @@ ruleNumeralsSuffixesKMG = Rule
, regex "([kmg])"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):
(Token Numeral NumeralData{TNumeral.value = v}:
Token RegexMatch (GroupMatch (match:_)):
_) -> case Text.toLower match of
"k" -> double $ v * 1e3
@ -142,8 +142,8 @@ ruleInteger4 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v1}):
Token Numeral (NumeralData {TNumeral.value = v2}):
(Token Numeral NumeralData{TNumeral.value = v1}:
Token Numeral NumeralData{TNumeral.value = v2}:
_) -> double $ v1 + v2
_ -> Nothing
}
@ -156,7 +156,7 @@ ruleInteger2 = Rule
, numberBetween 1 10
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ 10 + v
(_:Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ 10 + v
_ -> Nothing
}

View File

@ -85,8 +85,8 @@ ruleCompositeOrdinals = Rule
, oneOf [1..9]
]
, prod = \tokens -> case tokens of
( Token Ordinal (OrdinalData {TOrdinal.value = t}) :
Token Ordinal (OrdinalData {TOrdinal.value = u}) : _ )
( Token Ordinal OrdinalData{TOrdinal.value = t} :
Token Ordinal OrdinalData{TOrdinal.value = u} : _ )
-> Just $ ordinal $ t + u
_ -> Nothing
}

View File

@ -236,9 +236,9 @@ ruleCompositeWithAnd = Rule
, dimension Ordinal
]
, prod = \tokens -> case tokens of
(Token Ordinal (OrdinalData {TOrdinal.value = v1}):
(Token Ordinal OrdinalData{TOrdinal.value = v1}:
_:
Token Ordinal (OrdinalData {TOrdinal.value = v2}):
Token Ordinal OrdinalData{TOrdinal.value = v2}:
_) -> Just . ordinal $ v1 + v2
_ -> Nothing
}

View File

@ -29,7 +29,7 @@ ruleOrdinalDigits = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . ordinal $ floor v
_ -> Nothing
}

View File

@ -29,7 +29,7 @@ ruleOrdinals = Rule
, regex "번째|째(번)?"
]
, prod = \tokens -> case tokens of
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . ordinal $ floor v
_ -> Nothing
}

View File

@ -40,7 +40,7 @@ ruleThOrdinal16 = Rule
, dimension Ordinal
]
, prod = \tokens -> case tokens of
(_:Token Ordinal (OrdinalData {TOrdinal.value = v}):_) ->
(_:Token Ordinal OrdinalData{TOrdinal.value = v}:_) ->
Just . ordinal $ 30 + v
_ -> Nothing
}
@ -190,7 +190,7 @@ ruleThOrdinal14 = Rule
, dimension Ordinal
]
, prod = \tokens -> case tokens of
(_:Token Ordinal (OrdinalData {TOrdinal.value = v}):_) ->
(_:Token Ordinal OrdinalData{TOrdinal.value = v}:_) ->
Just . ordinal $ 20 + v
_ -> Nothing
}

View File

@ -29,7 +29,7 @@ ruleOrdinalDigits = Rule
, dimension Numeral
]
, prod = \tokens -> case tokens of
(_:Token Numeral (NumeralData {TNumeral.value = x}):_) ->
(_:Token Numeral NumeralData{TNumeral.value = x}:_) ->
Just . ordinal $ floor x
_ -> Nothing
}

View File

@ -37,8 +37,8 @@ extractFeatures node =
featRules = Text.concat $ mapMaybe rule (children node)
grains = mapMaybe (\x ->
case token x of
Token Duration (DurationData {TDuration.grain = g}) -> Just $ showt g
Token Time (TimeData {TTime.timeGrain = g}) -> Just $ showt g
Token Duration DurationData{TDuration.grain = g} -> Just $ showt g
Token Time TimeData{TTime.timeGrain = g} -> Just $ showt g
Token TimeGrain g -> Just $ showt g
_ -> Nothing
) $ children node

View File

@ -7,7 +7,7 @@
{-# LANGUAGE NoRebindableSyntax #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Ranking.Types
( Feature

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.AR
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.BG
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.CS
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.Common
( rules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.DA
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.DE
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.EL
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.EN
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.ES
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.ET
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.FR
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.GA
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.HE
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.HR
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.HU
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.ID
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.IT
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.JA
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.KA
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.KO
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.MY
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.NB
( defaultRules

View File

@ -7,7 +7,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Rules.NL
( defaultRules

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