mirror of
https://github.com/facebook/duckling.git
synced 2024-12-25 13:11:38 +03:00
Convert back escaped characters in rules
Summary: We noticed that using UTF-8 characters directly in regexes work. Hence converting back the escaped characters for readability and maintenance. Reviewed By: blandinw Differential Revision: D5787146 fbshipit-source-id: e5a4b9a
This commit is contained in:
parent
b954380937
commit
83ea150d94
@ -28,7 +28,7 @@ ruleDollar :: Rule
|
||||
ruleDollar = Rule
|
||||
{ name = "dollar"
|
||||
, pattern =
|
||||
[ regex "d(\x00f3|o)lar(es)?"
|
||||
[ regex "d(ó|o)lar(es)?"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Dollar
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ rulePrecision :: Rule
|
||||
rulePrecision = Rule
|
||||
{ name = "precision"
|
||||
, pattern =
|
||||
[ regex "exactement|quasi|plus ou moins|environ|autour de|(a|\x00e0) peu pr(e|\x00e8)s"
|
||||
[ regex "exactement|quasi|plus ou moins|environ|autour de|(a|à) peu pr(e|è)s"
|
||||
, financeWith TAmountOfMoney.value isJust
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -111,7 +111,7 @@ ruleInr :: Rule
|
||||
ruleInr = Rule
|
||||
{ name = "INR"
|
||||
, pattern =
|
||||
[ regex "r(\x00fa|u)pa(\x00ed|i)"
|
||||
[ regex "r(ú|u)pa(í|i)"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly INR
|
||||
}
|
||||
@ -137,7 +137,7 @@ ruleAmountofmoneyGlan = Rule
|
||||
{ name = "<amount-of-money> glan"
|
||||
, pattern =
|
||||
[ financeWith TAmountOfMoney.value isJust
|
||||
, regex "glan|baileach|(go )?d(\x00ed|i)reach"
|
||||
, regex "glan|baileach|(go )?d(í|i)reach"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> Just token
|
||||
|
@ -64,7 +64,7 @@ ruleCent :: Rule
|
||||
ruleCent = Rule
|
||||
{ name = "cent"
|
||||
, pattern =
|
||||
[ regex "cent(i|a)?|penij(i|a)?|c|\x00a2|lp|lip(a|e)"
|
||||
[ regex "cent(i|a)?|penij(i|a)?|c|¢|lp|lip(a|e)"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Cent
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ ruleJpy :: Rule
|
||||
ruleJpy = Rule
|
||||
{ name = "JPY"
|
||||
, pattern =
|
||||
[ regex "\x00a5\\."
|
||||
[ regex "¥\\."
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly JPY
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ ruleAmountofmoneyAbout = Rule
|
||||
{ name = "<amount-of-money> about"
|
||||
, pattern =
|
||||
[ financeWith TAmountOfMoney.value isJust
|
||||
, regex "\xc815\xb3c4|\xcbe4"
|
||||
, regex "정도|쯤"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> Just token
|
||||
@ -38,7 +38,7 @@ ruleAud :: Rule
|
||||
ruleAud = Rule
|
||||
{ name = "AUD"
|
||||
, pattern =
|
||||
[ regex "\xd638\xc8fc\xb2ec\xb7ec"
|
||||
[ regex "호주달러"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly AUD
|
||||
}
|
||||
@ -47,7 +47,7 @@ ruleKrw :: Rule
|
||||
ruleKrw = Rule
|
||||
{ name = "₩"
|
||||
, pattern =
|
||||
[ regex "\x20a9|\xc6d0"
|
||||
[ regex "₩|원"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly KRW
|
||||
}
|
||||
@ -56,7 +56,7 @@ ruleAboutAmountofmoney :: Rule
|
||||
ruleAboutAmountofmoney = Rule
|
||||
{ name = "about <amount-of-money>"
|
||||
, pattern =
|
||||
[ regex "\xc57d|\xb300\xcda9|\xc5bc\xcd94"
|
||||
[ regex "약|대충|얼추"
|
||||
, financeWith TAmountOfMoney.value isJust
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -68,7 +68,7 @@ ruleCent :: Rule
|
||||
ruleCent = Rule
|
||||
{ name = "cent"
|
||||
, pattern =
|
||||
[ regex "cents?|\xc13c(\xd2b8|\xce20)"
|
||||
[ regex "cents?|센(트|츠)"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Cent
|
||||
}
|
||||
@ -77,7 +77,7 @@ ruleExactlyAmountofmoney :: Rule
|
||||
ruleExactlyAmountofmoney = Rule
|
||||
{ name = "exactly <amount-of-money>"
|
||||
, pattern =
|
||||
[ regex "\xb531|\xc815\xd655\xd788"
|
||||
[ regex "딱|정확히"
|
||||
, financeWith TAmountOfMoney.value isJust
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -103,7 +103,7 @@ ruleEuro :: Rule
|
||||
ruleEuro = Rule
|
||||
{ name = "€"
|
||||
, pattern =
|
||||
[ regex "\x20ac|\xc720\xb85c"
|
||||
[ regex "€|유로"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly EUR
|
||||
}
|
||||
@ -112,7 +112,7 @@ ruleDollar :: Rule
|
||||
ruleDollar = Rule
|
||||
{ name = "$"
|
||||
, pattern =
|
||||
[ regex "\xb2ec\xb7ec|\xbd88"
|
||||
[ regex "달러|불"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Dollar
|
||||
}
|
||||
@ -121,7 +121,7 @@ ruleInr :: Rule
|
||||
ruleInr = Rule
|
||||
{ name = "INR"
|
||||
, pattern =
|
||||
[ regex "\xb8e8\xd53c|\xc778\xb3c4\xb8e8\xd53c"
|
||||
[ regex "루피|인도루피"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly INR
|
||||
}
|
||||
@ -130,7 +130,7 @@ rulePounds :: Rule
|
||||
rulePounds = Rule
|
||||
{ name = "£"
|
||||
, pattern =
|
||||
[ regex "\xd30c\xc6b4\xb4dc|\xc601\xad6d\xd30c\xc6b4\xb4dc"
|
||||
[ regex "파운드|영국파운드"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Pound
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ ruleCent :: Rule
|
||||
ruleCent = Rule
|
||||
{ name = "cent"
|
||||
, pattern =
|
||||
[ regex "cents?|penn(y|ies)|(\x00f8)re"
|
||||
[ regex "cents?|penn(y|ies)|(ø)re"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Cent
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ ruleIntersectAndNumeral = Rule
|
||||
{ name = "intersect (and number)"
|
||||
, pattern =
|
||||
[ financeWith TAmountOfMoney.value isJust
|
||||
, regex "(s|\x0219)i"
|
||||
, regex "(s|ș)i"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -71,7 +71,7 @@ rulePrecisionAmountofmoney :: Rule
|
||||
rulePrecisionAmountofmoney = Rule
|
||||
{ name = "about/exactly <amount-of-money>"
|
||||
, pattern =
|
||||
[ regex "exact|cam|aprox(\\.|imativ)?|aproape|(i|\x00ee)n jur (de)?"
|
||||
[ regex "exact|cam|aprox(\\.|imativ)?|aproape|(i|î)n jur (de)?"
|
||||
, financeWith TAmountOfMoney.value isJust
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -83,7 +83,7 @@ ruleCent :: Rule
|
||||
ruleCent = Rule
|
||||
{ name = "cent|bani"
|
||||
, pattern =
|
||||
[ regex "bani?|cen(t|\x021b)i?|c|\x00a2"
|
||||
[ regex "bani?|cen(t|ț)i?|c|¢"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Cent
|
||||
}
|
||||
@ -102,7 +102,7 @@ ruleIntersectAndXCents = Rule
|
||||
{ name = "intersect (and X cents)"
|
||||
, pattern =
|
||||
[ financeWith TAmountOfMoney.value isJust
|
||||
, regex "(s|\x0219)i"
|
||||
, regex "(s|ș)i"
|
||||
, financeWith TAmountOfMoney.currency (== Cent)
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -140,7 +140,7 @@ ruleOtherPounds :: Rule
|
||||
ruleOtherPounds = Rule
|
||||
{ name = "other pounds"
|
||||
, pattern =
|
||||
[ regex "lir(a|\x0103) (egiptian|libanez)(a|\x0103)"
|
||||
[ regex "lir(a|ă) (egiptian|libanez)(a|ă)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (_:match:_)):_) -> case Text.toLower match of
|
||||
|
@ -36,21 +36,21 @@ currencies = HashMap.fromList
|
||||
, ("aud", AUD)
|
||||
, ("bgn", BGN)
|
||||
, ("brl", BRL)
|
||||
, ("\x00a2", Cent)
|
||||
, ("¢", Cent)
|
||||
, ("c", Cent)
|
||||
, ("$", Dollar)
|
||||
, ("dollar", Dollar)
|
||||
, ("dollars", Dollar)
|
||||
, ("egp", EGP)
|
||||
, ("\x20ac", EUR)
|
||||
, ("€", EUR)
|
||||
, ("eur", EUR)
|
||||
, ("euro", EUR)
|
||||
, ("euros", EUR)
|
||||
, ("eurs", EUR)
|
||||
, ("\x20acur", EUR)
|
||||
, ("\x20acuro", EUR)
|
||||
, ("\x20acuros", EUR)
|
||||
, ("\x20acurs", EUR)
|
||||
, ("€ur", EUR)
|
||||
, ("€uro", EUR)
|
||||
, ("€uros", EUR)
|
||||
, ("€urs", EUR)
|
||||
, ("gbp", GBP)
|
||||
, ("hrk", HRK)
|
||||
, ("idr", IDR)
|
||||
@ -59,7 +59,7 @@ currencies = HashMap.fromList
|
||||
, ("rs.", INR)
|
||||
, ("rupee", INR)
|
||||
, ("rupees", INR)
|
||||
, ("\x00a5", JPY)
|
||||
, ("¥", JPY)
|
||||
, ("jpy", JPY)
|
||||
, ("yen", JPY)
|
||||
, ("krw", KRW)
|
||||
@ -68,7 +68,7 @@ currencies = HashMap.fromList
|
||||
, ("myr", MYR)
|
||||
, ("rm", MYR)
|
||||
, ("nok", NOK)
|
||||
, ("\x00a3", Pound)
|
||||
, ("£", Pound)
|
||||
, ("pt", PTS)
|
||||
, ("pta", PTS)
|
||||
, ("ptas", PTS)
|
||||
@ -87,7 +87,7 @@ ruleCurrencies :: Rule
|
||||
ruleCurrencies = Rule
|
||||
{ name = "currencies"
|
||||
, pattern =
|
||||
[ regex "(aed|aud|bgn|brl|\x00a2|c|\\$|dollars?|egp|(e|\x20ac)uro?s?|\x20ac|gbp|hrk|idr|inr|\x00a5|jpy|krw|kwd|lbp|myr|rm|nok|\x00a3|pta?s?|qar|rs\\.?|ron|rupees?|sar|sek|sgb|us(d|\\$)|vnd|yen)"
|
||||
[ regex "(aed|aud|bgn|brl|¢|c|\\$|dollars?|egp|(e|€)uro?s?|€|gbp|hrk|idr|inr|¥|jpy|krw|kwd|lbp|myr|rm|nok|£|pta?s?|qar|rs\\.?|ron|rupees?|sar|sek|sgb|us(d|\\$)|vnd|yen)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> do
|
||||
|
@ -56,7 +56,7 @@ ruleCent :: Rule
|
||||
ruleCent = Rule
|
||||
{ name = "cent"
|
||||
, pattern =
|
||||
[ regex "cents?|penn(y|ies)|\x00f6re"
|
||||
[ regex "cents?|penn(y|ies)|öre"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Cent
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ ruleNg :: Rule
|
||||
ruleNg = Rule
|
||||
{ name = "đồng"
|
||||
, pattern =
|
||||
[ regex "\x0111\x1ed3ng?"
|
||||
[ regex "đồng?"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly VND
|
||||
}
|
||||
@ -37,7 +37,7 @@ ruleDollar :: Rule
|
||||
ruleDollar = Rule
|
||||
{ name = "$"
|
||||
, pattern =
|
||||
[ regex "\x0111\x00f4 la|\x0111\x00f4 m\x1ef9|\x0111(\x00f4)?"
|
||||
[ regex "đô la|đô mỹ|đ(ô)?"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Dollar
|
||||
}
|
||||
@ -46,7 +46,7 @@ ruleVnd :: Rule
|
||||
ruleVnd = Rule
|
||||
{ name = "VNĐ"
|
||||
, pattern =
|
||||
[ regex "vn(\x0110|\\$)"
|
||||
[ regex "vn(Đ|\\$)"
|
||||
]
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly VND
|
||||
}
|
||||
@ -88,7 +88,7 @@ ruleIntersectAndNumeral = Rule
|
||||
{ name = "intersect and number"
|
||||
, pattern =
|
||||
[ financeWith TAmountOfMoney.value isJust
|
||||
, regex "v\x00e0"
|
||||
, regex "và"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -118,7 +118,7 @@ ruleIntersectVXXuxen = Rule
|
||||
{ name = "intersect (và X xu|xen)"
|
||||
, pattern =
|
||||
[ financeWith TAmountOfMoney.value isJust
|
||||
, regex "v\x00e0"
|
||||
, regex "và"
|
||||
, financeWith TAmountOfMoney.currency (== Cent)
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -25,7 +25,7 @@ ruleLatentDistKm = Rule
|
||||
{ name = "<latent dist> km"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "k(il(\x00f3|o))?m?(etro)?s?"
|
||||
, regex "k(il(ó|o))?m?(etro)?s?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -51,7 +51,7 @@ ruleDistCentimeters = Rule
|
||||
{ name = "<dist> centimeters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "(cm|cent(\x00ed|i)m(etros?))"
|
||||
, regex "(cm|cent(í|i)m(etros?))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
|
@ -25,7 +25,7 @@ ruleLatentDistKm = Rule
|
||||
{ name = "<latent dist> km"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "k(ilo)?m?((e|\x00e9|\x00e8)tre)?s?"
|
||||
, regex "k(ilo)?m?((e|é|è)tre)?s?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -38,7 +38,7 @@ ruleDistMeters = Rule
|
||||
{ name = "<dist> meters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "m((e|\x00e9|\x00e8)tres?)?"
|
||||
, regex "m((e|é|è)tres?)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -51,7 +51,7 @@ ruleDistCentimeters = Rule
|
||||
{ name = "<dist> centimeters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "cm|centim(e|\x00e9|\x00e8)tres?"
|
||||
, regex "cm|centim(e|é|è)tres?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
|
@ -25,7 +25,7 @@ ruleDistMeters = Rule
|
||||
{ name = "<dist> meters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "mh?(e|\x00e9)adai?r"
|
||||
, regex "mh?(e|é)adai?r"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -38,7 +38,7 @@ ruleDistCentimeters = Rule
|
||||
{ name = "<dist> centimeters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "(c\\.?m\\.?|g?ch?eintimh?(e|\x00e9)adai?r)"
|
||||
, regex "(c\\.?m\\.?|g?ch?eintimh?(e|é)adai?r)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -51,7 +51,7 @@ ruleDistMiles = Rule
|
||||
{ name = "<dist> miles"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "mh?(\x00ed|i)lt?e"
|
||||
, regex "mh?(í|i)lt?e"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -64,7 +64,7 @@ ruleLatentDistKm = Rule
|
||||
{ name = "<latent dist> km"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "(k\\.?(m\\.?)?|g?ch?ilim(e|\x00e9)adai?r)"
|
||||
, regex "(k\\.?(m\\.?)?|g?ch?ilim(e|é)adai?r)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -90,7 +90,7 @@ ruleLatentDistOrlach = Rule
|
||||
{ name = "<latent dist> orlach"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "(''|([nth]-?)?orl(ach|aigh|a(\x00ed|i)|\\.))"
|
||||
, regex "(''|([nth]-?)?orl(ach|aigh|a(í|i)|\\.))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
|
@ -27,7 +27,7 @@ ruleLatentDistYard = Rule
|
||||
{ name = "<latent dist> yard"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "y(ar)?ds?|\xc57c\xb4dc"
|
||||
, regex "y(ar)?ds?|야드"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -40,7 +40,7 @@ ruleDistCentimeters = Rule
|
||||
{ name = "<dist> centimeters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "cm|\xc13c(\xd2f0|\xce58)((\xbbf8|\xba54)\xd130)?"
|
||||
, regex "cm|센(티|치)((미|메)터)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -53,9 +53,9 @@ ruleLatentDistFeetAndLatentDistInch = Rule
|
||||
{ name = "<latent dist> feet and <latent dist> inch "
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "('|f(oo|ee)?ts?)|\xd53c\xd2b8"
|
||||
, regex "('|f(oo|ee)?ts?)|피트"
|
||||
, dimension Distance
|
||||
, regex "(''|inch(es)?)|\xc778\xce58"
|
||||
, regex "(''|inch(es)?)|인치"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -68,7 +68,7 @@ ruleDistMeters = Rule
|
||||
{ name = "<dist> meters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "m|(\xbbf8|\xba54|\xb9e4)\xd130"
|
||||
, regex "m|(미|메|매)터"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -81,7 +81,7 @@ ruleLatentDistFeet = Rule
|
||||
{ name = "<latent dist> feet"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "('|f(oo|ee)?ts?)|\xd53c\xd2b8"
|
||||
, regex "('|f(oo|ee)?ts?)|피트"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -94,7 +94,7 @@ ruleLatentDistKm = Rule
|
||||
{ name = "<latent dist> km"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "km|(\xd0ac|\xd0a4)\xb85c((\xbbf8|\xba54)\xd130)?"
|
||||
, regex "km|(킬|키)로((미|메)터)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -106,7 +106,7 @@ ruleHalf :: Rule
|
||||
ruleHalf = Rule
|
||||
{ name = "half"
|
||||
, pattern =
|
||||
[ regex "\xbc18"
|
||||
[ regex "반"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral NumeralData {TNumeral.value = v}:_) ->
|
||||
@ -119,7 +119,7 @@ ruleDistMiles = Rule
|
||||
{ name = "<dist> miles"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "miles?|\xb9c8\xc77c(\xc988)?"
|
||||
, regex "miles?|마일(즈)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -132,7 +132,7 @@ ruleLatentDistInch = Rule
|
||||
{ name = "<latent dist> inch"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "(''|inch(es)?)|\xc778\xce58"
|
||||
, regex "(''|inch(es)?)|인치"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
|
@ -25,7 +25,7 @@ ruleLatentDistKm = Rule
|
||||
{ name = "<latent dist> km"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "k(il(\x00f3|o))?m?(etro)?s?"
|
||||
, regex "k(il(ó|o))?m?(etro)?s?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
@ -51,7 +51,7 @@ ruleDistCentimeters = Rule
|
||||
{ name = "<dist> centimeters"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "(cm|cent(\x00ed|i)m(etros?))"
|
||||
, regex "(cm|cent(í|i)m(etros?))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
|
@ -103,7 +103,7 @@ ruleDistMiles = Rule
|
||||
{ name = "<dist> miles"
|
||||
, pattern =
|
||||
[ dimension Distance
|
||||
, regex "mil(e|a|\x0103)"
|
||||
, regex "mil(e|a|ă)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Distance dd:_) ->
|
||||
|
@ -30,7 +30,7 @@ ruleExactlyDuration :: Rule
|
||||
ruleExactlyDuration = Rule
|
||||
{ name = "exactly <duration>"
|
||||
, pattern =
|
||||
[ regex "pr(\x00e6)cis"
|
||||
[ regex "pr(æ)cis"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -104,7 +104,7 @@ ruleAboutDuration :: Rule
|
||||
ruleAboutDuration = Rule
|
||||
{ name = "about <duration>"
|
||||
, pattern =
|
||||
[ regex "ungef\x00e4hr|zirka"
|
||||
[ regex "ungefähr|zirka"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -26,7 +26,7 @@ ruleCoics :: Rule
|
||||
ruleCoics = Rule
|
||||
{ name = "coicís"
|
||||
, pattern =
|
||||
[ regex "coic(\x00ed|i)s(\x00ed|i|e)?"
|
||||
[ regex "coic(í|i)s(í|i|e)?"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Day 14
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ ruleQuarterOfAnHour :: Rule
|
||||
ruleQuarterOfAnHour = Rule
|
||||
{ name = "quarter of an hour"
|
||||
, pattern =
|
||||
[ regex "(1/4/s \x05e9\x05e2\x05d4|\x05e8\x05d1\x05e2 \x05e9\x05e2\x05d4)"
|
||||
[ regex "(1/4/s שעה|רבע שעה)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 15
|
||||
}
|
||||
@ -42,7 +42,7 @@ ruleHalfAnHour :: Rule
|
||||
ruleHalfAnHour = Rule
|
||||
{ name = "half an hour"
|
||||
, pattern =
|
||||
[ regex "(1/2/s \x05e9\x05e2\x05d4|\x05d7\x05e6\x05d9 \x05e9\x05e2\x05d4)"
|
||||
[ regex "(1/2/s שעה|חצי שעה)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 30
|
||||
}
|
||||
@ -51,7 +51,7 @@ ruleThreequartersOfAnHour :: Rule
|
||||
ruleThreequartersOfAnHour = Rule
|
||||
{ name = "three-quarters of an hour"
|
||||
, pattern =
|
||||
[ regex "(3/4/s \x05e9\x05e2\x05d4|\x05e9\x05dc\x05d5\x05e9\x05ea \x05e8\x05d1\x05e2\x05d9 \x05e9\x05e2\x05d4)"
|
||||
[ regex "(3/4/s שעה|שלושת רבעי שעה)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 45
|
||||
}
|
||||
@ -61,7 +61,7 @@ ruleNumbernumberHours = Rule
|
||||
{ name = "number.number hours"
|
||||
, pattern =
|
||||
[ regex "(\\d+)\\.(\\d+)"
|
||||
, regex "\x05e9\x05e2\x05d4|\x05e9\x05e2\x05d5\x05ea"
|
||||
, regex "שעה|שעות"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (h:m:_)):_) -> do
|
||||
@ -77,7 +77,7 @@ ruleIntegerAndAnHalfHours = Rule
|
||||
{ name = "<integer> and an half hours"
|
||||
, pattern =
|
||||
[ Predicate isNatural
|
||||
, regex "\x05d5\x05d7\x05e6\x05d9 (\x05e9\x05e2\x05d5\x05ea|\x05e9\x05e2\x05d4)"
|
||||
, regex "וחצי (שעות|שעה)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
|
||||
@ -89,7 +89,7 @@ ruleAboutDuration :: Rule
|
||||
ruleAboutDuration = Rule
|
||||
{ name = "about <duration>"
|
||||
, pattern =
|
||||
[ regex "(\x05d1\x05e2\x05e8\x05da|\x05e1\x05d1\x05d9\x05d1\x05d5\x05ea|\x05d1\x05e7\x05d9\x05e8\x05d5\x05d1)"
|
||||
[ regex "(בערך|סביבות|בקירוב)"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -101,7 +101,7 @@ ruleExactlyDuration :: Rule
|
||||
ruleExactlyDuration = Rule
|
||||
{ name = "exactly <duration>"
|
||||
, pattern =
|
||||
[ regex "\x05d1\x05d3\x05d9\x05d5\x05e7"
|
||||
[ regex "בדיוק"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -33,7 +33,7 @@ ruleExactlyDuration :: Rule
|
||||
ruleExactlyDuration = Rule
|
||||
{ name = "exactly <duration>"
|
||||
, pattern =
|
||||
[ regex "to(c|\x010d)no"
|
||||
[ regex "to(c|č)no"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -59,7 +59,7 @@ ruleIntegerMoreUnitofduration = Rule
|
||||
{ name = "<integer> more <unit-of-duration>"
|
||||
, pattern =
|
||||
[ Predicate isNatural
|
||||
, regex "vi(s|\x0161)e|manje"
|
||||
, regex "vi(s|š)e|manje"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -74,7 +74,7 @@ ruleQuarterOfAnHour :: Rule
|
||||
ruleQuarterOfAnHour = Rule
|
||||
{ name = "quarter of an hour"
|
||||
, pattern =
|
||||
[ regex "((1/4|frtalj|kvarat|(c|\x010d)etvrt)\\s?(h|sata)?)"
|
||||
[ regex "((1/4|frtalj|kvarat|(c|č)etvrt)\\s?(h|sata)?)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 15
|
||||
}
|
||||
@ -111,7 +111,7 @@ ruleThreequartersOfAnHour :: Rule
|
||||
ruleThreequartersOfAnHour = Rule
|
||||
{ name = "three-quarters of an hour"
|
||||
, pattern =
|
||||
[ regex "((3/4|tri-?frtalja|tri-?kvarat|tri-?(c|\x010d)etvrt(ine)?)\\s?(h|sata)?)"
|
||||
[ regex "((3/4|tri-?frtalja|tri-?kvarat|tri-?(c|č)etvrt(ine)?)\\s?(h|sata)?)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 45
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ ruleHalfAnHour = Rule
|
||||
{ name = "half an hour"
|
||||
, pattern =
|
||||
[ Predicate $ isGrain TG.Hour
|
||||
, regex "\xbc18"
|
||||
, regex "반"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 30
|
||||
}
|
||||
@ -40,7 +40,7 @@ ruleADay :: Rule
|
||||
ruleADay = Rule
|
||||
{ name = "a day - 하루"
|
||||
, pattern =
|
||||
[ regex "\xd558\xb8e8"
|
||||
[ regex "하루"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Day 1
|
||||
}
|
||||
@ -50,7 +50,7 @@ ruleNumeralnumberHours = Rule
|
||||
{ name = "number.number hours"
|
||||
, pattern =
|
||||
[ regex "(\\d+)\\.(\\d+)"
|
||||
, regex "\xc2dc\xac04"
|
||||
, regex "시간"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (h:m:_)):_) -> do
|
||||
@ -66,7 +66,7 @@ ruleIntegerAndAnHalfHours = Rule
|
||||
{ name = "<integer> and an half hours"
|
||||
, pattern =
|
||||
[ Predicate isNatural
|
||||
, regex "\xc2dc\xac04\xbc18"
|
||||
, regex "시간반"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
|
||||
@ -78,7 +78,7 @@ ruleAboutDuration :: Rule
|
||||
ruleAboutDuration = Rule
|
||||
{ name = "about <duration>"
|
||||
, pattern =
|
||||
[ regex "\xb300\xcda9|\xc57d"
|
||||
[ regex "대충|약"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -90,7 +90,7 @@ ruleExactlyDuration :: Rule
|
||||
ruleExactlyDuration = Rule
|
||||
{ name = "exactly <duration>"
|
||||
, pattern =
|
||||
[ regex "\xc815\xd655\xd788"
|
||||
[ regex "정확히"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -30,7 +30,7 @@ ruleHalfAnHour :: Rule
|
||||
ruleHalfAnHour = Rule
|
||||
{ name = "half an hour"
|
||||
, pattern =
|
||||
[ regex "p(o|\x00f3)(l|\x0142) godziny"
|
||||
[ regex "p(o|ó)(l|ł) godziny"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 30
|
||||
}
|
||||
@ -72,7 +72,7 @@ ruleIntegerAndAnHalfHours = Rule
|
||||
{ name = "<integer> and an half hours"
|
||||
, pattern =
|
||||
[ Predicate isNatural
|
||||
, regex "i (p(o|\x00f3)(l|\x0142)) godziny"
|
||||
, regex "i (p(o|ó)(l|ł)) godziny"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
|
||||
@ -96,7 +96,7 @@ ruleAboutDuration :: Rule
|
||||
ruleAboutDuration = Rule
|
||||
{ name = "about <duration>"
|
||||
, pattern =
|
||||
[ regex "(oko(l|\x0142)o|miej wi(\x0119|e)cej|jakie(s|\x015b))"
|
||||
[ regex "(oko(l|ł)o|miej wi(ę|e)cej|jakie(s|ś))"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -108,7 +108,7 @@ ruleExactlyDuration :: Rule
|
||||
ruleExactlyDuration = Rule
|
||||
{ name = "exactly <duration>"
|
||||
, pattern =
|
||||
[ regex "r(o|\x00f3)wno|dok(l|\x0142)adnie"
|
||||
[ regex "r(o|ó)wno|dok(l|ł)adnie"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -24,7 +24,7 @@ ruleQuarterOfAnHour :: Rule
|
||||
ruleQuarterOfAnHour = Rule
|
||||
{ name = "quarter of an hour"
|
||||
, pattern =
|
||||
[ regex "(1/4\\s?(h|or(a|\x0103))|sfert de or(a|\x0103))"
|
||||
[ regex "(1/4\\s?(h|or(a|ă))|sfert de or(a|ă))"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 15
|
||||
}
|
||||
@ -33,7 +33,7 @@ ruleJumatateDeOra :: Rule
|
||||
ruleJumatateDeOra = Rule
|
||||
{ name = "jumatate de ora"
|
||||
, pattern =
|
||||
[ regex "(1/2\\s?(h|or(a|\x0103))|jum(a|\x0103)tate (de )?or(a|\x0103))"
|
||||
[ regex "(1/2\\s?(h|or(a|ă))|jum(a|ă)tate (de )?or(a|ă))"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 30
|
||||
}
|
||||
@ -42,7 +42,7 @@ ruleTreiSferturiDeOra :: Rule
|
||||
ruleTreiSferturiDeOra = Rule
|
||||
{ name = "trei sferturi de ora"
|
||||
, pattern =
|
||||
[ regex "(3/4\\s?(h|or(a|\x0103))|trei sferturi de or(a|\x0103))"
|
||||
[ regex "(3/4\\s?(h|or(a|ă))|trei sferturi de or(a|ă))"
|
||||
]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 45
|
||||
}
|
||||
@ -63,7 +63,7 @@ ruleExactInJurDeDuration :: Rule
|
||||
ruleExactInJurDeDuration = Rule
|
||||
{ name = "exact|in jur de <duration>"
|
||||
, pattern =
|
||||
[ regex "(exact|aproximativ|(i|\x00ee)n jur de)"
|
||||
[ regex "(exact|aproximativ|(i|î)n jur de)"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -30,7 +30,7 @@ import qualified Duckling.TimeGrain.Types as TG
|
||||
ruleDurationQuarterOfAnHour :: Rule
|
||||
ruleDurationQuarterOfAnHour = Rule
|
||||
{ name = "quarter of an hour"
|
||||
, pattern = [ regex "(1/4\\s?sa(at)?|\x00e7eyrek saat)" ]
|
||||
, pattern = [ regex "(1/4\\s?sa(at)?|çeyrek saat)" ]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 15
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ ruleDurationHalfAnHour = Rule
|
||||
ruleDurationThreeQuartersOfAnHour :: Rule
|
||||
ruleDurationThreeQuartersOfAnHour = Rule
|
||||
{ name = "three-quarters of an hour"
|
||||
, pattern = [regex "(3/4\\s?sa(at)?|\x00fc\x00e7e \231eyrek sa(at)?)"]
|
||||
, pattern = [regex "(3/4\\s?sa(at)?|üçe \231eyrek sa(at)?)"]
|
||||
, prod = \_ -> Just . Token Duration $ duration TG.Minute 45
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ ruleDurationAndHalfHour = Rule
|
||||
{ name = "<integer> and an half hour"
|
||||
, pattern =
|
||||
[ Predicate isNatural
|
||||
, regex "bu\x00e7euk sa(at)?"
|
||||
, regex "buçeuk sa(at)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
|
||||
@ -103,7 +103,7 @@ ruleDurationPrecision :: Rule
|
||||
ruleDurationPrecision = Rule
|
||||
{ name = "<duration> about|exactly"
|
||||
, pattern =
|
||||
[ regex "(gibi|civar\305nda|yakla\x015f\305k|tam( olarak)?)"
|
||||
[ regex "(gibi|civar\305nda|yaklaş\305k|tam( olarak)?)"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -28,7 +28,7 @@ ruleInteger5 :: Rule
|
||||
ruleInteger5 = Rule
|
||||
{ name = "integer 4"
|
||||
, pattern =
|
||||
[ regex "(\x0623\x0631\x0628\x0639(\x0629)?)"
|
||||
[ regex "(أربع(ة)?)"
|
||||
]
|
||||
, prod = \_ -> integer 4
|
||||
}
|
||||
@ -38,7 +38,7 @@ ruleInteger23 = Rule
|
||||
{ name = "integer 101..999"
|
||||
, pattern =
|
||||
[ oneOf [100, 200 .. 900]
|
||||
, regex "\x0648"
|
||||
, regex "و"
|
||||
, numberBetween 1 100
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -53,7 +53,7 @@ ruleInteger18 :: Rule
|
||||
ruleInteger18 = Rule
|
||||
{ name = "integer 12"
|
||||
, pattern =
|
||||
[ regex "(\x0625\x062b\x0646(\x062a)?\x0649 \x0639\x0634\x0631)"
|
||||
[ regex "(إثن(ت)?ى عشر)"
|
||||
]
|
||||
, prod = \_ -> integer 12
|
||||
}
|
||||
@ -75,18 +75,18 @@ ruleInteger19 :: Rule
|
||||
ruleInteger19 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(\x0639\x0634\x0631\x0648\x0646|\x062b\x0644\x0627\x062b\x0648\x0646|\x0623\x0631\x0628\x0639\x0648\x0646|\x062e\x0645\x0633\x0648\x0646|\x0633\x062a\x0648\x0646|\x0633\x0628\x0639\x0648\x0646|\x062b\x0645\x0627\x0646\x0648\x0646|\x062a\x0633\x0639\x0648\x0646)"
|
||||
[ regex "(عشرون|ثلاثون|أربعون|خمسون|ستون|سبعون|ثمانون|تسعون)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
Token RegexMatch (GroupMatch (match:_)):_ -> case match of
|
||||
"\x0639\x0634\x0631\x0648\x0646" -> integer 20
|
||||
"\x062b\x0644\x0627\x062b\x0648\x0646" -> integer 30
|
||||
"\x0623\x0631\x0628\x0639\x0648\x0646" -> integer 40
|
||||
"\x062e\x0645\x0633\x0648\x0646" -> integer 50
|
||||
"\x0633\x062a\x0648\x0646" -> integer 60
|
||||
"\x0633\x0628\x0639\x0648\x0646" -> integer 70
|
||||
"\x062b\x0645\x0627\x0646\x0648\x0646" -> integer 80
|
||||
"\x062a\x0633\x0639\x0648\x0646" -> integer 90
|
||||
"عشرون" -> integer 20
|
||||
"ثلاثون" -> integer 30
|
||||
"أربعون" -> integer 40
|
||||
"خمسون" -> integer 50
|
||||
"ستون" -> integer 60
|
||||
"سبعون" -> integer 70
|
||||
"ثمانون" -> integer 80
|
||||
"تسعون" -> integer 90
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -96,7 +96,7 @@ ruleInteger22 = Rule
|
||||
{ name = "integer 21..99"
|
||||
, pattern =
|
||||
[ numberBetween 1 10
|
||||
, regex "\x0648"
|
||||
, regex "و"
|
||||
, oneOf [20, 30 .. 90]
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -147,7 +147,7 @@ ruleInteger15 :: Rule
|
||||
ruleInteger15 = Rule
|
||||
{ name = "integer 11"
|
||||
, pattern =
|
||||
[ regex "(\x0625\x062d\x062f\x0649 \x0639\x0634\x0631(\x0629)?)"
|
||||
[ regex "(إحدى عشر(ة)?)"
|
||||
]
|
||||
, prod = \_ -> integer 11
|
||||
}
|
||||
@ -168,21 +168,21 @@ rulePowersOfTen :: Rule
|
||||
rulePowersOfTen = Rule
|
||||
{ name = "powers of tens"
|
||||
, pattern =
|
||||
[ regex "(\x0645\x0627\x0626\x0629|\x0645\x0626\x0627\x062a|\x0623\x0644\x0641|\x0627\x0644\x0641|\x0622\x0644\x0627\x0641|\x0645\x0644\x0627\x064a\x064a(\x0646)?)"
|
||||
[ regex "(مائة|مئات|ألف|الف|آلاف|ملايي(ن)?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"\x0645\x0627\x0626\x0629" ->
|
||||
"مائة" ->
|
||||
double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"\x0645\x0626\x0627\x062a" ->
|
||||
"مئات" ->
|
||||
double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"\x0623\x0644\x0641" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"\x0627\x0644\x0641" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"\x0622\x0644\x0627\x0641" ->
|
||||
"ألف" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"الف" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"آلاف" ->
|
||||
double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"\x0645\x0644\x0627\x064a\x064a" ->
|
||||
"ملايي" ->
|
||||
double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
"\x0645\x0644\x0627\x064a\x064a\x0646" ->
|
||||
"ملايين" ->
|
||||
double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
@ -192,7 +192,7 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer 2"
|
||||
, pattern =
|
||||
[ regex "(\x0627\x062b\x0646\x0627\x0646|\x0627\x062b\x0646\x064a\x0646)"
|
||||
[ regex "(اثنان|اثنين)"
|
||||
]
|
||||
, prod = \_ -> integer 2
|
||||
}
|
||||
@ -201,7 +201,7 @@ ruleInteger13 :: Rule
|
||||
ruleInteger13 = Rule
|
||||
{ name = "integer 9"
|
||||
, pattern =
|
||||
[ regex "(\x062a\x0633\x0639\x0629|\x062a\x0633\x0639)"
|
||||
[ regex "(تسعة|تسع)"
|
||||
]
|
||||
, prod = \_ -> integer 9
|
||||
}
|
||||
@ -210,7 +210,7 @@ ruleInteger12 :: Rule
|
||||
ruleInteger12 = Rule
|
||||
{ name = "integer 8"
|
||||
, pattern =
|
||||
[ regex "(\x062b\x0645\x0627\x0646\x064a\x0629|\x062b\x0645\x0627\x0646)"
|
||||
[ regex "(ثمانية|ثمان)"
|
||||
]
|
||||
, prod = \_ -> integer 8
|
||||
}
|
||||
@ -232,7 +232,7 @@ ruleInteger7 :: Rule
|
||||
ruleInteger7 = Rule
|
||||
{ name = "integer 5"
|
||||
, pattern =
|
||||
[ regex "(\x062e\x0645\x0633)(\x0629)?"
|
||||
[ regex "(خمس)(ة)?"
|
||||
]
|
||||
, prod = \_ -> integer 5
|
||||
}
|
||||
@ -241,7 +241,7 @@ ruleInteger14 :: Rule
|
||||
ruleInteger14 = Rule
|
||||
{ name = "integer 10"
|
||||
, pattern =
|
||||
[ regex "(\x0639\x0634\x0631\x0629|\x0639\x0634\x0631)"
|
||||
[ regex "(عشرة|عشر)"
|
||||
]
|
||||
, prod = \_ -> integer 10
|
||||
}
|
||||
@ -250,7 +250,7 @@ ruleInteger9 :: Rule
|
||||
ruleInteger9 = Rule
|
||||
{ name = "integer 6"
|
||||
, pattern =
|
||||
[ regex "(\x0633\x062a(\x0629)?)"
|
||||
[ regex "(ست(ة)?)"
|
||||
]
|
||||
, prod = \_ -> integer 6
|
||||
}
|
||||
@ -259,7 +259,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer 0"
|
||||
, pattern =
|
||||
[ regex "(\x0635\x0641\x0631)"
|
||||
[ regex "(صفر)"
|
||||
]
|
||||
, prod = \_ -> integer 0
|
||||
}
|
||||
@ -268,7 +268,7 @@ ruleInteger4 :: Rule
|
||||
ruleInteger4 = Rule
|
||||
{ name = "integer 3"
|
||||
, pattern =
|
||||
[ regex "(\x062b\x0644\x0627\x062b|\x062b\x0644\x0627\x062b\x0629)"
|
||||
[ regex "(ثلاث|ثلاثة)"
|
||||
]
|
||||
, prod = \_ -> integer 3
|
||||
}
|
||||
@ -277,7 +277,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer 1"
|
||||
, pattern =
|
||||
[ regex "(\x0648\x0627\x062d\x062f\x0629|\x0648\x0627\x062d\x062f\x0647|\x0648\x0627\x062d\x062f)"
|
||||
[ regex "(واحدة|واحده|واحد)"
|
||||
]
|
||||
, prod = \_ -> integer 1
|
||||
}
|
||||
@ -286,7 +286,7 @@ ruleInteger11 :: Rule
|
||||
ruleInteger11 = Rule
|
||||
{ name = "integer 7"
|
||||
, pattern =
|
||||
[ regex "(\x0633\x0628\x0639\x0629|\x0633\x0628\x0639)"
|
||||
[ regex "(سبعة|سبع)"
|
||||
]
|
||||
, prod = \_ -> integer 7
|
||||
}
|
||||
@ -295,19 +295,19 @@ ruleInteger20 :: Rule
|
||||
ruleInteger20 = Rule
|
||||
{ name = "integer (100..900)"
|
||||
, pattern =
|
||||
[ regex "(\x0645\x0627\x0626\x0629|\x0645\x0627\x0626\x062a\x0627\x0646|\x062b\x0644\x0627\x062b\x0645\x0627\x0626\x0629|\x0623\x0631\x0628\x0639\x0645\x0627\x0626\x0629|\x062e\x0645\x0633\x0645\x0627\x0626\x0629|\x0633\x062a\x0645\x0627\x0626\x0629|\x0633\x0628\x0639\x0645\x0627\x0626\x0629|\x062b\x0645\x0627\x0646\x0645\x0627\x0626\x0629|\x062a\x0633\x0639\x0645\x0627\x0626\x0629)"
|
||||
[ regex "(مائة|مائتان|ثلاثمائة|أربعمائة|خمسمائة|ستمائة|سبعمائة|ثمانمائة|تسعمائة)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
Token RegexMatch (GroupMatch (match:_)):_ -> case match of
|
||||
"\x0645\x0627\x0626\x0629" -> integer 100
|
||||
"\x0633\x0628\x0639\x0645\x0627\x0626\x0629" -> integer 700
|
||||
"\x062e\x0645\x0633\x0645\x0627\x0626\x0629" -> integer 500
|
||||
"\x0623\x0631\x0628\x0639\x0645\x0627\x0626\x0629" -> integer 400
|
||||
"\x0633\x062a\x0645\x0627\x0626\x0629" -> integer 600
|
||||
"\x0645\x0627\x0626\x062a\x0627\x0646" -> integer 200
|
||||
"\x062b\x0644\x0627\x062b\x0645\x0627\x0626\x0629" -> integer 300
|
||||
"\x062b\x0645\x0627\x0646\x0645\x0627\x0626\x0629" -> integer 800
|
||||
"\x062a\x0633\x0639\x0645\x0627\x0626\x0629" -> integer 900
|
||||
"مائة" -> integer 100
|
||||
"سبعمائة" -> integer 700
|
||||
"خمسمائة" -> integer 500
|
||||
"أربعمائة" -> integer 400
|
||||
"ستمائة" -> integer 600
|
||||
"مائتان" -> integer 200
|
||||
"ثلاثمائة" -> integer 300
|
||||
"ثمانمائة" -> integer 800
|
||||
"تسعمائة" -> integer 900
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -317,7 +317,7 @@ ruleNumeralDotNumeral = Rule
|
||||
{ name = "number dot number"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\x0641\x0627\x0635\x0644\x0629"
|
||||
, regex "فاصلة"
|
||||
, numberWith TNumeral.grain isNothing
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -226,7 +226,7 @@ ruleSuffixes = Rule
|
||||
{ name = "suffixes (K,M,G))"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "((к|м|г)|(К|М|Г))(?=[\\W$\x20ac\x00a2\x00a3]|$)"
|
||||
, regex "((к|м|г)|(К|М|Г))(?=[\\W$€¢£]|$)"
|
||||
]
|
||||
, prod = \tokens ->
|
||||
case tokens of
|
||||
|
@ -50,9 +50,9 @@ ruleNumeralMap = HashMap.fromList
|
||||
, ( "dva", 2 )
|
||||
, ( "dv\x0115", 2 )
|
||||
, ( "t\x0159i", 3 )
|
||||
, ( "\x010dty\x0159i", 4 )
|
||||
, ( "čty\x0159i", 4 )
|
||||
, ( "p\x0115t", 5)
|
||||
, ( "\x0161est", 6)
|
||||
, ( "šest", 6)
|
||||
, ( "sedm", 7)
|
||||
, ( "osm", 8)
|
||||
, ( "dev\x0115t", 9)
|
||||
@ -63,7 +63,7 @@ ruleNumeral :: Rule
|
||||
ruleNumeral = Rule
|
||||
{ name = "number (0..10)"
|
||||
, pattern =
|
||||
[ regex "(nula|jed(en|n[ao])|dv(a|\x0115)|t(\x0159)i|(\x010d)ty(\x0159)i|p(\x0115)t|(\x0161)est|sedm|osm|dev(\x0115)t|deset)"
|
||||
[ regex "(nula|jed(en|n[ao])|dv(a|\x0115)|t(\x0159)i|(č)ty(\x0159)i|p(\x0115)t|(š)est|sedm|osm|dev(\x0115)t|deset)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -57,7 +57,7 @@ ruleFew :: Rule
|
||||
ruleFew = Rule
|
||||
{ name = "few"
|
||||
, pattern =
|
||||
[ regex "(nogle )?f\x00e5"
|
||||
[ regex "(nogle )?få"
|
||||
]
|
||||
, prod = \_ -> integer 3
|
||||
}
|
||||
@ -137,7 +137,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -221,8 +221,8 @@ zeroNineteenMap = HashMap.fromList
|
||||
, ("intet", 0)
|
||||
, ("en", 1)
|
||||
, ("et", 1)
|
||||
, ("\x00e9n", 1)
|
||||
, ("\x00e9t", 1)
|
||||
, ("én", 1)
|
||||
, ("ét", 1)
|
||||
, ("to", 2)
|
||||
, ("tre", 3)
|
||||
, ("fire", 4)
|
||||
@ -247,7 +247,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(intet|ingen|nul|en|et|\x00e9n|\x00e9t|to|tretten|tre|fire|femten|fem|seksten|seks|syv|otte|nitten|ni|ti|elleve|tolv|fjorten|sytten|atten)"
|
||||
[ regex "(intet|ingen|nul|en|et|én|ét|to|tretten|tre|fire|femten|fem|seksten|seks|syv|otte|nitten|ni|ti|elleve|tolv|fjorten|sytten|atten)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -103,7 +103,7 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer ([2-9][1-9])"
|
||||
, pattern =
|
||||
[ regex "(ein|zwei|drei|vier|f\x00fcnf|sechs|sieben|acht|neun)und(zwanzig|dreissig|vierzig|f\x00fcnfzig|sechzig|siebzig|achtzig|neunzig)"
|
||||
[ regex "(ein|zwei|drei|vier|fünf|sechs|sieben|acht|neun)und(zwanzig|dreissig|vierzig|fünfzig|sechzig|siebzig|achtzig|neunzig)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (m1:m2:_)):_) -> do
|
||||
@ -112,7 +112,7 @@ ruleInteger3 = Rule
|
||||
"zwei" -> Just 2
|
||||
"drei" -> Just 3
|
||||
"vier" -> Just 4
|
||||
"f\x00fcnf" -> Just 5
|
||||
"fünf" -> Just 5
|
||||
"sechs" -> Just 6
|
||||
"sieben" -> Just 7
|
||||
"acht" -> Just 8
|
||||
@ -122,7 +122,7 @@ ruleInteger3 = Rule
|
||||
"zwanzig" -> Just 20
|
||||
"dreissig" -> Just 30
|
||||
"vierzig" -> Just 40
|
||||
"f\x00fcnfzig" -> Just 50
|
||||
"fünfzig" -> Just 50
|
||||
"sechzig" -> Just 60
|
||||
"siebzig" -> Just 70
|
||||
"achtzig" -> Just 80
|
||||
@ -179,7 +179,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -246,17 +246,17 @@ zeroNineteenMap = HashMap.fromList
|
||||
, ("zwei", 2)
|
||||
, ("drei", 3)
|
||||
, ("vier", 4)
|
||||
, ("f\x00fcnf", 5)
|
||||
, ("fünf", 5)
|
||||
, ("sechs", 6)
|
||||
, ("sieben", 7)
|
||||
, ("acht", 8)
|
||||
, ("neun", 9)
|
||||
, ("zehn", 10)
|
||||
, ("elf", 11)
|
||||
, ("zw\x00f6lf", 12)
|
||||
, ("zwölf", 12)
|
||||
, ("dreizehn", 13)
|
||||
, ("vierzehn", 14)
|
||||
, ("f\x00fcnfzehn", 15)
|
||||
, ("fünfzehn", 15)
|
||||
, ("sechzehn", 16)
|
||||
, ("siebzehn", 17)
|
||||
, ("achtzehn", 18)
|
||||
@ -268,7 +268,7 @@ ruleToNineteen = Rule
|
||||
{ name = "integer (0..19)"
|
||||
-- e.g. fourteen must be before four,
|
||||
-- otherwise four will always shadow fourteen
|
||||
, pattern = [regex "(keine?|keine?s|keiner|keinen|null|nichts|eins?(er)?|zwei|dreizehn|drei|vierzehn|vier|f\x00fcnf|sechzehn|sechs|siebzehn|sieben|achtzehn|acht|neunzehn|neun|elf|zw\x00f6lf|f\x00fcfzehn)"]
|
||||
, pattern = [regex "(keine?|keine?s|keiner|keinen|null|nichts|eins?(er)?|zwei|dreizehn|drei|vierzehn|vier|fünf|sechzehn|sechs|siebzehn|sieben|achtzehn|acht|neunzehn|neun|elf|zwölf|füfzehn)"]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
HashMap.lookup (Text.toLower match) zeroNineteenMap >>= integer
|
||||
@ -279,7 +279,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(keine?|keine?s|keiner|keinen|null|nichts|eins?(er)?|zwei|dreizehn|drei|vierzehn|vier|f\x00fcnf|sechzehn|sechs|siebzehn|sieben|achtzehn|acht|neunzehn|neun|elf|zw\x00f6lf|f\x00fcfzehn)"
|
||||
[ regex "(keine?|keine?s|keiner|keinen|null|nichts|eins?(er)?|zwei|dreizehn|drei|vierzehn|vier|fünf|sechzehn|sechs|siebzehn|sieben|achtzehn|acht|neunzehn|neun|elf|zwölf|füfzehn)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -298,17 +298,17 @@ ruleInteger = Rule
|
||||
"zwei" -> integer 2
|
||||
"drei" -> integer 3
|
||||
"vier" -> integer 4
|
||||
"f\x00fcnf" -> integer 5
|
||||
"fünf" -> integer 5
|
||||
"sechs" -> integer 6
|
||||
"sieben" -> integer 7
|
||||
"acht" -> integer 8
|
||||
"neun" -> integer 9
|
||||
"zehn" -> integer 10
|
||||
"elf" -> integer 11
|
||||
"zw\x00f6lf" -> integer 12
|
||||
"zwölf" -> integer 12
|
||||
"dreizehn" -> integer 13
|
||||
"vierzehn" -> integer 14
|
||||
"f\x00fcnfzehn" -> integer 15
|
||||
"fünfzehn" -> integer 15
|
||||
"sechzehn" -> integer 16
|
||||
"siebzehn" -> integer 17
|
||||
"achtzehn" -> integer 18
|
||||
@ -321,14 +321,14 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(zwanzig|dreissig|vierzig|f\x00fcnfzig|sechzig|siebzig|achtzig|neunzig)"
|
||||
[ regex "(zwanzig|dreissig|vierzig|fünfzig|sechzig|siebzig|achtzig|neunzig)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"zwanzig" -> integer 20
|
||||
"dreissig" -> integer 30
|
||||
"vierzig" -> integer 40
|
||||
"f\x00fcnfzig" -> integer 50
|
||||
"fünfzig" -> integer 50
|
||||
"sechzig" -> integer 60
|
||||
"siebzig" -> integer 70
|
||||
"achtzig" -> integer 80
|
||||
|
@ -234,7 +234,7 @@ ruleSuffixes = Rule
|
||||
{ name = "suffixes (K,M,G))"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "(k|m|g)(?=[\\W$\x20ac\x00a2\x00a3]|$)"
|
||||
, regex "(k|m|g)(?=[\\W$€¢£]|$)"
|
||||
]
|
||||
, prod = \tokens ->
|
||||
case tokens of
|
||||
|
@ -110,12 +110,12 @@ zeroToFifteenMap = HashMap.fromList
|
||||
, ( "una" , 1 )
|
||||
, ( "uno" , 1 )
|
||||
, ( "dos" , 2 )
|
||||
, ( "tr\x00e9s" , 3 )
|
||||
, ( "trés" , 3 )
|
||||
, ( "tres" , 3 )
|
||||
, ( "cuatro" , 4 )
|
||||
, ( "cinco" , 5 )
|
||||
, ( "seis" , 6 )
|
||||
, ( "s\x00e9is" , 6 )
|
||||
, ( "séis" , 6 )
|
||||
, ( "siete" , 7 )
|
||||
, ( "ocho" , 8 )
|
||||
, ( "nueve" , 9 )
|
||||
@ -132,7 +132,7 @@ ruleNumeral :: Rule
|
||||
ruleNumeral = Rule
|
||||
{ name = "number (0..15)"
|
||||
, pattern =
|
||||
[ regex "((c|z)ero|un(o|a)?|dos|tr(\x00e9|e)s|cuatro|cinco|s(e|\x00e9)is|siete|ocho|nueve|die(z|s)|once|doce|trece|catorce|quince)"
|
||||
[ regex "((c|z)ero|un(o|a)?|dos|tr(é|e)s|cuatro|cinco|s(e|é)is|siete|ocho|nueve|die(z|s)|once|doce|trece|catorce|quince)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -143,20 +143,20 @@ ruleNumeral = Rule
|
||||
sixteenToTwentyNineMap :: HashMap.HashMap Text.Text Integer
|
||||
sixteenToTwentyNineMap = HashMap.fromList
|
||||
[ ( "dieciseis" , 16 )
|
||||
, ( "diesis\x00e9is" , 16 )
|
||||
, ( "diesiséis" , 16 )
|
||||
, ( "diesiseis" , 16 )
|
||||
, ( "diecis\x00e9is" , 16 )
|
||||
, ( "dieciséis" , 16 )
|
||||
, ( "diecisiete" , 17 )
|
||||
, ( "dieciocho" , 18 )
|
||||
, ( "diecinueve" , 19 )
|
||||
, ( "veintiuno" , 21 )
|
||||
, ( "veintiuna" , 21 )
|
||||
, ( "veintidos" , 22 )
|
||||
, ( "veintitr\x00e9s" , 23 )
|
||||
, ( "veintitrés" , 23 )
|
||||
, ( "veintitres" , 23 )
|
||||
, ( "veinticuatro" , 24 )
|
||||
, ( "veinticinco" , 25 )
|
||||
, ( "veintis\x00e9is" , 26 )
|
||||
, ( "veintiséis" , 26 )
|
||||
, ( "veintiseis" , 26 )
|
||||
, ( "veintisiete" , 27 )
|
||||
, ( "veintiocho" , 28 )
|
||||
@ -167,7 +167,7 @@ ruleNumeral5 :: Rule
|
||||
ruleNumeral5 = Rule
|
||||
{ name = "number (16..19 21..29)"
|
||||
, pattern =
|
||||
[ regex "(die(c|s)is(\x00e9|e)is|diecisiete|dieciocho|diecinueve|veintiun(o|a)|veintidos|veintitr(\x00e9|e)s|veinticuatro|veinticinco|veintis(\x00e9|e)is|veintisiete|veintiocho|veintinueve)"
|
||||
[ regex "(die(c|s)is(é|e)is|diecisiete|dieciocho|diecinueve|veintiun(o|a)|veintidos|veintitr(é|e)s|veinticuatro|veinticinco|veintis(é|e)is|veintisiete|veintiocho|veintinueve)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -194,7 +194,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
|
@ -77,7 +77,7 @@ ruleTen :: Rule
|
||||
ruleTen = Rule
|
||||
{ name = "ten"
|
||||
, pattern =
|
||||
[ regex "k\x00fcmme"
|
||||
[ regex "kümme"
|
||||
]
|
||||
, prod = \_ -> integer 10 >>= withGrain 1
|
||||
}
|
||||
@ -122,7 +122,7 @@ ruleAFew :: Rule
|
||||
ruleAFew = Rule
|
||||
{ name = "(a )?few"
|
||||
, pattern =
|
||||
[ regex "m\x00f5ni"
|
||||
[ regex "mõni"
|
||||
]
|
||||
, prod = \_ -> integer 3
|
||||
}
|
||||
@ -158,7 +158,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -187,12 +187,12 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(null|\x00fcksteist|\x00fcks|kaksteist|kaks|kolmteist|kolm|neliteist|neli|viisteist|viis|kuusteist|kuus|seitseteist|seitse|kaheksateist|kaheksa|\x00fcheksateist|\x00fcheksa|k\x00fcmme)"
|
||||
[ regex "(null|üksteist|üks|kaksteist|kaks|kolmteist|kolm|neliteist|neli|viisteist|viis|kuusteist|kuus|seitseteist|seitse|kaheksateist|kaheksa|üheksateist|üheksa|kümme)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"null" -> integer 0
|
||||
"\x00fcks" -> integer 1
|
||||
"üks" -> integer 1
|
||||
"kaks" -> integer 2
|
||||
"kolm" -> integer 3
|
||||
"neli" -> integer 4
|
||||
@ -200,9 +200,9 @@ ruleInteger = Rule
|
||||
"kuus" -> integer 6
|
||||
"seitse" -> integer 7
|
||||
"kaheksa" -> integer 8
|
||||
"\x00fcheksa" -> integer 9
|
||||
"k\x00fcmme" -> integer 10
|
||||
"\x00fcksteist" -> integer 11
|
||||
"üheksa" -> integer 9
|
||||
"kümme" -> integer 10
|
||||
"üksteist" -> integer 11
|
||||
"kaksteist" -> integer 12
|
||||
"kolmteist" -> integer 13
|
||||
"neliteist" -> integer 14
|
||||
@ -210,7 +210,7 @@ ruleInteger = Rule
|
||||
"kuusteist" -> integer 16
|
||||
"seitseteist" -> integer 17
|
||||
"kaheksateist" -> integer 18
|
||||
"\x00fcheksateist" -> integer 19
|
||||
"üheksateist" -> integer 19
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -219,7 +219,7 @@ ruleInteger4 :: Rule
|
||||
ruleInteger4 = Rule
|
||||
{ name = "integer (200..900)"
|
||||
, pattern =
|
||||
[ regex "(kakssada|kolmsada|nelisada|viissada|kuussada|seitsesada|kaheksasada|\x00fcheksasada)"
|
||||
[ regex "(kakssada|kolmsada|nelisada|viissada|kuussada|seitsesada|kaheksasada|üheksasada)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -230,7 +230,7 @@ ruleInteger4 = Rule
|
||||
"kuussada" -> integer 600 >>= withGrain 2 >>= withMultipliable
|
||||
"seitsesada" -> integer 700 >>= withGrain 2 >>= withMultipliable
|
||||
"kaheksasada" -> integer 800 >>= withGrain 2 >>= withMultipliable
|
||||
"\x00fcheksasada" -> integer 900 >>= withGrain 2 >>= withMultipliable
|
||||
"üheksasada" -> integer 900 >>= withGrain 2 >>= withMultipliable
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -239,18 +239,18 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "((kaks|kolm|neli|viis|kuus|seitse|kaheksa|(\x00fc)heksa)k(\x00fc)mmend)"
|
||||
[ regex "((kaks|kolm|neli|viis|kuus|seitse|kaheksa|(ü)heksa)k(ü)mmend)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"kaksk\x00fcmmend" -> integer 20
|
||||
"kolmk\x00fcmmend" -> integer 30
|
||||
"nelik\x00fcmmend" -> integer 40
|
||||
"viisk\x00fcmmend" -> integer 50
|
||||
"kuusk\x00fcmmend" -> integer 60
|
||||
"seitsek\x00fcmmend" -> integer 70
|
||||
"kaheksak\x00fcmmend" -> integer 80
|
||||
"\x00fcheksak\x00fcmmend" -> integer 90
|
||||
"kakskümmend" -> integer 20
|
||||
"kolmkümmend" -> integer 30
|
||||
"nelikümmend" -> integer 40
|
||||
"viiskümmend" -> integer 50
|
||||
"kuuskümmend" -> integer 60
|
||||
"seitsekümmend" -> integer 70
|
||||
"kaheksakümmend" -> integer 80
|
||||
"üheksakümmend" -> integer 90
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ ruleNumerals5 = Rule
|
||||
ruleNumeralMap :: HashMap Text Integer
|
||||
ruleNumeralMap = HashMap.fromList
|
||||
[ ( "zero" , 0 )
|
||||
, ( "z\x00e9ro", 0 )
|
||||
, ( "zéro", 0 )
|
||||
, ( "un" , 1 )
|
||||
, ( "une" , 1 )
|
||||
, ( "deux" , 2 )
|
||||
@ -168,7 +168,7 @@ ruleNumeral :: Rule
|
||||
ruleNumeral = Rule
|
||||
{ name = "number (0..16)"
|
||||
, pattern =
|
||||
[ regex "(z(e|\x00e9)ro|une?|deux|trois|quatre|cinq|six|sept|huit|neuf|dix|onze|douze|treize|quatorze|quinze|seize)"
|
||||
[ regex "(z(e|é)ro|une?|deux|trois|quatre|cinq|six|sept|huit|neuf|dix|onze|douze|treize|quatorze|quinze|seize)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -211,7 +211,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W$\x20ac\x00a2\x00a3]|$)"
|
||||
, regex "([kmg])(?=[\\W$€¢£]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
|
@ -27,7 +27,7 @@ ruleNumeralsPrefixWithNegativeOrMinus :: Rule
|
||||
ruleNumeralsPrefixWithNegativeOrMinus = Rule
|
||||
{ name = "numbers prefix with -, negative or minus"
|
||||
, pattern =
|
||||
[ regex "-|m(\x00ed|i)neas(\\sa)?\\s?"
|
||||
[ regex "-|m(í|i)neas(\\sa)?\\s?"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -54,19 +54,19 @@ ruleNumerals2 :: Rule
|
||||
ruleNumerals2 = Rule
|
||||
{ name = "numbers, 1-10"
|
||||
, pattern =
|
||||
[ regex "(aon|dh(\x00e1|a)|tr(\x00ed|i)|ceithre|c(\x00fa|u)ig|seacht|s(\x00e9|e)|ocht|naoi|deich)"
|
||||
[ regex "(aon|dh(á|a)|tr(í|i)|ceithre|c(ú|u)ig|seacht|s(é|e)|ocht|naoi|deich)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"aon" -> integer 1
|
||||
"dha" -> integer 2
|
||||
"dh\x00e1" -> integer 2
|
||||
"tr\x00ed" -> integer 3
|
||||
"dhá" -> integer 2
|
||||
"trí" -> integer 3
|
||||
"tri" -> integer 3
|
||||
"ceithre" -> integer 4
|
||||
"cuig" -> integer 5
|
||||
"c\x00faig" -> integer 5
|
||||
"s\x00e9" -> integer 6
|
||||
"cúig" -> integer 5
|
||||
"sé" -> integer 6
|
||||
"se" -> integer 6
|
||||
"seacht" -> integer 7
|
||||
"ocht" -> integer 8
|
||||
@ -103,7 +103,7 @@ ruleDag :: Rule
|
||||
ruleDag = Rule
|
||||
{ name = "déag"
|
||||
, pattern =
|
||||
[ regex "d(\x00e9|e)ag"
|
||||
[ regex "d(é|e)ag"
|
||||
]
|
||||
, prod = \_ -> integer 10
|
||||
}
|
||||
@ -113,7 +113,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -130,15 +130,15 @@ ruleOldVigesimalNumeralsS :: Rule
|
||||
ruleOldVigesimalNumeralsS = Rule
|
||||
{ name = "old vigesimal numbers, 20s"
|
||||
, pattern =
|
||||
[ regex "is (dh?(\x00e1|a) fhichead|tr(\x00ed|i) fichid|ceithre fichid)"
|
||||
[ regex "is (dh?(á|a) fhichead|tr(í|i) fichid|ceithre fichid)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"d\x00e1 fhichead" -> integer 40
|
||||
"dá fhichead" -> integer 40
|
||||
"da fhichead" -> integer 40
|
||||
"dh\x00e1 fhichead" -> integer 40
|
||||
"dhá fhichead" -> integer 40
|
||||
"dha fhichead" -> integer 40
|
||||
"tr\x00ed fichid" -> integer 60
|
||||
"trí fichid" -> integer 60
|
||||
"tri fichid" -> integer 60
|
||||
"ceithre fichid" -> integer 80
|
||||
_ -> Nothing
|
||||
@ -149,16 +149,16 @@ ruleOldVigesimalNumeralsS2 :: Rule
|
||||
ruleOldVigesimalNumeralsS2 = Rule
|
||||
{ name = "old vigesimal numbers, 20s + 10"
|
||||
, pattern =
|
||||
[ regex "d(\x00e9|e)ag is (fiche|dh?(\x00e1|a) fhichead|tr(\x00ed|i) fichid|ceithre fichid)"
|
||||
[ regex "d(é|e)ag is (fiche|dh?(á|a) fhichead|tr(í|i) fichid|ceithre fichid)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"fiche" -> integer 30
|
||||
"d\x00e1 fhichead" -> integer 50
|
||||
"dá fhichead" -> integer 50
|
||||
"da fhichead" -> integer 50
|
||||
"dh\x00e1 fhichead" -> integer 50
|
||||
"dhá fhichead" -> integer 50
|
||||
"dha fhichead" -> integer 50
|
||||
"tr\x00ed fichid" -> integer 70
|
||||
"trí fichid" -> integer 70
|
||||
"tri fichid" -> integer 70
|
||||
"ceithre fichid" -> integer 90
|
||||
_ -> Nothing
|
||||
@ -169,7 +169,7 @@ ruleAmhin :: Rule
|
||||
ruleAmhin = Rule
|
||||
{ name = "amháin"
|
||||
, pattern =
|
||||
[ regex "amh(\x00e1|a)in"
|
||||
[ regex "amh(á|a)in"
|
||||
]
|
||||
, prod = \_ -> integer 1
|
||||
}
|
||||
@ -178,21 +178,21 @@ ruleNumerals :: Rule
|
||||
ruleNumerals = Rule
|
||||
{ name = "numbers, 20-90"
|
||||
, pattern =
|
||||
[ regex "(fiche|tr(\x00ed|i)ocha|daichead|caoga|seasca|seacht(\x00f3|o)|ocht(\x00f3|o)|n(\x00f3|o)cha)"
|
||||
[ regex "(fiche|tr(í|i)ocha|daichead|caoga|seasca|seacht(ó|o)|ocht(ó|o)|n(ó|o)cha)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"fiche" -> integer 20
|
||||
"triocha" -> integer 30
|
||||
"tr\x00edocha" -> integer 30
|
||||
"tríocha" -> integer 30
|
||||
"daichead" -> integer 40
|
||||
"caoga" -> integer 50
|
||||
"seasca" -> integer 60
|
||||
"seachto" -> integer 70
|
||||
"seacht\x00f3" -> integer 70
|
||||
"seachtó" -> integer 70
|
||||
"ochto" -> integer 80
|
||||
"ocht\x00f3" -> integer 80
|
||||
"n\x00f3cha" -> integer 90
|
||||
"ochtó" -> integer 80
|
||||
"nócha" -> integer 90
|
||||
"nocha" -> integer 90
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
@ -214,21 +214,21 @@ ruleCountNumerals :: Rule
|
||||
ruleCountNumerals = Rule
|
||||
{ name = "count numbers"
|
||||
, pattern =
|
||||
[ regex "a (n(\x00e1|a)id|haon|d(\x00f3|o)|tr(\x00ed|i)|ceathair|c(\x00fa|u)ig|s(\x00e9|e)|seacht|hocht|naoi|deich)"
|
||||
[ regex "a (n(á|a)id|haon|d(ó|o)|tr(í|i)|ceathair|c(ú|u)ig|s(é|e)|seacht|hocht|naoi|deich)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"naid" -> integer 0
|
||||
"n\x00e1id" -> integer 0
|
||||
"náid" -> integer 0
|
||||
"haon" -> integer 1
|
||||
"d\x00f3" -> integer 2
|
||||
"dó" -> integer 2
|
||||
"do" -> integer 2
|
||||
"tr\x00ed" -> integer 3
|
||||
"trí" -> integer 3
|
||||
"tri" -> integer 3
|
||||
"ceathair" -> integer 4
|
||||
"cuig" -> integer 5
|
||||
"c\x00faig" -> integer 5
|
||||
"s\x00e9" -> integer 6
|
||||
"cúig" -> integer 5
|
||||
"sé" -> integer 6
|
||||
"se" -> integer 6
|
||||
"seacht" -> integer 7
|
||||
"hocht" -> integer 8
|
||||
|
@ -28,7 +28,7 @@ ruleInteger5 :: Rule
|
||||
ruleInteger5 = Rule
|
||||
{ name = "integer 4"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05e8\x05d1\x05e2(\x05d4)?)"
|
||||
[ regex "(ארבע(ה)?)"
|
||||
]
|
||||
, prod = \_ -> integer 4
|
||||
}
|
||||
@ -52,7 +52,7 @@ ruleIntersectWithAnd = Rule
|
||||
{ name = "intersect (with and)"
|
||||
, pattern =
|
||||
[ numberWith (fromMaybe 0 . TNumeral.grain) (>1)
|
||||
, regex "\x05d5"
|
||||
, regex "ו"
|
||||
, numberWith TNumeral.multipliable not
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -82,7 +82,7 @@ ruleCompositeTensWithAnd = Rule
|
||||
{ name = "integer 21..99 (with and)"
|
||||
, pattern =
|
||||
[ oneOf [ 20, 30..90 ]
|
||||
, regex "\x05d5"
|
||||
, regex "ו"
|
||||
, numberBetween 1 10
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -97,7 +97,7 @@ ruleNumeralsPrefixWithNegativeOrMinus :: Rule
|
||||
ruleNumeralsPrefixWithNegativeOrMinus = Rule
|
||||
{ name = "numbers prefix with -, negative or minus"
|
||||
, pattern =
|
||||
[ regex "-|\x05de\x05d9\x05e0\x05d5\x05e1"
|
||||
[ regex "-|מינוס"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -122,7 +122,7 @@ ruleInteger10 :: Rule
|
||||
ruleInteger10 = Rule
|
||||
{ name = "integer 9"
|
||||
, pattern =
|
||||
[ regex "(\x05ea\x05e9\x05e2(\x05d4)?)"
|
||||
[ regex "(תשע(ה)?)"
|
||||
]
|
||||
, prod = \_ -> integer 9
|
||||
}
|
||||
@ -131,18 +131,18 @@ ruleInteger15 :: Rule
|
||||
ruleInteger15 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(\x05e2\x05e9\x05e8\x05d9\x05dd|\x05e9\x05dc\x05d5\x05e9\x05d9\x05dd|\x05d0\x05e8\x05d1\x05e2\x05d9\x05dd|\x05d7\x05de\x05d9\x05e9\x05d9\x05dd|\x05e9\x05d9\x05e9\x05d9\x05dd|\x05e9\x05d1\x05e2\x05d9\x05dd|\x05e9\x05de\x05d5\x05e0\x05d9\x05dd|\x05ea\x05e9\x05e2\x05d9\x05dd)"
|
||||
[ regex "(עשרים|שלושים|ארבעים|חמישים|שישים|שבעים|שמונים|תשעים)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x05e2\x05e9\x05e8\x05d9\x05dd" -> integer 20
|
||||
"\x05e9\x05dc\x05d5\x05e9\x05d9\x05dd" -> integer 30
|
||||
"\x05d0\x05e8\x05d1\x05e2\x05d9\x05dd" -> integer 40
|
||||
"\x05d7\x05de\x05d9\x05e9\x05d9\x05dd" -> integer 50
|
||||
"\x05e9\x05d9\x05e9\x05d9\x05dd" -> integer 60
|
||||
"\x05e9\x05d1\x05e2\x05d9\x05dd" -> integer 70
|
||||
"\x05e9\x05de\x05d5\x05e0\x05d9\x05dd" -> integer 80
|
||||
"\x05ea\x05e9\x05e2\x05d9\x05dd" -> integer 90
|
||||
"עשרים" -> integer 20
|
||||
"שלושים" -> integer 30
|
||||
"ארבעים" -> integer 40
|
||||
"חמישים" -> integer 50
|
||||
"שישים" -> integer 60
|
||||
"שבעים" -> integer 70
|
||||
"שמונים" -> integer 80
|
||||
"תשעים" -> integer 90
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -162,7 +162,7 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer 2"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05ea\x05d9\x05d9\x05dd|\x05e9\x05e0\x05d9\x05d9\x05dd)"
|
||||
[ regex "(שתיים|שניים)"
|
||||
]
|
||||
, prod = \_ -> integer 2
|
||||
}
|
||||
@ -171,7 +171,7 @@ ruleSingle :: Rule
|
||||
ruleSingle = Rule
|
||||
{ name = "single"
|
||||
, pattern =
|
||||
[ regex "\x05d9\x05d7\x05d9\x05d3"
|
||||
[ regex "יחיד"
|
||||
]
|
||||
, prod = \_ -> integer 1
|
||||
}
|
||||
@ -180,7 +180,7 @@ ruleInteger13 :: Rule
|
||||
ruleInteger13 = Rule
|
||||
{ name = "integer 12"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05e0\x05d9\x05d9\x05dd \x05e2\x05e9\x05e8|\x05ea\x05e8\x05d9 \x05e2\x05e9\x05e8)"
|
||||
[ regex "(שניים עשר|תרי עשר)"
|
||||
]
|
||||
, prod = \_ -> integer 12
|
||||
}
|
||||
@ -201,7 +201,7 @@ ruleInteger6 :: Rule
|
||||
ruleInteger6 = Rule
|
||||
{ name = "integer 5"
|
||||
, pattern =
|
||||
[ regex "(\x05d7\x05de(\x05e9|\x05d9\x05e9\x05d4))"
|
||||
[ regex "(חמ(ש|ישה))"
|
||||
]
|
||||
, prod = \_ -> integer 5
|
||||
}
|
||||
@ -210,21 +210,21 @@ rulePowersOfTen :: Rule
|
||||
rulePowersOfTen = Rule
|
||||
{ name = "powers of tens"
|
||||
, pattern =
|
||||
[ regex "(\x05de\x05d0(\x05d4|\x05d5\x05ea)|\x05d0\x05dc(\x05e3|\x05e4\x05d9\x05dd)|\x05de\x05d9\x05dc\x05d9\x05d5(\x05df|\x05e0\x05d9\x05dd))"
|
||||
[ regex "(מא(ה|ות)|אל(ף|פים)|מיליו(ן|נים))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"\x05de\x05d0\x05d4" ->
|
||||
"מאה" ->
|
||||
double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"\x05de\x05d0\x05d5\x05ea" ->
|
||||
"מאות" ->
|
||||
double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"\x05d0\x05dc\x05e3" ->
|
||||
"אלף" ->
|
||||
double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"\x05d0\x05dc\x05e4\x05d9\x05dd" ->
|
||||
"אלפים" ->
|
||||
double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"\x05de\x05d9\x05dc\x05d9\x05d5\x05df" ->
|
||||
"מיליון" ->
|
||||
double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
"\x05de\x05d9\x05dc\x05d9\x05d5\x05e0\x05d9\x05dd" ->
|
||||
"מיליונים" ->
|
||||
double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
@ -234,7 +234,7 @@ ruleInteger7 :: Rule
|
||||
ruleInteger7 = Rule
|
||||
{ name = "integer 6"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05e9(\x05d4)?)"
|
||||
[ regex "(שש(ה)?)"
|
||||
]
|
||||
, prod = \_ -> integer 6
|
||||
}
|
||||
@ -257,7 +257,7 @@ ruleInteger8 :: Rule
|
||||
ruleInteger8 = Rule
|
||||
{ name = "integer 7"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05d1\x05e2(\x05d4)?)"
|
||||
[ regex "(שבע(ה)?)"
|
||||
]
|
||||
, prod = \_ -> integer 7
|
||||
}
|
||||
@ -266,7 +266,7 @@ ruleCouple :: Rule
|
||||
ruleCouple = Rule
|
||||
{ name = "couple"
|
||||
, pattern =
|
||||
[ regex "\x05d6\x05d5\x05d2( \x05e9\x05dc)?"
|
||||
[ regex "זוג( של)?"
|
||||
]
|
||||
, prod = \_ -> integer 2
|
||||
}
|
||||
@ -289,7 +289,7 @@ ruleInteger9 :: Rule
|
||||
ruleInteger9 = Rule
|
||||
{ name = "integer 8"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05de\x05d5\x05e0\x05d4)"
|
||||
[ regex "(שמונה)"
|
||||
]
|
||||
, prod = \_ -> integer 8
|
||||
}
|
||||
@ -298,7 +298,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer 0"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05e4\x05e1|\x05db\x05dc\x05d5\x05dd)"
|
||||
[ regex "(אפס|כלום)"
|
||||
]
|
||||
, prod = \_ -> integer 0
|
||||
}
|
||||
@ -307,7 +307,7 @@ ruleInteger4 :: Rule
|
||||
ruleInteger4 = Rule
|
||||
{ name = "integer 3"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05dc\x05d5\x05e9(\x05d4)?)"
|
||||
[ regex "(שלוש(ה)?)"
|
||||
]
|
||||
, prod = \_ -> integer 3
|
||||
}
|
||||
@ -316,7 +316,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer 1"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05d7\x05d3|\x05d0\x05d7\x05ea)"
|
||||
[ regex "(אחד|אחת)"
|
||||
]
|
||||
, prod = \_ -> integer 1
|
||||
}
|
||||
@ -325,7 +325,7 @@ ruleInteger11 :: Rule
|
||||
ruleInteger11 = Rule
|
||||
{ name = "integer 10"
|
||||
, pattern =
|
||||
[ regex "(\x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> integer 10
|
||||
}
|
||||
@ -335,7 +335,7 @@ ruleNumeralDotNumeral = Rule
|
||||
{ name = "number dot number"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\x05e0\x05e7\x05d5\x05d3\x05d4"
|
||||
, regex "נקודה"
|
||||
, numberWith TNumeral.grain isNothing
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -98,7 +98,7 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer (100..900)"
|
||||
, pattern =
|
||||
[ regex "(sto|dvjest(o|a)|tristo|(c|\x010d)etiristo|petsto|(\x0161|s)esto|sedamsto|osamsto|devetsto)"
|
||||
[ regex "(sto|dvjest(o|a)|tristo|(c|č)etiristo|petsto|(š|s)esto|sedamsto|osamsto|devetsto)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -131,7 +131,7 @@ rulePowersOfTen :: Rule
|
||||
rulePowersOfTen = Rule
|
||||
{ name = "powers of tens"
|
||||
, pattern =
|
||||
[ regex "(stotin(u|a|e)|tisu(c|\x0107)(a|u|e)|milij(u|o)na?)"
|
||||
[ regex "(stotin(u|a|e)|tisu(c|ć)(a|u|e)|milij(u|o)na?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -187,7 +187,7 @@ ruleNumbersSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -222,7 +222,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(ni(s|\x0161)ta|ni(s|\x0161)tica|nula|jedanaest|dvanaest|trinaest|jeda?n(a|u|o(ga?)?)?|dv(i?je)?(a|o)?(ma)?|tri(ma)?|(\x010d|c)etiri|(\x010d|c)etrnaest|petnaest|pet|(s|\x0161)esnaest|(\x0161|s)est|sedamnaest|sedam|osamnaest|osam|devetnaest|devet)"
|
||||
[ regex "(ni(s|š)ta|ni(s|š)tica|nula|jedanaest|dvanaest|trinaest|jeda?n(a|u|o(ga?)?)?|dv(i?je)?(a|o)?(ma)?|tri(ma)?|(č|c)etiri|(č|c)etrnaest|petnaest|pet|(s|š)esnaest|(š|s)est|sedamnaest|sedam|osamnaest|osam|devetnaest|devet)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -283,7 +283,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(dvadeset|trideset|(c|\x010d)etrdeset|pedeset|(\x0161|s)esdeset|sedamdeset|osamdeset|devedeset)"
|
||||
[ regex "(dvadeset|trideset|(c|č)etrdeset|pedeset|(š|s)esdeset|sedamdeset|osamdeset|devedeset)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -322,7 +322,7 @@ ruleNumberDotNumber = Rule
|
||||
{ name = "number dot number"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "cijela|to(c|\x010d)ka|zarez"
|
||||
, regex "cijela|to(c|č)ka|zarez"
|
||||
, numberWith TNumeral.grain isNothing
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -136,7 +136,7 @@ ruleTens :: Rule
|
||||
ruleTens = Rule
|
||||
{ name = "integer (20,30..90)"
|
||||
, pattern =
|
||||
[ regex "(h\x00FAsz|harminc|negyven|\x00f6tven|hatvan|hetven|nyolcvan|kilencven)"
|
||||
[ regex "(h\x00FAsz|harminc|negyven|ötven|hatvan|hetven|nyolcvan|kilencven)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -184,7 +184,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
|
@ -174,7 +174,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -191,14 +191,14 @@ ruleNumeral4 :: Rule
|
||||
ruleNumeral4 = Rule
|
||||
{ name = "number (21..29 31..39 41..49 51..59 61..69 71..79 81..89 91..99)"
|
||||
, pattern =
|
||||
[ regex "((venti|trenta|quaranta|cinquanta|sessanta|settanta|ottanta|novanta)(due|tre|tr\x00e9|quattro|cinque|sei|sette|nove))|((vent|trent|quarant|cinquant|sessant|settant|ottant|novant)(uno|otto))"
|
||||
[ regex "((venti|trenta|quaranta|cinquanta|sessanta|settanta|ottanta|novanta)(due|tre|tré|quattro|cinque|sei|sette|nove))|((vent|trent|quarant|cinquant|sessant|settant|ottant|novant)(uno|otto))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"ventuno" -> integer 21
|
||||
"ventidue" -> integer 22
|
||||
"ventitre" -> integer 23
|
||||
"ventitr\x00e9" -> integer 23
|
||||
"ventitré" -> integer 23
|
||||
"ventiquattro" -> integer 24
|
||||
"venticinque" -> integer 25
|
||||
"ventisei" -> integer 26
|
||||
@ -208,7 +208,7 @@ ruleNumeral4 = Rule
|
||||
"trentuno" -> integer 31
|
||||
"trentadue" -> integer 32
|
||||
"trentatre" -> integer 33
|
||||
"trentatr\x00e9" -> integer 33
|
||||
"trentatré" -> integer 33
|
||||
"trentaquattro" -> integer 34
|
||||
"trentacinque" -> integer 35
|
||||
"trentasei" -> integer 36
|
||||
@ -218,7 +218,7 @@ ruleNumeral4 = Rule
|
||||
"quarantuno" -> integer 41
|
||||
"quarantadue" -> integer 42
|
||||
"quarantatre" -> integer 43
|
||||
"quarantatr\x00e9" -> integer 43
|
||||
"quarantatré" -> integer 43
|
||||
"quarantaquattro" -> integer 44
|
||||
"quarantacinque" -> integer 45
|
||||
"quarantasei" -> integer 46
|
||||
@ -228,7 +228,7 @@ ruleNumeral4 = Rule
|
||||
"cinquantuno" -> integer 51
|
||||
"cinquantadue" -> integer 52
|
||||
"cinquantatre" -> integer 53
|
||||
"cinquantatr\x00e9" -> integer 53
|
||||
"cinquantatré" -> integer 53
|
||||
"cinquantaquattro" -> integer 54
|
||||
"cinquantacinque" -> integer 55
|
||||
"cinquantasei" -> integer 56
|
||||
@ -237,7 +237,7 @@ ruleNumeral4 = Rule
|
||||
"cinquantanove" -> integer 59
|
||||
"sessantuno" -> integer 61
|
||||
"sessantadue" -> integer 62
|
||||
"sessantatr\x00e9" -> integer 63
|
||||
"sessantatré" -> integer 63
|
||||
"sessantatre" -> integer 63
|
||||
"sessantaquattro" -> integer 64
|
||||
"sessantacinque" -> integer 65
|
||||
@ -247,7 +247,7 @@ ruleNumeral4 = Rule
|
||||
"sessantanove" -> integer 69
|
||||
"settantuno" -> integer 71
|
||||
"settantadue" -> integer 72
|
||||
"settantatr\x00e9" -> integer 73
|
||||
"settantatré" -> integer 73
|
||||
"settantatre" -> integer 73
|
||||
"settantaquattro" -> integer 74
|
||||
"settantacinque" -> integer 75
|
||||
@ -257,7 +257,7 @@ ruleNumeral4 = Rule
|
||||
"settantanove" -> integer 79
|
||||
"ottantuno" -> integer 81
|
||||
"ottantadue" -> integer 82
|
||||
"ottantatr\x00e9" -> integer 83
|
||||
"ottantatré" -> integer 83
|
||||
"ottantatre" -> integer 83
|
||||
"ottantaquattro" -> integer 84
|
||||
"ottantacinque" -> integer 85
|
||||
@ -268,7 +268,7 @@ ruleNumeral4 = Rule
|
||||
"novantuno" -> integer 91
|
||||
"novantadue" -> integer 92
|
||||
"novantatre" -> integer 93
|
||||
"novantatr\x00e9" -> integer 93
|
||||
"novantatré" -> integer 93
|
||||
"novantaquattro" -> integer 94
|
||||
"novantacinque" -> integer 95
|
||||
"novantasei" -> integer 96
|
||||
|
@ -27,7 +27,7 @@ ruleInteger5 :: Rule
|
||||
ruleInteger5 = Rule
|
||||
{ name = "integer (100)"
|
||||
, pattern =
|
||||
[ regex "\x767e"
|
||||
[ regex "百"
|
||||
]
|
||||
, prod = \_ -> integer 100
|
||||
}
|
||||
@ -36,7 +36,7 @@ ruleNumeralsPrefixWithNegativeOrMinus :: Rule
|
||||
ruleNumeralsPrefixWithNegativeOrMinus = Rule
|
||||
{ name = "numbers prefix with -, negative or minus"
|
||||
, pattern =
|
||||
[ regex "-|\x30de\x30a4\x30ca\x30b9\\s?|\x8ca0\\s?"
|
||||
[ regex "-|マイナス\\s?|負\\s?"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -48,22 +48,22 @@ ruleInteger17 :: Rule
|
||||
ruleInteger17 = Rule
|
||||
{ name = "integer (0..10)"
|
||||
, pattern =
|
||||
[ regex "(\x30bc\x30ed|\x96f6|\x4e00|\x4e8c|\x4e09|\x56db|\x4e94|\x516d|\x4e03|\x516b|\x4e5d|\x5341)"
|
||||
[ regex "(ゼロ|零|一|二|三|四|五|六|七|八|九|十)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x30bc\x30ed" -> integer 0
|
||||
"\x96f6" -> integer 0
|
||||
"\x4e00" -> integer 1
|
||||
"\x4e8c" -> integer 2
|
||||
"\x4e09" -> integer 3
|
||||
"\x56db" -> integer 4
|
||||
"\x4e94" -> integer 5
|
||||
"\x516d" -> integer 6
|
||||
"\x4e03" -> integer 7
|
||||
"\x516b" -> integer 8
|
||||
"\x4e5d" -> integer 9
|
||||
"\x5341" -> integer 10
|
||||
"ゼロ" -> integer 0
|
||||
"零" -> integer 0
|
||||
"一" -> integer 1
|
||||
"二" -> integer 2
|
||||
"三" -> integer 3
|
||||
"四" -> integer 4
|
||||
"五" -> integer 5
|
||||
"六" -> integer 6
|
||||
"七" -> integer 7
|
||||
"八" -> integer 8
|
||||
"九" -> integer 9
|
||||
"十" -> integer 10
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -85,7 +85,7 @@ ruleInteger10 :: Rule
|
||||
ruleInteger10 = Rule
|
||||
{ name = "integer (1000..1999)"
|
||||
, pattern =
|
||||
[ regex "\x5343"
|
||||
[ regex "千"
|
||||
, numberBetween 1 1000
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -111,7 +111,7 @@ ruleInteger15 = Rule
|
||||
{ name = "integer (20000..90000)"
|
||||
, pattern =
|
||||
[ numberBetween 2 10
|
||||
, regex "\x4e07"
|
||||
, regex "万"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10000
|
||||
@ -134,7 +134,7 @@ ruleNumeral = Rule
|
||||
{ name = "<number>个"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\x4e2a"
|
||||
, regex "个"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> Just token
|
||||
@ -146,7 +146,7 @@ ruleInteger3 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ numberBetween 2 10
|
||||
, regex "\x5341"
|
||||
, regex "十"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10
|
||||
@ -157,7 +157,7 @@ ruleInteger13 :: Rule
|
||||
ruleInteger13 = Rule
|
||||
{ name = "integer (10000)"
|
||||
, pattern =
|
||||
[ regex "\x4e07"
|
||||
[ regex "万"
|
||||
]
|
||||
, prod = \_ -> integer 10000
|
||||
}
|
||||
@ -166,7 +166,7 @@ ruleInteger6 :: Rule
|
||||
ruleInteger6 = Rule
|
||||
{ name = "integer (100..199)"
|
||||
, pattern =
|
||||
[ regex "\x767e"
|
||||
[ regex "百"
|
||||
, numberBetween 1 100
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -193,15 +193,15 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G, 千, 万)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "(k|m|g|\x5343|\x4e07)"
|
||||
, regex "(k|m|g|千|万)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
Token RegexMatch (GroupMatch (match:_)):
|
||||
_) -> case Text.toLower match of
|
||||
"k" -> double $ v * 1e3
|
||||
"\x5343" -> double $ v * 1e3
|
||||
"\x4e07" -> double $ v * 1e4
|
||||
"千" -> double $ v * 1e3
|
||||
"万" -> double $ v * 1e4
|
||||
"m" -> double $ v * 1e6
|
||||
"g" -> double $ v * 1e9
|
||||
_ -> Nothing
|
||||
@ -213,7 +213,7 @@ ruleInteger7 = Rule
|
||||
{ name = "integer (200..900)"
|
||||
, pattern =
|
||||
[ numberBetween 2 10
|
||||
, regex "\x767e"
|
||||
, regex "百"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 100
|
||||
@ -224,7 +224,7 @@ ruleInteger14 :: Rule
|
||||
ruleInteger14 = Rule
|
||||
{ name = "integer (10000..19999)"
|
||||
, pattern =
|
||||
[ regex "\x4e07"
|
||||
[ regex "万"
|
||||
, numberBetween 1 10000
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -265,7 +265,7 @@ ruleInteger9 :: Rule
|
||||
ruleInteger9 = Rule
|
||||
{ name = "integer (1000)"
|
||||
, pattern =
|
||||
[ regex "\x5343"
|
||||
[ regex "千"
|
||||
]
|
||||
, prod = \_ -> integer 1000
|
||||
}
|
||||
@ -274,22 +274,22 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..10)"
|
||||
, pattern =
|
||||
[ regex "\x30bc\x30ed|\x96f6|\x4e00|\x4e8c|\x4e09|\x56db|\x4e94|\x516d|\x4e03|\x516b|\x4e5d|\x5341"
|
||||
[ regex "ゼロ|零|一|二|三|四|五|六|七|八|九|十"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x96f6" -> integer 0
|
||||
"\x30bc\x30ed" -> integer 0
|
||||
"\x4e00" -> integer 1
|
||||
"\x4e8c" -> integer 2
|
||||
"\x4e09" -> integer 3
|
||||
"\x56db" -> integer 4
|
||||
"\x4e94" -> integer 5
|
||||
"\x516d" -> integer 6
|
||||
"\x4e03" -> integer 7
|
||||
"\x516b" -> integer 8
|
||||
"\x4e5d" -> integer 9
|
||||
"\x5341" -> integer 10
|
||||
"零" -> integer 0
|
||||
"ゼロ" -> integer 0
|
||||
"一" -> integer 1
|
||||
"二" -> integer 2
|
||||
"三" -> integer 3
|
||||
"四" -> integer 4
|
||||
"五" -> integer 5
|
||||
"六" -> integer 6
|
||||
"七" -> integer 7
|
||||
"八" -> integer 8
|
||||
"九" -> integer 9
|
||||
"十" -> integer 10
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -312,7 +312,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (11..19)"
|
||||
, pattern =
|
||||
[ regex "\x5341"
|
||||
[ regex "十"
|
||||
, numberBetween 1 10
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -325,7 +325,7 @@ ruleInteger11 = Rule
|
||||
{ name = "integer (2000..9000)"
|
||||
, pattern =
|
||||
[ numberBetween 2 10
|
||||
, regex "\x5343"
|
||||
, regex "千"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 1000
|
||||
|
@ -28,15 +28,15 @@ ruleIntegerForOrdinals :: Rule
|
||||
ruleIntegerForOrdinals = Rule
|
||||
{ name = "integer (1..4) - for ordinals"
|
||||
, pattern =
|
||||
[ regex "(\xd55c|\xccab|\xb450|\xc138|\xb124)"
|
||||
[ regex "(한|첫|두|세|네)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\xd55c" -> integer 1
|
||||
"\xccab" -> integer 1
|
||||
"\xb450" -> integer 2
|
||||
"\xc138" -> integer 3
|
||||
"\xb124" -> integer 4
|
||||
"한" -> integer 1
|
||||
"첫" -> integer 1
|
||||
"두" -> integer 2
|
||||
"세" -> integer 3
|
||||
"네" -> integer 4
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -58,7 +58,7 @@ ruleFew :: Rule
|
||||
ruleFew = Rule
|
||||
{ name = "few 몇"
|
||||
, pattern =
|
||||
[ regex "\xba87"
|
||||
[ regex "몇"
|
||||
]
|
||||
, prod = \_ -> integer 3
|
||||
}
|
||||
@ -106,7 +106,7 @@ ruleNumeralsPrefixWithOr :: Rule
|
||||
ruleNumeralsPrefixWithOr = Rule
|
||||
{ name = "numbers prefix with -, 마이너스, or 마이나스"
|
||||
, pattern =
|
||||
[ regex "-|\xb9c8\xc774\xb108\xc2a4\\s?|\xb9c8\xc774\xb098\xc2a4\\s?"
|
||||
[ regex "-|마이너스\\s?|마이나스\\s?"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -118,7 +118,7 @@ ruleHalf :: Rule
|
||||
ruleHalf = Rule
|
||||
{ name = "half - 반"
|
||||
, pattern =
|
||||
[ regex "\xbc18"
|
||||
[ regex "반"
|
||||
]
|
||||
, prod = \_ -> double 0.5
|
||||
}
|
||||
@ -127,7 +127,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer 0"
|
||||
, pattern =
|
||||
[ regex "\xc601|\xacf5|\xbe75"
|
||||
[ regex "영|공|빵"
|
||||
]
|
||||
, prod = \_ -> integer 0
|
||||
}
|
||||
@ -136,19 +136,19 @@ ruleIntegerTypeAndOrdinals :: Rule
|
||||
ruleIntegerTypeAndOrdinals = Rule
|
||||
{ name = "integer (20..90) - TYPE 2 and ordinals"
|
||||
, pattern =
|
||||
[ regex "(\xc5f4|\xc2a4\xbb3c|\xc11c\xb978|\xb9c8\xd754|\xc270|\xc608\xc21c|\xc77c\xd754|\xc5ec\xb4e0|\xc544\xd754)"
|
||||
[ regex "(열|스물|서른|마흔|쉰|예순|일흔|여든|아흔)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\xc5f4" -> integer 10
|
||||
"\xc2a4\xbb3c" -> integer 20
|
||||
"\xc11c\xb978" -> integer 30
|
||||
"\xb9c8\xd754" -> integer 40
|
||||
"\xc270" -> integer 50
|
||||
"\xc608\xc21c" -> integer 60
|
||||
"\xc77c\xd754" -> integer 70
|
||||
"\xc5ec\xb4e0" -> integer 80
|
||||
"\xc544\xd754" -> integer 90
|
||||
"열" -> integer 10
|
||||
"스물" -> integer 20
|
||||
"서른" -> integer 30
|
||||
"마흔" -> integer 40
|
||||
"쉰" -> integer 50
|
||||
"예순" -> integer 60
|
||||
"일흔" -> integer 70
|
||||
"여든" -> integer 80
|
||||
"아흔" -> integer 90
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -157,20 +157,20 @@ ruleIntegerType1 :: Rule
|
||||
ruleIntegerType1 = Rule
|
||||
{ name = "integer - TYPE 1"
|
||||
, pattern =
|
||||
[ regex "(\xc601|\xc77c|\xc774|\xc0bc|\xc0ac|\xc624|\xc721|\xce60|\xd314|\xad6c)"
|
||||
[ regex "(영|일|이|삼|사|오|육|칠|팔|구)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\xc601" -> integer 0
|
||||
"\xc77c" -> integer 1
|
||||
"\xc774" -> integer 2
|
||||
"\xc0bc" -> integer 3
|
||||
"\xc0ac" -> integer 4
|
||||
"\xc624" -> integer 5
|
||||
"\xc721" -> integer 6
|
||||
"\xce60" -> integer 7
|
||||
"\xd314" -> integer 8
|
||||
"\xad6c" -> integer 9
|
||||
"영" -> integer 0
|
||||
"일" -> integer 1
|
||||
"이" -> integer 2
|
||||
"삼" -> integer 3
|
||||
"사" -> integer 4
|
||||
"오" -> integer 5
|
||||
"육" -> integer 6
|
||||
"칠" -> integer 7
|
||||
"팔" -> integer 8
|
||||
"구" -> integer 9
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -179,16 +179,16 @@ ruleIntegerType1PowersOfTen :: Rule
|
||||
ruleIntegerType1PowersOfTen = Rule
|
||||
{ name = "integer - TYPE 1: powers of ten"
|
||||
, pattern =
|
||||
[ regex "(\xc2ed|\xbc31|\xcc9c|\xb9cc|\xc5b5|\xc870)"
|
||||
[ regex "(십|백|천|만|억|조)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\xc2ed" -> double 10 >>= withGrain 1 >>= withMultipliable
|
||||
"\xbc31" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"\xcc9c" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"\xb9cc" -> double 1e4 >>= withGrain 4 >>= withMultipliable
|
||||
"\xc5b5" -> double 1e8 >>= withGrain 8 >>= withMultipliable
|
||||
"\xc870" -> double 1e12 >>= withGrain 12 >>= withMultipliable
|
||||
"십" -> double 10 >>= withGrain 1 >>= withMultipliable
|
||||
"백" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"천" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"만" -> double 1e4 >>= withGrain 4 >>= withMultipliable
|
||||
"억" -> double 1e8 >>= withGrain 8 >>= withMultipliable
|
||||
"조" -> double 1e12 >>= withGrain 12 >>= withMultipliable
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -224,19 +224,19 @@ ruleIntegerType2 :: Rule
|
||||
ruleIntegerType2 = Rule
|
||||
{ name = "integer (1..10) - TYPE 2"
|
||||
, pattern =
|
||||
[ regex "(\xd558\xb098|\xb458|\xc14b|\xb137|\xb2e4\xc12f|\xc5ec\xc12f|\xc77c\xacf1|\xc5ec\xb35f|\xc544\xd649)"
|
||||
[ regex "(하나|둘|셋|넷|다섯|여섯|일곱|여덟|아홉)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\xd558\xb098" -> integer 1
|
||||
"\xb458" -> integer 2
|
||||
"\xc14b" -> integer 3
|
||||
"\xb137" -> integer 4
|
||||
"\xb2e4\xc12f" -> integer 5
|
||||
"\xc5ec\xc12f" -> integer 6
|
||||
"\xc77c\xacf1" -> integer 7
|
||||
"\xc5ec\xb35f" -> integer 8
|
||||
"\xc544\xd649" -> integer 9
|
||||
"하나" -> integer 1
|
||||
"둘" -> integer 2
|
||||
"셋" -> integer 3
|
||||
"넷" -> integer 4
|
||||
"다섯" -> integer 5
|
||||
"여섯" -> integer 6
|
||||
"일곱" -> integer 7
|
||||
"여덟" -> integer 8
|
||||
"아홉" -> integer 9
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -246,7 +246,7 @@ ruleFraction = Rule
|
||||
{ name = "fraction"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\xbd84(\xc758|\xc5d0)"
|
||||
, regex "분(의|에)"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -262,22 +262,22 @@ ruleNumeralDotNumeral = Rule
|
||||
{ name = "number dot number - 삼점사"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "(\xc810|\xca5c)((\xc601|\xc77c|\xc774|\xc0bc|\xc0ac|\xc624|\xc721|\xce60|\xd314|\xad6c)+)"
|
||||
, regex "(점|쩜)((영|일|이|삼|사|오|육|칠|팔|구)+)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v1}):
|
||||
Token RegexMatch (GroupMatch (_:match:_)):
|
||||
_) -> do
|
||||
let getDigit '\xc601' = Just "0"
|
||||
getDigit '\xc77c' = Just "1"
|
||||
getDigit '\xc774' = Just "2"
|
||||
getDigit '\xc0bc' = Just "3"
|
||||
getDigit '\xc0ac' = Just "4"
|
||||
getDigit '\xc624' = Just "5"
|
||||
getDigit '\xc721' = Just "6"
|
||||
getDigit '\xce60' = Just "7"
|
||||
getDigit '\xd314' = Just "8"
|
||||
getDigit '\xad6c' = Just "9"
|
||||
let getDigit '영' = Just "0"
|
||||
getDigit '일' = Just "1"
|
||||
getDigit '이' = Just "2"
|
||||
getDigit '삼' = Just "3"
|
||||
getDigit '사' = Just "4"
|
||||
getDigit '오' = Just "5"
|
||||
getDigit '육' = Just "6"
|
||||
getDigit '칠' = Just "7"
|
||||
getDigit '팔' = Just "8"
|
||||
getDigit '구' = Just "9"
|
||||
getDigit _ = Nothing
|
||||
v2 <- parseDouble . Text.concat . mapMaybe getDigit $ Text.unpack match
|
||||
double $ v1 + decimalsToDouble v2
|
||||
|
@ -27,7 +27,7 @@ ruleInteger5 = Rule
|
||||
{ name = "integer (11..99) "
|
||||
, pattern =
|
||||
[ numberBetween 1 10
|
||||
, regex "\x1006\x101a\x103a\x1037"
|
||||
, regex "ဆယ့်"
|
||||
, numberBetween 1 10
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -42,20 +42,20 @@ ruleIntegerNumeric :: Rule
|
||||
ruleIntegerNumeric = Rule
|
||||
{ name = "integer (0..9) - numeric"
|
||||
, pattern =
|
||||
[ regex "(\x1040|\x1041|\x1042|\x1043|\x1044|\x1045|\x1046|\x1047|\x1048|\x1049)"
|
||||
[ regex "(၀|၁|၂|၃|၄|၅|၆|၇|၈|၉)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x1040" -> integer 0
|
||||
"\x1041" -> integer 1
|
||||
"\x1042" -> integer 2
|
||||
"\x1043" -> integer 3
|
||||
"\x1044" -> integer 4
|
||||
"\x1045" -> integer 5
|
||||
"\x1046" -> integer 6
|
||||
"\x1047" -> integer 7
|
||||
"\x1048" -> integer 8
|
||||
"\x1049" -> integer 9
|
||||
"၀" -> integer 0
|
||||
"၁" -> integer 1
|
||||
"၂" -> integer 2
|
||||
"၃" -> integer 3
|
||||
"၄" -> integer 4
|
||||
"၅" -> integer 5
|
||||
"၆" -> integer 6
|
||||
"၇" -> integer 7
|
||||
"၈" -> integer 8
|
||||
"၉" -> integer 9
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -64,7 +64,7 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer (11..19) "
|
||||
, pattern =
|
||||
[ regex "\x1006\x101a\x103a\x1037"
|
||||
[ regex "ဆယ့်"
|
||||
, numberBetween 1 10
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -76,13 +76,13 @@ ruleIntegerPali :: Rule
|
||||
ruleIntegerPali = Rule
|
||||
{ name = "integer (1..3) - pali"
|
||||
, pattern =
|
||||
[ regex "(\x1015\x1011\x1019|\x1012\x102f\x1010\x102d\x101a|\x1010\x1010\x102d\x101a)"
|
||||
[ regex "(ပထမ|ဒုတိယ|တတိယ)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x1015\x1011\x1019" -> integer 1
|
||||
"\x1012\x102f\x1010\x102d\x101a" -> integer 2
|
||||
"\x1010\x1010\x102d\x101a" -> integer 3
|
||||
"ပထမ" -> integer 1
|
||||
"ဒုတိယ" -> integer 2
|
||||
"တတိယ" -> integer 3
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -92,7 +92,7 @@ ruleInteger6 = Rule
|
||||
{ name = "integer (100..900)"
|
||||
, pattern =
|
||||
[ numberBetween 1 10
|
||||
, regex "\x101b\x102c"
|
||||
, regex "ရာ"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 100
|
||||
@ -104,7 +104,7 @@ ruleInteger7 = Rule
|
||||
{ name = "integer (1000..9000)"
|
||||
, pattern =
|
||||
[ numberBetween 1 10
|
||||
, regex "\x1011\x1031\x102c\x1004\x103a"
|
||||
, regex "ထောင်"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 1000
|
||||
@ -116,7 +116,7 @@ ruleInteger8 = Rule
|
||||
{ name = "integer (10000..90000)"
|
||||
, pattern =
|
||||
[ numberBetween 1 10
|
||||
, regex "\x101e\x1031\x102c\x1004\x103a\x1038"
|
||||
, regex "သောင်း"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10000
|
||||
@ -127,7 +127,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer 0"
|
||||
, pattern =
|
||||
[ regex "\x101e\x102f\x1036\x100a|\x1019\x101b\x103e\x102d"
|
||||
[ regex "သုံည|မရှိ"
|
||||
]
|
||||
, prod = \_ -> integer 0
|
||||
}
|
||||
@ -137,7 +137,7 @@ ruleInteger4 = Rule
|
||||
{ name = "integer (10..90)"
|
||||
, pattern =
|
||||
[ numberBetween 1 10
|
||||
, regex "\x1006\x101a\x103a"
|
||||
, regex "ဆယ်"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10
|
||||
@ -148,20 +148,20 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (1..10)"
|
||||
, pattern =
|
||||
[ regex "(\x1010\x1005\x103a|\x1014\x103e\x1005\x103a|\x101e\x102f\x1036\x1038|\x101c\x1031\x1038|\x1004\x102b\x1038|\x1001\x103c\x1031\x102b\x1000\x103a|\x1001\x102f\x1014\x103e\x1005\x103a|\x101b\x103e\x1005\x103a|\x1000\x102d\x102f\x1038|\x1010\x1005\x103a\x1006\x101a\x103a)"
|
||||
[ regex "(တစ်|နှစ်|သုံး|လေး|ငါး|ခြေါက်|ခုနှစ်|ရှစ်|ကိုး|တစ်ဆယ်)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x1010\x1005\x103a" -> integer 1
|
||||
"\x1014\x103e\x1005\x103a" -> integer 2
|
||||
"\x101e\x102f\x1036\x1038" -> integer 3
|
||||
"\x101c\x1031\x1038" -> integer 4
|
||||
"\x1004\x102b\x1038" -> integer 5
|
||||
"\x1001\x103c\x1031\x102b\x1000\x103a" -> integer 6
|
||||
"\x1001\x102f\x1014\x103e\x1005\x103a" -> integer 7
|
||||
"\x101b\x103e\x1005\x103a" -> integer 8
|
||||
"\x1000\x102d\x102f\x1038" -> integer 9
|
||||
"\x1010\x1005\x103a\x1006\x101a\x103a" -> integer 10
|
||||
"တစ်" -> integer 1
|
||||
"နှစ်" -> integer 2
|
||||
"သုံး" -> integer 3
|
||||
"လေး" -> integer 4
|
||||
"ငါး" -> integer 5
|
||||
"ခြေါက်" -> integer 6
|
||||
"ခုနှစ်" -> integer 7
|
||||
"ရှစ်" -> integer 8
|
||||
"ကိုး" -> integer 9
|
||||
"တစ်ဆယ်" -> integer 10
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ ruleFew :: Rule
|
||||
ruleFew = Rule
|
||||
{ name = "few"
|
||||
, pattern =
|
||||
[ regex "(noen )?f\x00e5"
|
||||
[ regex "(noen )?få"
|
||||
]
|
||||
, prod = \_ -> integer 3
|
||||
}
|
||||
@ -158,7 +158,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -214,7 +214,7 @@ zeroToNineteenMap = HashMap.fromList
|
||||
, ( "intet" , 0 )
|
||||
, ( "en" , 1 )
|
||||
, ( "ett" , 1 )
|
||||
, ( "\x00e9n" , 1 )
|
||||
, ( "én" , 1 )
|
||||
, ( "to" , 2 )
|
||||
, ( "tre" , 3 )
|
||||
, ( "fire" , 4 )
|
||||
@ -231,7 +231,7 @@ zeroToNineteenMap = HashMap.fromList
|
||||
, ( "fjorten" , 14 )
|
||||
, ( "femten" , 15 )
|
||||
, ( "seksten" , 16 )
|
||||
, ( "s\x00f8tten" , 17 )
|
||||
, ( "søtten" , 17 )
|
||||
, ( "sytten" , 17 )
|
||||
, ( "atten" , 18 )
|
||||
, ( "nitten" , 19 )
|
||||
@ -241,7 +241,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(intet|ingen|null|en|ett|\x00e9n|to|tretten|tre|fire|femten|fem|seksten|seks|syv|sju|\x00e5tte|nitten|ni|ti|elleve|tolv|fjorten|sytten|s\x00f8tten|atten)"
|
||||
[ regex "(intet|ingen|null|en|ett|én|to|tretten|tre|fire|femten|fem|seksten|seks|syv|sju|åtte|nitten|ni|ti|elleve|tolv|fjorten|sytten|søtten|atten)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -255,12 +255,12 @@ dozensMap = HashMap.fromList
|
||||
, ( "tjue" , 20 )
|
||||
, ( "tredve" , 30 )
|
||||
, ( "tretti" , 30 )
|
||||
, ( "f\x00f8rti" , 40 )
|
||||
, ( "førti" , 40 )
|
||||
, ( "femti" , 50 )
|
||||
, ( "seksti" , 60 )
|
||||
, ( "sytti" , 70 )
|
||||
, ( "s\x00f8tti" , 70 )
|
||||
, ( "\x00e5tti" , 80 )
|
||||
, ( "søtti" , 70 )
|
||||
, ( "åtti" , 80 )
|
||||
, ( "nitti" , 90 )
|
||||
]
|
||||
|
||||
@ -268,7 +268,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(tyve|tjue|tredve|tretti|f\x00f8rti|femti|seksti|sytti|s\x00f8tti|\x00e5tti|nitti)"
|
||||
[ regex "(tyve|tjue|tredve|tretti|førti|femti|seksti|sytti|søtti|åtti|nitti)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -102,7 +102,7 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer ([2-9][1-9])"
|
||||
, pattern =
|
||||
[ regex "(een|twee|drie|vier|vijf|zes|zeven|acht|negen)(?:e|\x00eb)n(twintig|dertig|veertig|vijftig|zestig|zeventig|tachtig|negentig)"
|
||||
[ regex "(een|twee|drie|vier|vijf|zes|zeven|acht|negen)(?:e|ë)n(twintig|dertig|veertig|vijftig|zestig|zeventig|tachtig|negentig)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (m1:m2:_)):_) -> do
|
||||
@ -143,7 +143,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -210,7 +210,7 @@ zeroNineteenMap = HashMap.fromList
|
||||
[ ("niks", 0)
|
||||
, ("nul", 0)
|
||||
, ("geen", 0)
|
||||
, ("\x00e9\x00e9n", 1)
|
||||
, ("één", 1)
|
||||
, ("een", 1)
|
||||
, ("twee", 2)
|
||||
, ("drie", 3)
|
||||
@ -236,7 +236,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(geen|nul|niks|een|\x00e9\x00e9n|twee|drie|vier|vijftien|vijf|zestien|zes|zeventien|zeven|achtien|acht|negentien|negen|tien|elf|twaalf|dertien|veertien)"
|
||||
[ regex "(geen|nul|niks|een|één|twee|drie|vier|vijftien|vijf|zestien|zes|zeventien|zeven|achtien|acht|negentien|negen|tien|elf|twaalf|dertien|veertien)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -28,7 +28,7 @@ ruleSixteen :: Rule
|
||||
ruleSixteen = Rule
|
||||
{ name = "sixteen"
|
||||
, pattern =
|
||||
[ regex "szesna(s|\x015b)(tu|cie|toma)"
|
||||
[ regex "szesna(s|ś)(tu|cie|toma)"
|
||||
]
|
||||
, prod = \_ -> integer 16
|
||||
}
|
||||
@ -37,7 +37,7 @@ ruleFourteen :: Rule
|
||||
ruleFourteen = Rule
|
||||
{ name = "fourteen"
|
||||
, pattern =
|
||||
[ regex "czterna(s|\x015b)(tu|cie|toma)"
|
||||
[ regex "czterna(s|ś)(tu|cie|toma)"
|
||||
]
|
||||
, prod = \_ -> integer 14
|
||||
}
|
||||
@ -46,7 +46,7 @@ ruleTwo :: Rule
|
||||
ruleTwo = Rule
|
||||
{ name = "two"
|
||||
, pattern =
|
||||
[ regex "dw(a|(o|\x00f3)(ch|m)|oma|iema|ie)"
|
||||
[ regex "dw(a|(o|ó)(ch|m)|oma|iema|ie)"
|
||||
]
|
||||
, prod = \_ -> integer 2
|
||||
}
|
||||
@ -55,7 +55,7 @@ ruleSixty :: Rule
|
||||
ruleSixty = Rule
|
||||
{ name = "sixty"
|
||||
, pattern =
|
||||
[ regex "sze(\x015b\x0107)dziesi(\x0105)t|sze(\x015b\x0107)dziesi(\x0119)ci(u|oma)"
|
||||
[ regex "sze(ść)dziesi(ą)t|sze(ść)dziesi(ę)ci(u|oma)"
|
||||
]
|
||||
, prod = \_ -> integer 60
|
||||
}
|
||||
@ -92,7 +92,7 @@ ruleOne :: Rule
|
||||
ruleOne = Rule
|
||||
{ name = "one"
|
||||
, pattern =
|
||||
[ regex "jed(en|nego|nemu|nym|nej|n(a|\x0105))"
|
||||
[ regex "jed(en|nego|nemu|nym|nej|n(a|ą))"
|
||||
]
|
||||
, prod = \_ -> integer 1
|
||||
}
|
||||
@ -114,7 +114,7 @@ ruleTen :: Rule
|
||||
ruleTen = Rule
|
||||
{ name = "ten"
|
||||
, pattern =
|
||||
[ regex "dzisi(e|\x0119)(\x0107|c)(iu|ioma)?"
|
||||
[ regex "dzisi(e|ę)(ć|c)(iu|ioma)?"
|
||||
]
|
||||
, prod = \_ -> integer 10
|
||||
}
|
||||
@ -149,7 +149,7 @@ ruleNine :: Rule
|
||||
ruleNine = Rule
|
||||
{ name = "nine"
|
||||
, pattern =
|
||||
[ regex "dziewi(e|\x0119)(\x0107|c)(iu|ioma)?"
|
||||
[ regex "dziewi(e|ę)(ć|c)(iu|ioma)?"
|
||||
]
|
||||
, prod = \_ -> integer 9
|
||||
}
|
||||
@ -167,7 +167,7 @@ ruleTwelve :: Rule
|
||||
ruleTwelve = Rule
|
||||
{ name = "twelve"
|
||||
, pattern =
|
||||
[ regex "dwunast(u|oma)|dwana(\x015b|s)cie"
|
||||
[ regex "dwunast(u|oma)|dwana(ś|s)cie"
|
||||
]
|
||||
, prod = \_ -> integer 12
|
||||
}
|
||||
@ -187,7 +187,7 @@ ruleFifteen :: Rule
|
||||
ruleFifteen = Rule
|
||||
{ name = "fifteen"
|
||||
, pattern =
|
||||
[ regex "pi(\x0119)tna(s|\x015b)(ta|tu|cie|toma)"
|
||||
[ regex "pi(ę)tna(s|ś)(ta|tu|cie|toma)"
|
||||
]
|
||||
, prod = \_ -> integer 15
|
||||
}
|
||||
@ -196,7 +196,7 @@ ruleEleven :: Rule
|
||||
ruleEleven = Rule
|
||||
{ name = "eleven"
|
||||
, pattern =
|
||||
[ regex "jedena(stu|(s|\x015b)cie|stoma)"
|
||||
[ regex "jedena(stu|(s|ś)cie|stoma)"
|
||||
]
|
||||
, prod = \_ -> integer 11
|
||||
}
|
||||
@ -205,7 +205,7 @@ ruleThirteen :: Rule
|
||||
ruleThirteen = Rule
|
||||
{ name = "thirteen"
|
||||
, pattern =
|
||||
[ regex "trzyna(\x015b|s)(tu|cie|toma)"
|
||||
[ regex "trzyna(ś|s)(tu|cie|toma)"
|
||||
]
|
||||
, prod = \_ -> integer 13
|
||||
}
|
||||
@ -214,7 +214,7 @@ ruleThirty :: Rule
|
||||
ruleThirty = Rule
|
||||
{ name = "thirty"
|
||||
, pattern =
|
||||
[ regex "trzydzie(\x015b)ci|trzydziest(u|oma)"
|
||||
[ regex "trzydzie(ś)ci|trzydziest(u|oma)"
|
||||
]
|
||||
, prod = \_ -> integer 30
|
||||
}
|
||||
@ -223,7 +223,7 @@ ruleNumeral2 :: Rule
|
||||
ruleNumeral2 = Rule
|
||||
{ name = "number 200"
|
||||
, pattern =
|
||||
[ regex "dwie((\x015b)cie| setki)"
|
||||
[ regex "dwie((ś)cie| setki)"
|
||||
]
|
||||
, prod = \_ -> integer 200 >>= withGrain 2
|
||||
}
|
||||
@ -232,7 +232,7 @@ ruleSeventeen :: Rule
|
||||
ruleSeventeen = Rule
|
||||
{ name = "seventeen"
|
||||
, pattern =
|
||||
[ regex "siedemna(s|\x015b)(tu|cie|toma)"
|
||||
[ regex "siedemna(s|ś)(tu|cie|toma)"
|
||||
]
|
||||
, prod = \_ -> integer 17
|
||||
}
|
||||
@ -250,7 +250,7 @@ ruleNumeral9 :: Rule
|
||||
ruleNumeral9 = Rule
|
||||
{ name = "number 900"
|
||||
, pattern =
|
||||
[ regex "dziewi(\x0119\x0107)(set| setek)"
|
||||
[ regex "dziewi(ęć)(set| setek)"
|
||||
]
|
||||
, prod = \_ -> integer 900 >>= withGrain 2
|
||||
}
|
||||
@ -268,7 +268,7 @@ ruleTwenty :: Rule
|
||||
ruleTwenty = Rule
|
||||
{ name = "twenty"
|
||||
, pattern =
|
||||
[ regex "dwadzie(\x015b|s)cia|dwudziest(u|oma)"
|
||||
[ regex "dwadzie(ś|s)cia|dwudziest(u|oma)"
|
||||
]
|
||||
, prod = \_ -> integer 20
|
||||
}
|
||||
@ -286,7 +286,7 @@ ruleEight :: Rule
|
||||
ruleEight = Rule
|
||||
{ name = "eight"
|
||||
, pattern =
|
||||
[ regex "o(s|\x015b)(iem|miu|mioma)"
|
||||
[ regex "o(s|ś)(iem|miu|mioma)"
|
||||
]
|
||||
, prod = \_ -> integer 8
|
||||
}
|
||||
@ -295,7 +295,7 @@ ruleNumeral5 :: Rule
|
||||
ruleNumeral5 = Rule
|
||||
{ name = "number 500"
|
||||
, pattern =
|
||||
[ regex "pi(\x0119\x0107)(set| setek)"
|
||||
[ regex "pi(ęć)(set| setek)"
|
||||
]
|
||||
, prod = \_ -> integer 500 >>= withGrain 2
|
||||
}
|
||||
@ -322,7 +322,7 @@ ruleThousand :: Rule
|
||||
ruleThousand = Rule
|
||||
{ name = "thousand"
|
||||
, pattern =
|
||||
[ regex "ty(s|\x015b)i(a|\x0105|\x0119)c(e|y)?"
|
||||
[ regex "ty(s|ś)i(a|ą|ę)c(e|y)?"
|
||||
]
|
||||
, prod = \_ -> integer 1000 >>= withGrain 3 >>= withMultipliable
|
||||
}
|
||||
@ -331,7 +331,7 @@ ruleMillion :: Rule
|
||||
ruleMillion = Rule
|
||||
{ name = "million"
|
||||
, pattern =
|
||||
[ regex "milion(y|(\x00f3)w)?"
|
||||
[ regex "milion(y|(ó)w)?"
|
||||
]
|
||||
, prod = \_ -> integer 1000000 >>= withGrain 6 >>= withMultipliable
|
||||
}
|
||||
@ -385,7 +385,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -429,7 +429,7 @@ ruleSix :: Rule
|
||||
ruleSix = Rule
|
||||
{ name = "six"
|
||||
, pattern =
|
||||
[ regex "sze(s|\x015b)(c|\x0107)(iu|oma|u)?"
|
||||
[ regex "sze(s|ś)(c|ć)(iu|oma|u)?"
|
||||
]
|
||||
, prod = \_ -> integer 6
|
||||
}
|
||||
@ -438,7 +438,7 @@ ruleNumeral6 :: Rule
|
||||
ruleNumeral6 = Rule
|
||||
{ name = "number 600"
|
||||
, pattern =
|
||||
[ regex "(sze\x015b\x0107(set| setek))"
|
||||
[ regex "(sześć(set| setek))"
|
||||
]
|
||||
, prod = \_ -> integer 600 >>= withGrain 2
|
||||
}
|
||||
@ -456,7 +456,7 @@ ruleFive :: Rule
|
||||
ruleFive = Rule
|
||||
{ name = "five"
|
||||
, pattern =
|
||||
[ regex "pi(e|\x0119)(c|\x0107)(iu|oma|u)?"
|
||||
[ regex "pi(e|ę)(c|ć)(iu|oma|u)?"
|
||||
]
|
||||
, prod = \_ -> integer 5
|
||||
}
|
||||
@ -465,7 +465,7 @@ ruleFourty :: Rule
|
||||
ruleFourty = Rule
|
||||
{ name = "fou?rty"
|
||||
, pattern =
|
||||
[ regex "czterdzie(\x015b)ci|czterdziest(u|oma)"
|
||||
[ regex "czterdzie(ś)ci|czterdziest(u|oma)"
|
||||
]
|
||||
, prod = \_ -> integer 40
|
||||
}
|
||||
@ -492,7 +492,7 @@ ruleNineteen :: Rule
|
||||
ruleNineteen = Rule
|
||||
{ name = "nineteen"
|
||||
, pattern =
|
||||
[ regex "dziewietna(s|\x015b)(tu|cie|toma)"
|
||||
[ regex "dziewietna(s|ś)(tu|cie|toma)"
|
||||
]
|
||||
, prod = \_ -> integer 19
|
||||
}
|
||||
@ -515,7 +515,7 @@ ruleEighteen :: Rule
|
||||
ruleEighteen = Rule
|
||||
{ name = "eighteen"
|
||||
, pattern =
|
||||
[ regex "osiemna(s|\x015b)(tu|cie|toma)"
|
||||
[ regex "osiemna(s|ś)(tu|cie|toma)"
|
||||
]
|
||||
, prod = \_ -> integer 18
|
||||
}
|
||||
@ -550,7 +550,7 @@ ruleFifty :: Rule
|
||||
ruleFifty = Rule
|
||||
{ name = "fifty"
|
||||
, pattern =
|
||||
[ regex "pi(\x0119\x0107)dziesi(\x0105)t|pi(\x0119\x0107)dziesi(\x0119)ci(u|oma)"
|
||||
[ regex "pi(ęć)dziesi(ą)t|pi(ęć)dziesi(ę)ci(u|oma)"
|
||||
]
|
||||
, prod = \_ -> integer 50
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ ruleNumeral2 :: Rule
|
||||
ruleNumeral2 = Rule
|
||||
{ name = "number (20..90)"
|
||||
, pattern =
|
||||
[ regex "(vinte|trinta|quarenta|cincoenta|cinq(\x00fc)enta|cinquenta|sessenta|setenta|oitenta|noventa)"
|
||||
[ regex "(vinte|trinta|quarenta|cincoenta|cinq(ü)enta|cinquenta|sessenta|setenta|oitenta|noventa)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -102,7 +102,7 @@ ruleNumeral :: Rule
|
||||
ruleNumeral = Rule
|
||||
{ name = "number (0..15)"
|
||||
, pattern =
|
||||
[ regex "(zero|uma?|d(oi|ua)s|tr(\x00ea|e)s|quatro|cinco|seis|sete|oito|nove|dez|onze|doze|treze|(ca|qua)torze|quinze)"
|
||||
[ regex "(zero|uma?|d(oi|ua)s|tr(ê|e)s|quatro|cinco|seis|sete|oito|nove|dez|onze|doze|treze|(ca|qua)torze|quinze)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -111,7 +111,7 @@ ruleNumeral = Rule
|
||||
"um" -> integer 1
|
||||
"dois" -> integer 2
|
||||
"duas" -> integer 2
|
||||
"tr\x00eas" -> integer 3
|
||||
"três" -> integer 3
|
||||
"tres" -> integer 3
|
||||
"quatro" -> integer 4
|
||||
"cinco" -> integer 5
|
||||
@ -167,7 +167,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -224,7 +224,7 @@ ruleDozen :: Rule
|
||||
ruleDozen = Rule
|
||||
{ name = "dozen"
|
||||
, pattern =
|
||||
[ regex "d(\x00fa|u)zias?"
|
||||
[ regex "d(ú|u)zias?"
|
||||
]
|
||||
, prod = \_ -> integer 12 >>= withGrain 1 >>= withMultipliable
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ ruleIntersectCuI = Rule
|
||||
{ name = "intersect (cu și)"
|
||||
, pattern =
|
||||
[ numberWith (fromMaybe 0 . TNumeral.grain) (>1)
|
||||
, regex "(s|\x0219)i"
|
||||
, regex "(s|ș)i"
|
||||
, numberWith TNumeral.multipliable not
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -166,13 +166,13 @@ rulePowersOfTen :: Rule
|
||||
rulePowersOfTen = Rule
|
||||
{ name = "powers of tens"
|
||||
, pattern =
|
||||
[ regex "(sut(a|e|\x0103)?|milio(n|ane)?|miliar(de?)?|mi[ei]?)"
|
||||
[ regex "(sut(a|e|ă)?|milio(n|ane)?|miliar(de?)?|mi[ei]?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"suta" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"sute" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"sut\x0103" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"sută" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"mi" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"mie" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"mii" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
@ -200,13 +200,13 @@ zeroTenMap = HashMap.fromList
|
||||
, ("unu", 1)
|
||||
, ("unul", 1)
|
||||
, ("intai", 1)
|
||||
, ("\x00eentai", 1)
|
||||
, ("int\x00e2i", 1)
|
||||
, ("\x00eent\x00e2i", 1)
|
||||
, ("întai", 1)
|
||||
, ("intâi", 1)
|
||||
, ("întâi", 1)
|
||||
, ("o", 1)
|
||||
, ("doi", 2)
|
||||
, ("doua", 2)
|
||||
, ("dou\x0103", 2)
|
||||
, ("două", 2)
|
||||
, ("trei", 3)
|
||||
, ("patru", 4)
|
||||
, ("cinci", 5)
|
||||
@ -216,7 +216,7 @@ zeroTenMap = HashMap.fromList
|
||||
, ("\537apte", 7)
|
||||
, ("opt", 8)
|
||||
, ("noua", 9)
|
||||
, ("nou\x0103", 9)
|
||||
, ("nouă", 9)
|
||||
, ("zece", 10)
|
||||
, ("zeci", 10)
|
||||
]
|
||||
@ -225,7 +225,7 @@ ruleIntegerZeroTen :: Rule
|
||||
ruleIntegerZeroTen = Rule
|
||||
{ name = "integer (0..10)"
|
||||
, pattern =
|
||||
[ regex "(zero|nimic|nici(\\s?o|\\sun(a|ul?))|una|unul?|doi|dou(a|\x0103)|trei|patru|cinci|(s|\x0219)ase|(s|\x0219)apte|opt|nou(a|\x0103)|zec[ei]|(i|\x00ee)nt(a|\x00e2)i|un|o)"
|
||||
[ regex "(zero|nimic|nici(\\s?o|\\sun(a|ul?))|una|unul?|doi|dou(a|ă)|trei|patru|cinci|(s|ș)ase|(s|ș)apte|opt|nou(a|ă)|zec[ei]|(i|î)nt(a|â)i|un|o)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -250,14 +250,14 @@ elevenNineteenMap = HashMap.fromList
|
||||
, ("opti", 18)
|
||||
, ("opt", 18)
|
||||
, ("noua", 19)
|
||||
, ("nou\x0103", 19)
|
||||
, ("nouă", 19)
|
||||
]
|
||||
|
||||
ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (11..19)"
|
||||
, pattern =
|
||||
[ regex "(cin|sapti|opti)(s|\x0219)pe|(cinci|(s|\x0219)apte|opt)sprezece|(un|doi|trei|pai|(s|\x0219)ai|nou(a|\x0103))((s|\x0219)pe|sprezece)"
|
||||
[ regex "(cin|sapti|opti)(s|ș)pe|(cinci|(s|ș)apte|opt)sprezece|(un|doi|trei|pai|(s|ș)ai|nou(a|ă))((s|ș)pe|sprezece)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (e1:_:e2:_:r:_)):_) -> do
|
||||
@ -274,7 +274,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(dou(a|\x0103)|trei|patru|cinci|(s|\x0219)ai|(s|\x0219)apte|opt|nou(a|\x0103))\\s?zeci"
|
||||
[ regex "(dou(a|ă)|trei|patru|cinci|(s|ș)ai|(s|ș)apte|opt|nou(a|ă))\\s?zeci"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> do
|
||||
|
@ -29,21 +29,21 @@ import Duckling.Types
|
||||
|
||||
dozensMap :: HashMap Text Integer
|
||||
dozensMap = HashMap.fromList
|
||||
[ ( "\x0434\x0432\x0430\x0434\x0446\x0430\x0442\x044c", 20)
|
||||
, ( "\x0442\x0440\x0438\x0434\x0446\x0430\x0442\x044c", 30)
|
||||
, ( "\x0441\x043e\x0440\x043e\x043a", 40)
|
||||
, ( "\x043f\x044f\x0442\x044c\x0434\x0435\x0441\x044f\x0442", 50)
|
||||
, ( "\x0448\x0435\x0441\x0442\x044c\x0434\x0435\x0441\x044f\x0442", 60)
|
||||
, ( "\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442", 70)
|
||||
, ( "\x0432\x043e\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442", 80)
|
||||
, ( "\x0434\x0435\x0432\x044f\x043d\x043e\x0441\x0442\x043e", 90)
|
||||
[ ( "двадцать", 20)
|
||||
, ( "тридцать", 30)
|
||||
, ( "сорок", 40)
|
||||
, ( "пятьдесят", 50)
|
||||
, ( "шестьдесят", 60)
|
||||
, ( "семьдесят", 70)
|
||||
, ( "восемьдесят", 80)
|
||||
, ( "девяносто", 90)
|
||||
]
|
||||
|
||||
ruleInteger5 :: Rule
|
||||
ruleInteger5 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(\x0434\x0432\x0430\x0434\x0446\x0430\x0442\x044c|\x0442\x0440\x0438\x0434\x0446\x0430\x0442\x044c|\x0441\x043e\x0440\x043e\x043a|\x043f\x044f\x0442\x044c\x0434\x0435\x0441\x044f\x0442|\x0448\x0435\x0441\x0442\x044c\x0434\x0435\x0441\x044f\x0442|\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442|\x0432\x043e\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442|\x0434\x0435\x0432\x044f\x043d\x043e\x0441\x0442\x043e)"
|
||||
[ regex "(двадцать|тридцать|сорок|пятьдесят|шестьдесят|семьдесят|восемьдесят|девяносто)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -91,29 +91,29 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer 2"
|
||||
, pattern =
|
||||
[ regex "(\x0434\x0432\x0430|\x0434\x0432\x0435|\x0434\x0432\x043e\x0435|\x043f\x0430\x0440\x0430|\x043f\x0430\x0440\x0443|\x043f\x0430\x0440\x043e\x0447\x043a\x0443|\x043f\x0430\x0440\x043e\x0447\x043a\x0430)"
|
||||
[ regex "(два|две|двое|пара|пару|парочку|парочка)"
|
||||
]
|
||||
, prod = \_ -> integer 2
|
||||
}
|
||||
|
||||
hundredsMap :: HashMap Text Integer
|
||||
hundredsMap = HashMap.fromList
|
||||
[ ( "\x0441\x0442\x043e", 100)
|
||||
, ( "\x0434\x0432\x0435\x0441\x0442\x0438", 200)
|
||||
, ( "\x0442\x0440\x0438\x0441\x0442\x043e", 300)
|
||||
, ( "\x0447\x0435\x0442\x044b\x0440\x0435\x0441\x0442\x043e", 400)
|
||||
, ( "\x043f\x044f\x0442\x044c\x0441\x043e\x0442", 500)
|
||||
, ( "\x0448\x0435\x0441\x0442\x044c\x0441\x043e\x0442", 600)
|
||||
, ( "\x0441\x0435\x043c\x044c\x0441\x043e\x0442", 700)
|
||||
, ( "\x0432\x043e\x0441\x0435\x043c\x044c\x0441\x043e\x0442", 800)
|
||||
, ( "\x0434\x0435\x0432\x044f\x0442\x044c\x0441\x043e\x0442", 900)
|
||||
[ ( "сто", 100)
|
||||
, ( "двести", 200)
|
||||
, ( "тристо", 300)
|
||||
, ( "четыресто", 400)
|
||||
, ( "пятьсот", 500)
|
||||
, ( "шестьсот", 600)
|
||||
, ( "семьсот", 700)
|
||||
, ( "восемьсот", 800)
|
||||
, ( "девятьсот", 900)
|
||||
]
|
||||
|
||||
ruleInteger6 :: Rule
|
||||
ruleInteger6 = Rule
|
||||
{ name = "integer (100..900)"
|
||||
, pattern =
|
||||
[ regex "(\x0441\x0442\x043e|\x0434\x0432\x0435\x0441\x0442\x0438|\x0442\x0440\x0438\x0441\x0442\x043e|\x0447\x0435\x0442\x044b\x0440\x0435\x0441\x0442\x043e|\x043f\x044f\x0442\x044c\x0441\x043e\x0442|\x0448\x0435\x0441\x0442\x044c\x0441\x043e\x0442|\x0441\x0435\x043c\x044c\x0441\x043e\x0442|\x0432\x043e\x0441\x0435\x043c\x044c\x0441\x043e\x0442|\x0434\x0435\x0432\x044f\x0442\x044c\x0441\x043e\x0442)"
|
||||
[ regex "(сто|двести|тристо|четыресто|пятьсот|шестьсот|семьсот|восемьсот|девятьсот)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -125,7 +125,7 @@ ruleNumeralsPrefixWithMinus :: Rule
|
||||
ruleNumeralsPrefixWithMinus = Rule
|
||||
{ name = "numbers prefix with -, minus"
|
||||
, pattern =
|
||||
[ regex "-|\x043c\x0438\x043d\x0443\x0441\\s?"
|
||||
[ regex "-|минус\\s?"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -138,18 +138,18 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "((\x043a|\x043c|\x0433)|(\x041a|\x041c|\x0413))(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "((к|м|г)|(К|М|Г))(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
Token RegexMatch (GroupMatch (match:_)):
|
||||
_) -> case Text.toLower match of
|
||||
"\x043a" -> double $ v * 1e3
|
||||
"\x041a" -> double $ v * 1e3
|
||||
"\x043c" -> double $ v * 1e6
|
||||
"\x041c" -> double $ v * 1e6
|
||||
"\x0433" -> double $ v * 1e9
|
||||
"\x0413" -> double $ v * 1e9
|
||||
"к" -> double $ v * 1e3
|
||||
"К" -> double $ v * 1e3
|
||||
"м" -> double $ v * 1e6
|
||||
"М" -> double $ v * 1e6
|
||||
"г" -> double $ v * 1e9
|
||||
"Г" -> double $ v * 1e9
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -186,37 +186,37 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer 0"
|
||||
, pattern =
|
||||
[ regex "(\x043d\x043e\x043b\x044c)"
|
||||
[ regex "(ноль)"
|
||||
]
|
||||
, prod = \_ -> integer 0
|
||||
}
|
||||
|
||||
threeToNineteenMap:: HashMap Text Integer
|
||||
threeToNineteenMap = HashMap.fromList
|
||||
[ ( "\x0442\x0440\x0438", 3)
|
||||
, ( "\x0447\x0435\x0442\x044b\x0440\x0435", 4)
|
||||
, ( "\x043f\x044f\x0442\x044c", 5)
|
||||
, ( "\x0448\x0435\x0441\x0442\x044c", 6)
|
||||
, ( "\x0441\x0435\x043c\x044c", 7)
|
||||
, ( "\x0432\x043e\x0441\x0435\x043c\x044c", 8)
|
||||
, ( "\x0434\x0435\x0432\x044f\x0442\x044c", 9)
|
||||
, ( "\x0434\x0435\x0441\x044f\x0442\x044c", 10)
|
||||
, ( "\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 11)
|
||||
, ( "\x0434\x0432\x0435\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 12)
|
||||
, ( "\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 13)
|
||||
, ( "\x0447\x0435\x0442\x044b\x0440\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 14)
|
||||
, ( "\x043f\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 15)
|
||||
, ( "\x0448\x0435\x0441\x0442\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 16)
|
||||
, ( "\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 17)
|
||||
, ( "\x0432\x043e\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 18)
|
||||
, ( "\x0434\x0435\x0432\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442\x044c", 19)
|
||||
[ ( "три", 3)
|
||||
, ( "четыре", 4)
|
||||
, ( "пять", 5)
|
||||
, ( "шесть", 6)
|
||||
, ( "семь", 7)
|
||||
, ( "восемь", 8)
|
||||
, ( "девять", 9)
|
||||
, ( "десять", 10)
|
||||
, ( "одинадцать", 11)
|
||||
, ( "двенадцать", 12)
|
||||
, ( "тринадцать", 13)
|
||||
, ( "четырнадцать", 14)
|
||||
, ( "пятнадцать", 15)
|
||||
, ( "шестнадцать", 16)
|
||||
, ( "семнадцать", 17)
|
||||
, ( "восемнадцать", 18)
|
||||
, ( "девятнадцать", 19)
|
||||
]
|
||||
|
||||
ruleInteger4 :: Rule
|
||||
ruleInteger4 = Rule
|
||||
{ name = "integer (3..19)"
|
||||
, pattern =
|
||||
[ regex "(\x0442\x0440\x0438|\x0447\x0435\x0442\x044b\x0440\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x0447\x0435\x0442\x044b\x0440\x0435|\x043f\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x043f\x044f\x0442\x044c|\x0448\x0435\x0441\x0442\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x0448\x0435\x0441\x0442\x044c|\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x0441\x0435\x043c\x044c|\x0432\x043e\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x0432\x043e\x0441\x0435\x043c\x044c|\x0434\x0435\x0432\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x0434\x0435\x0432\x044f\x0442\x044c|\x0434\x0435\x0441\x044f\x0442\x044c|\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x0434\x0432\x0435\x043d\x0430\x0434\x0446\x0430\x0442\x044c|\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x0430\x0442\x044c)"
|
||||
[ regex "(три|четырнадцать|четыре|пятнадцать|пять|шестнадцать|шесть|семнадцать|семь|восемнадцать|восемь|девятнадцать|девять|десять|одинадцать|двенадцать|тринадцать)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -228,7 +228,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer 1"
|
||||
, pattern =
|
||||
[ regex "(\x043e\x0434\x0438\x043d|\x043e\x0434\x043d\x0430|\x043e\x0434\x043d\x0443)"
|
||||
[ regex "(один|одна|одну)"
|
||||
]
|
||||
, prod = \_ -> integer 1
|
||||
}
|
||||
@ -238,7 +238,7 @@ ruleNumeralDotNumeral = Rule
|
||||
{ name = "number dot number"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\x0442\x043e\x0447\x043a\x0430"
|
||||
, regex "точка"
|
||||
, numberWith TNumeral.grain isNothing
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -75,7 +75,7 @@ ruleFew :: Rule
|
||||
ruleFew = Rule
|
||||
{ name = "few"
|
||||
, pattern =
|
||||
[ regex "(n\x00e5gra )?f\x00e5"
|
||||
[ regex "(några )?få"
|
||||
]
|
||||
, prod = \_ -> integer 3
|
||||
}
|
||||
@ -161,7 +161,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -217,13 +217,13 @@ zeroToNineteenMap = HashMap.fromList
|
||||
, ( "noll" , 0 )
|
||||
, ( "en" , 1 )
|
||||
, ( "ett" , 1 )
|
||||
, ( "tv\x00e5" , 2 )
|
||||
, ( "två" , 2 )
|
||||
, ( "tre" , 3 )
|
||||
, ( "fyra" , 4 )
|
||||
, ( "fem" , 5 )
|
||||
, ( "sex" , 6 )
|
||||
, ( "sju" , 7 )
|
||||
, ( "\x00e5tta", 8 )
|
||||
, ( "åtta", 8 )
|
||||
, ( "nio" , 9 )
|
||||
, ( "tio" , 10 )
|
||||
, ( "elva" , 11 )
|
||||
@ -241,7 +241,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(inget|ingen|noll|en|ett|tv\x00e5|tretton|tre|fyra|femton|fem|sexton|sex|sjutton|sju|\x00e5tta|nio|tio|elva|tolv|fjorton|arton|nitton)"
|
||||
[ regex "(inget|ingen|noll|en|ett|två|tretton|tre|fyra|femton|fem|sexton|sex|sjutton|sju|åtta|nio|tio|elva|tolv|fjorton|arton|nitton)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -257,7 +257,7 @@ dozenMap = HashMap.fromList
|
||||
, ( "femtio" , 50)
|
||||
, ( "sextio" , 60)
|
||||
, ( "sjuttio" , 70)
|
||||
, ( "\x00e5ttio" , 80)
|
||||
, ( "åttio" , 80)
|
||||
, ( "nittio" , 90)
|
||||
]
|
||||
|
||||
@ -265,7 +265,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(tjugo|trettio|fyrtio|femtio|sextio|sjuttio|\x00e5ttio|nittio)"
|
||||
[ regex "(tjugo|trettio|fyrtio|femtio|sextio|sjuttio|åttio|nittio)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -29,15 +29,15 @@ import Duckling.Types
|
||||
|
||||
hundredsMap :: HashMap Text Integer
|
||||
hundredsMap = HashMap.fromList
|
||||
[ ( "y\x00fcz", 100)
|
||||
, ( "ikiy\x00fcz", 200)
|
||||
, ( "\x00fc\x00e7y\x00fcz", 300)
|
||||
, ( "d\x00f6rty\x00fcz", 400)
|
||||
, ( "be\x015fy\x00fcz", 500)
|
||||
, ( "alt\x0131y\x00fcz", 600)
|
||||
, ( "yediy\x00fcz", 700)
|
||||
, ( "sekizy\x00fcz", 800)
|
||||
, ( "dokuzy\x00fcz", 900)
|
||||
[ ( "yüz", 100)
|
||||
, ( "ikiyüz", 200)
|
||||
, ( "üçyüz", 300)
|
||||
, ( "dörtyüz", 400)
|
||||
, ( "beşyüz", 500)
|
||||
, ( "altıyüz", 600)
|
||||
, ( "yediyüz", 700)
|
||||
, ( "sekizyüz", 800)
|
||||
, ( "dokuzyüz", 900)
|
||||
]
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ ruleInteger5 :: Rule
|
||||
ruleInteger5 = Rule
|
||||
{ name = "integer 100..900"
|
||||
, pattern =
|
||||
[ regex "(y\x00fcz|ikiy\x00fcz|\x00fc\x00e7y\x00fcz|d\x00f6rty\x00fcz|be\x015fy\x00fcz|alt\x0131y\x00fcz|yediy\x00fcz|sekizy\x00fcz|dokuzy\x00fcz)"
|
||||
[ regex "(yüz|ikiyüz|üçyüz|dörtyüz|beşyüz|altıyüz|yediyüz|sekizyüz|dokuzyüz)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -83,7 +83,7 @@ ruleACoupleOf :: Rule
|
||||
ruleACoupleOf = Rule
|
||||
{ name = "a couple (of)"
|
||||
, pattern =
|
||||
[ regex "(bir )?\x00e7ift"
|
||||
[ regex "(bir )?çift"
|
||||
]
|
||||
, prod = \_ -> integer 2 >>= withGrain 1
|
||||
}
|
||||
@ -151,23 +151,23 @@ ruleDecimalNumeral = Rule
|
||||
|
||||
numeralSuffixesHalfsuffixTextMap :: HashMap Text Double
|
||||
numeralSuffixesHalfsuffixTextMap = HashMap.fromList
|
||||
[ ( "birbu\x00e7uk", 1.5)
|
||||
, ( "bibu\x00e7uk", 1.5)
|
||||
, ( "ikibu\x00e7uk", 2.5)
|
||||
, ( "\x00fc\231bu\x00e7uk", 3.5)
|
||||
, ( "d\x00f6rtbu\x00e7uk", 4.5)
|
||||
, ( "be\351bu\x00e7uk", 5.5)
|
||||
, ( "alt\x0131bu\x00e7uk", 6.5)
|
||||
, ( "yedibu\x00e7uk", 7.5)
|
||||
, ( "sekizbu\x00e7uk", 8.5)
|
||||
, ( "dokuzbu\x00e7uk", 9.5)
|
||||
[ ( "birbuçuk", 1.5)
|
||||
, ( "bibuçuk", 1.5)
|
||||
, ( "ikibuçuk", 2.5)
|
||||
, ( "ü\231buçuk", 3.5)
|
||||
, ( "dörtbuçuk", 4.5)
|
||||
, ( "be\351buçuk", 5.5)
|
||||
, ( "altıbuçuk", 6.5)
|
||||
, ( "yedibuçuk", 7.5)
|
||||
, ( "sekizbuçuk", 8.5)
|
||||
, ( "dokuzbuçuk", 9.5)
|
||||
]
|
||||
|
||||
ruleNumeralSuffixesHalfsuffixText :: Rule
|
||||
ruleNumeralSuffixesHalfsuffixText = Rule
|
||||
{ name = "number suffixes (half-suffix text) (1..9)"
|
||||
, pattern =
|
||||
[ regex "((bir?|iki|\x00fc\x00e7|d\x00f6rt|be\x015f|alt\x0131|yedi|sekiz|dokuz)(bu\x00e7uk))"
|
||||
[ regex "((bir?|iki|üç|dört|beş|altı|yedi|sekiz|dokuz)(buçuk))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -180,98 +180,98 @@ tenToNintynineMap = HashMap.fromList
|
||||
[ ( "onbi", 11)
|
||||
, ( "onbir", 11)
|
||||
, ( "oniki", 12)
|
||||
, ( "on\x00fc\x00e7", 13)
|
||||
, ( "ond\x00f6rt", 14)
|
||||
, ( "onbe\x015f", 15)
|
||||
, ( "onalt\x0131", 16)
|
||||
, ( "onüç", 13)
|
||||
, ( "ondört", 14)
|
||||
, ( "onbeş", 15)
|
||||
, ( "onaltı", 16)
|
||||
, ( "onyedi", 17)
|
||||
, ( "onsekiz", 18)
|
||||
, ( "ondokuz", 19)
|
||||
, ( "yirmibi", 21)
|
||||
, ( "yirmibir", 21)
|
||||
, ( "yirmiiki", 22)
|
||||
, ( "yirmi\x00fc\x00e7", 23)
|
||||
, ( "yirmid\x00f6rt", 24)
|
||||
, ( "yirmibe\x015f", 25)
|
||||
, ( "yirmialt\x0131", 26)
|
||||
, ( "yirmiüç", 23)
|
||||
, ( "yirmidört", 24)
|
||||
, ( "yirmibeş", 25)
|
||||
, ( "yirmialtı", 26)
|
||||
, ( "yirmiyedi", 27)
|
||||
, ( "yirmisekiz", 28)
|
||||
, ( "yirmidokuz", 29)
|
||||
, ( "otuzbi", 31)
|
||||
, ( "otuzbir", 31)
|
||||
, ( "otuziki", 32)
|
||||
, ( "otuz\x00fc\x00e7", 33)
|
||||
, ( "otuzd\x00f6rt", 34)
|
||||
, ( "otuzbe\x015f", 35)
|
||||
, ( "otuzalt\x0131", 36)
|
||||
, ( "otuzüç", 33)
|
||||
, ( "otuzdört", 34)
|
||||
, ( "otuzbeş", 35)
|
||||
, ( "otuzaltı", 36)
|
||||
, ( "otuzyedi", 37)
|
||||
, ( "otuzsekiz", 38)
|
||||
, ( "otuzdokuz", 39)
|
||||
, ( "k\x0131rkbir", 41)
|
||||
, ( "k\x0131rkbi", 41)
|
||||
, ( "k\x0131rkiki", 42)
|
||||
, ( "k\x0131rk\x00fc\x00e7", 43)
|
||||
, ( "k\x0131rkd\x00f6rt", 44)
|
||||
, ( "k\x0131rkbe\x015f", 45)
|
||||
, ( "k\x0131rkalt\x0131", 46)
|
||||
, ( "k\x0131rkyedi", 47)
|
||||
, ( "k\x0131rksekiz", 48)
|
||||
, ( "k\x0131rkdokuz", 49)
|
||||
, ( "kırkbir", 41)
|
||||
, ( "kırkbi", 41)
|
||||
, ( "kırkiki", 42)
|
||||
, ( "kırküç", 43)
|
||||
, ( "kırkdört", 44)
|
||||
, ( "kırkbeş", 45)
|
||||
, ( "kırkaltı", 46)
|
||||
, ( "kırkyedi", 47)
|
||||
, ( "kırksekiz", 48)
|
||||
, ( "kırkdokuz", 49)
|
||||
, ( "ellibi", 51)
|
||||
, ( "ellibir", 51)
|
||||
, ( "elliiki", 52)
|
||||
, ( "elli\x00fc\x00e7", 53)
|
||||
, ( "ellid\x00f6rt", 54)
|
||||
, ( "ellibe\x015f", 55)
|
||||
, ( "ellialt\x0131", 56)
|
||||
, ( "elliüç", 53)
|
||||
, ( "ellidört", 54)
|
||||
, ( "ellibeş", 55)
|
||||
, ( "ellialtı", 56)
|
||||
, ( "elliyedi", 57)
|
||||
, ( "ellisekiz", 58)
|
||||
, ( "ellidokuz", 59)
|
||||
, ( "altm\x0131\x015fbir", 61)
|
||||
, ( "atm\x0131\x015fbir", 61)
|
||||
, ( "atm\x0131\x015fiki", 62)
|
||||
, ( "altm\x0131\x015fiki", 62)
|
||||
, ( "atm\x0131\x015f\x00fc\x00e7", 63)
|
||||
, ( "altm\x0131\x015f\x00fc\x00e7", 63)
|
||||
, ( "atm\x0131\x015fd\x00f6rt", 64)
|
||||
, ( "altm\x0131\x015fd\x00f6rt", 64)
|
||||
, ( "atm\x0131\x015fbe\x015f", 65)
|
||||
, ( "altm\x0131\x015fbe\x015f", 65)
|
||||
, ( "atm\x0131\x015falt\x0131", 66)
|
||||
, ( "altm\x0131\x015falt\x0131", 66)
|
||||
, ( "altm\x0131\x015fyedi", 67)
|
||||
, ( "atm\x0131\x015fyedi", 67)
|
||||
, ( "altm\x0131\x015fsekiz", 68)
|
||||
, ( "atm\x0131\x015fsekiz", 68)
|
||||
, ( "atm\x0131\x015fdokuz", 69)
|
||||
, ( "altm\x0131\x015fdokuz", 69)
|
||||
, ( "yetmi\x015fbir", 71)
|
||||
, ( "yetmi\x015fbi", 71)
|
||||
, ( "yetmi\x015fiki", 72)
|
||||
, ( "yetmi\x015f\x00fc\x00e7", 73)
|
||||
, ( "yetmi\x015fd\x00f6rt", 74)
|
||||
, ( "yetmi\x015fbe\x015f", 75)
|
||||
, ( "yetmi\x015falt\x0131", 76)
|
||||
, ( "yetmi\x015fyedi", 77)
|
||||
, ( "yetmi\x015fsekiz", 78)
|
||||
, ( "yetmi\x015fdokuz", 79)
|
||||
, ( "altmışbir", 61)
|
||||
, ( "atmışbir", 61)
|
||||
, ( "atmışiki", 62)
|
||||
, ( "altmışiki", 62)
|
||||
, ( "atmışüç", 63)
|
||||
, ( "altmışüç", 63)
|
||||
, ( "atmışdört", 64)
|
||||
, ( "altmışdört", 64)
|
||||
, ( "atmışbeş", 65)
|
||||
, ( "altmışbeş", 65)
|
||||
, ( "atmışaltı", 66)
|
||||
, ( "altmışaltı", 66)
|
||||
, ( "altmışyedi", 67)
|
||||
, ( "atmışyedi", 67)
|
||||
, ( "altmışsekiz", 68)
|
||||
, ( "atmışsekiz", 68)
|
||||
, ( "atmışdokuz", 69)
|
||||
, ( "altmışdokuz", 69)
|
||||
, ( "yetmişbir", 71)
|
||||
, ( "yetmişbi", 71)
|
||||
, ( "yetmişiki", 72)
|
||||
, ( "yetmişüç", 73)
|
||||
, ( "yetmişdört", 74)
|
||||
, ( "yetmişbeş", 75)
|
||||
, ( "yetmişaltı", 76)
|
||||
, ( "yetmişyedi", 77)
|
||||
, ( "yetmişsekiz", 78)
|
||||
, ( "yetmişdokuz", 79)
|
||||
, ( "seksenbir", 81)
|
||||
, ( "seksenbi", 81)
|
||||
, ( "sekseniki", 82)
|
||||
, ( "seksen\x00fc\x00e7", 83)
|
||||
, ( "seksend\x00f6rt", 84)
|
||||
, ( "seksenbe\x015f", 85)
|
||||
, ( "seksenalt\x0131", 86)
|
||||
, ( "seksenüç", 83)
|
||||
, ( "seksendört", 84)
|
||||
, ( "seksenbeş", 85)
|
||||
, ( "seksenaltı", 86)
|
||||
, ( "seksenyedi", 87)
|
||||
, ( "seksensekiz", 88)
|
||||
, ( "seksendokuz", 89)
|
||||
, ( "doksanbi", 91)
|
||||
, ( "doksanbir", 91)
|
||||
, ( "doksaniki", 92)
|
||||
, ( "doksan\x00fc\x00e7", 93)
|
||||
, ( "doksand\x00f6rt", 94)
|
||||
, ( "doksanbe\x015f", 95)
|
||||
, ( "doksanalt\x0131", 96)
|
||||
, ( "doksanüç", 93)
|
||||
, ( "doksandört", 94)
|
||||
, ( "doksanbeş", 95)
|
||||
, ( "doksanaltı", 96)
|
||||
, ( "doksanyedi", 97)
|
||||
, ( "doksansekiz", 98)
|
||||
, ( "doksandokuz", 99)
|
||||
@ -281,7 +281,7 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer 11..19 21..29 31..39 41..49 51..59 61..69 71..79 81..89 91..99"
|
||||
, pattern =
|
||||
[ regex "((on|yirmi|otuz|k\x0131rk|elli|atm\x0131\x015f|altm\x0131\x015f|yetmi\x015f|seksen|doksan)(bir|bi|iki|\x00fc\x00e7|d\x00f6rt|be\x015f|alt\x0131|yedi|sekiz|dokuz))"
|
||||
[ regex "((on|yirmi|otuz|kırk|elli|atmış|altmış|yetmiş|seksen|doksan)(bir|bi|iki|üç|dört|beş|altı|yedi|sekiz|dokuz))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -294,10 +294,10 @@ thousandsMap :: HashMap Text Integer
|
||||
thousandsMap = HashMap.fromList
|
||||
[ ( "bin", 1000)
|
||||
, ( "ikibin", 2000)
|
||||
, ( "\x00fc\x00e7bin", 3000)
|
||||
, ( "d\x00f6rtbin", 4000)
|
||||
, ( "be\x015fbin", 5000)
|
||||
, ( "alt\x0131bin", 6000)
|
||||
, ( "üçbin", 3000)
|
||||
, ( "dörtbin", 4000)
|
||||
, ( "beşbin", 5000)
|
||||
, ( "altıbin", 6000)
|
||||
, ( "yedibin", 7000)
|
||||
, ( "sekizbin", 8000)
|
||||
, ( "dokuzbin", 9000)
|
||||
@ -307,7 +307,7 @@ ruleInteger6 :: Rule
|
||||
ruleInteger6 = Rule
|
||||
{ name = "integer 1000..9000"
|
||||
, pattern =
|
||||
[ regex "(bin|ikibin|\x00fc\x00e7bin|d\x00f6rtbin|be\x015fbin|alt\x0131bin|yedibin|sekizbin|dokuzbin)"
|
||||
[ regex "(bin|ikibin|üçbin|dörtbin|beşbin|altıbin|yedibin|sekizbin|dokuzbin)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -334,7 +334,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmgb])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmgb])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -352,11 +352,11 @@ rulePowersOfTen :: Rule
|
||||
rulePowersOfTen = Rule
|
||||
{ name = "powers of tens"
|
||||
, pattern =
|
||||
[ regex "(y(\x00fc)z|bin|milyon)"
|
||||
[ regex "(y(ü)z|bin|milyon)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"y\x00fcz" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"yüz" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"bin" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"milyon" -> double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
_ -> Nothing
|
||||
@ -368,11 +368,11 @@ tenThousandsMap = HashMap.fromList
|
||||
[ ( "onbin", 10000)
|
||||
, ( "yirmibin", 20000)
|
||||
, ( "otuzbin", 30000)
|
||||
, ( "k\x0131rkbin", 40000)
|
||||
, ( "kırkbin", 40000)
|
||||
, ( "ellibin", 50000)
|
||||
, ( "altm\x0131\x015fbin", 60000)
|
||||
, ( "atm\x0131\x015fbin", 60000)
|
||||
, ( "yetmi\x015fbin", 70000)
|
||||
, ( "altmışbin", 60000)
|
||||
, ( "atmışbin", 60000)
|
||||
, ( "yetmişbin", 70000)
|
||||
, ( "seksenbin", 80000)
|
||||
, ( "doksanbin", 90000)
|
||||
]
|
||||
@ -381,7 +381,7 @@ ruleInteger7 :: Rule
|
||||
ruleInteger7 = Rule
|
||||
{ name = "integer 10000..90000"
|
||||
, pattern =
|
||||
[ regex "(onbin|yirmibin|otuzbin|k\x0131rkbin|ellibin|atm\x0131\x015fbin|altm\x0131\x015fbin|yetmi\x015fbin|seksenbin|doksanbin)"
|
||||
[ regex "(onbin|yirmibin|otuzbin|kırkbin|ellibin|atmışbin|altmışbin|yetmişbin|seksenbin|doksanbin)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -391,22 +391,22 @@ ruleInteger7 = Rule
|
||||
|
||||
hundredThousandsMap :: HashMap Text Integer
|
||||
hundredThousandsMap = HashMap.fromList
|
||||
[ ( "y\x00fczbin", 100000)
|
||||
, ( "ikiy\x00fczbin", 200000)
|
||||
, ( "\x00fc\x00e7y\x00fczbin", 300000)
|
||||
, ( "d\x00f6rty\x00fczbin", 400000)
|
||||
, ( "be\x015fy\x00fczbin", 500000)
|
||||
, ( "alt\x0131y\x00fczbin", 600000)
|
||||
, ( "yediy\x00fczbin", 700000)
|
||||
, ( "sekizy\x00fczbin", 800000)
|
||||
, ( "dokuzy\x00fczbin", 900000)
|
||||
[ ( "yüzbin", 100000)
|
||||
, ( "ikiyüzbin", 200000)
|
||||
, ( "üçyüzbin", 300000)
|
||||
, ( "dörtyüzbin", 400000)
|
||||
, ( "beşyüzbin", 500000)
|
||||
, ( "altıyüzbin", 600000)
|
||||
, ( "yediyüzbin", 700000)
|
||||
, ( "sekizyüzbin", 800000)
|
||||
, ( "dokuzyüzbin", 900000)
|
||||
]
|
||||
|
||||
ruleInteger8 :: Rule
|
||||
ruleInteger8 = Rule
|
||||
{ name = "integer 100000..900000"
|
||||
, pattern =
|
||||
[ regex "(y\x00fczbin|ikiy\x00fczbin|\x00fc\x00e7y\x00fczbin|d\x00f6rty\x00fczbin|be\x015fy\x00fczbin|alt\x0131y\x00fczbin|yediy\x00fczbin|sekizy\x00fczbin|dokuzy\x00fczbin)"
|
||||
[ regex "(yüzbin|ikiyüzbin|üçyüzbin|dörtyüzbin|beşyüzbin|altıyüzbin|yediyüzbin|sekizyüzbin|dokuzyüzbin)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -418,118 +418,118 @@ ruleHalf :: Rule
|
||||
ruleHalf = Rule
|
||||
{ name = "half"
|
||||
, pattern =
|
||||
[ regex "(yar\x0131m)"
|
||||
[ regex "(yarım)"
|
||||
]
|
||||
, prod = \_ -> double 0.5
|
||||
}
|
||||
|
||||
integer9Map :: HashMap Text Double
|
||||
integer9Map = HashMap.fromList
|
||||
[ ( "onbirbu\x00e7uk", 11.5)
|
||||
, ( "onbibu\x00e7uk", 11.5)
|
||||
, ( "onikibu\x00e7uk", 12.5)
|
||||
, ( "on\x00fc\x00e7bu\x00e7uk", 13.5)
|
||||
, ( "ond\x00f6rtbu\x00e7uk", 14.5)
|
||||
, ( "onbe\x015fbu\x00e7uk", 15.5)
|
||||
, ( "onalt\x0131bu\x00e7uk", 16.5)
|
||||
, ( "onyedibu\x00e7uk", 17.5)
|
||||
, ( "onsekizbu\x00e7uk", 18.5)
|
||||
, ( "ondokuzbu\x00e7uk", 19.5)
|
||||
, ( "yirmibibu\x00e7uk", 21.5)
|
||||
, ( "yirmibirbu\x00e7uk", 21.5)
|
||||
, ( "yirmiikibu\x00e7uk", 22.5)
|
||||
, ( "yirmi\x00fc\x00e7bu\x00e7uk", 23.5)
|
||||
, ( "yirmid\x00f6rtbu\x00e7uk", 24.5)
|
||||
, ( "yirmibe\x015fbu\x00e7uk", 25.5)
|
||||
, ( "yirmialt\x0131bu\x00e7uk", 26.5)
|
||||
, ( "yirmiyedibu\x00e7uk", 27.5)
|
||||
, ( "yirmisekizbu\x00e7uk", 28.5)
|
||||
, ( "yirmidokuzbu\x00e7uk", 29.5)
|
||||
, ( "otuzbibu\x00e7uk", 31.5)
|
||||
, ( "otuzbirbu\x00e7uk", 31.5)
|
||||
, ( "otuzikibu\x00e7uk", 32.5)
|
||||
, ( "otuz\x00fc\x00e7bu\x00e7uk", 33.5)
|
||||
, ( "otuzd\x00f6rtbu\x00e7uk", 34.5)
|
||||
, ( "otuzbe\x015fbu\x00e7uk", 35.5)
|
||||
, ( "otuzalt\x0131bu\x00e7uk", 36.5)
|
||||
, ( "otuzyedibu\x00e7uk", 37.5)
|
||||
, ( "otuzsekizbu\x00e7uk", 38.5)
|
||||
, ( "otuzdokuzbu\x00e7uk", 39.5)
|
||||
, ( "k\x0131rkbirbu\x00e7uk", 41.5)
|
||||
, ( "k\x0131rkbibu\x00e7uk", 41.5)
|
||||
, ( "k\x0131rkikibu\x00e7uk", 42.5)
|
||||
, ( "k\x0131rk\x00fc\x00e7bu\x00e7uk", 43.5)
|
||||
, ( "k\x0131rkd\x00f6rtbu\x00e7uk", 44.5)
|
||||
, ( "k\x0131rkbe\x015fbu\x00e7uk", 45.5)
|
||||
, ( "k\x0131rkalt\x0131bu\x00e7uk", 46.5)
|
||||
, ( "k\x0131rkyedibu\x00e7uk", 47.5)
|
||||
, ( "k\x0131rksekizbu\x00e7uk", 48.5)
|
||||
, ( "k\x0131rkdokuzbu\x00e7uk", 49.5)
|
||||
, ( "ellibibu\x00e7uk", 51.5)
|
||||
, ( "ellibirbu\x00e7uk", 51.5)
|
||||
, ( "elliikibu\x00e7uk", 52.5)
|
||||
, ( "elli\x00fc\x00e7bu\x00e7uk", 53.5)
|
||||
, ( "ellid\x00f6rtbu\x00e7uk", 54.5)
|
||||
, ( "ellibe\x015fbu\x00e7uk", 55.5)
|
||||
, ( "ellialt\x0131bu\x00e7uk", 56.5)
|
||||
, ( "elliyedibu\x00e7uk", 57.5)
|
||||
, ( "ellisekizbu\x00e7uk", 58.5)
|
||||
, ( "ellidokuzbu\x00e7uk", 59.5)
|
||||
, ( "altm\x0131\x015fbirbu\x00e7uk", 61.5)
|
||||
, ( "atm\x0131\x015fbirbu\x00e7uk", 61.5)
|
||||
, ( "altm\x0131\x015fikibu\x00e7uk", 62.5)
|
||||
, ( "atm\x0131\x015fikibu\x00e7uk", 62.5)
|
||||
, ( "atm\x0131\x015f\x00fc\x00e7bu\x00e7uk", 63.5)
|
||||
, ( "altm\x0131\x015f\x00fc\x00e7bu\x00e7uk", 63.5)
|
||||
, ( "altm\x0131\x015fd\x00f6rtbu\x00e7uk", 64.5)
|
||||
, ( "atm\x0131\x015fd\x00f6rtbu\x00e7uk", 64.5)
|
||||
, ( "altm\x0131\x015fbe\x015fbu\x00e7uk", 65.5)
|
||||
, ( "atm\x0131\x015fbe\x015fbu\x00e7uk", 65.5)
|
||||
, ( "altm\x0131\x015falt\x0131bu\x00e7uk", 66.5)
|
||||
, ( "atm\x0131\x015falt\x0131bu\x00e7uk", 66.5)
|
||||
, ( "atm\x0131\x015fyedibu\x00e7uk", 67.5)
|
||||
, ( "altm\x0131\x015fyedibu\x00e7uk", 67.5)
|
||||
, ( "altm\x0131\x015fsekizbu\x00e7uk", 68.5)
|
||||
, ( "atm\x0131\x015fsekizbu\x00e7uk", 68.5)
|
||||
, ( "altm\x0131\x015fdokuzbu\x00e7uk", 69.5)
|
||||
, ( "atm\x0131\x015fdokuzbu\x00e7uk", 69.5)
|
||||
, ( "yetmi\x015fbibu\x00e7uk", 71.5)
|
||||
, ( "yetmi\x015fbirbu\x00e7uk", 71.5)
|
||||
, ( "yetmi\x015fikibu\x00e7uk", 72.5)
|
||||
, ( "yetmi\x015f\x00fc\x00e7bu\x00e7uk", 73.5)
|
||||
, ( "yetmi\x015fd\x00f6rtbu\x00e7uk", 74.5)
|
||||
, ( "yetmi\x015fbe\x015fbu\x00e7uk", 75.5)
|
||||
, ( "yetmi\x015falt\x0131bu\x00e7uk", 76.5)
|
||||
, ( "yetmi\x015fyedibu\x00e7uk", 77.5)
|
||||
, ( "yetmi\x015fsekizbu\x00e7uk", 78.5)
|
||||
, ( "yetmi\x015fdokuzbu\x00e7uk", 79.5)
|
||||
, ( "seksenbibu\x00e7uk", 81.5)
|
||||
, ( "seksenbirbu\x00e7uk", 81.5)
|
||||
, ( "seksenikibu\x00e7uk", 82.5)
|
||||
, ( "seksen\x00fc\x00e7bu\x00e7uk", 83.5)
|
||||
, ( "seksend\x00f6rtbu\x00e7uk", 84.5)
|
||||
, ( "seksenbe\x015fbu\x00e7uk", 85.5)
|
||||
, ( "seksenalt\x0131bu\x00e7uk", 86.5)
|
||||
, ( "seksenyedibu\x00e7uk", 87.5)
|
||||
, ( "seksensekizbu\x00e7uk", 88.5)
|
||||
, ( "seksendokuzbu\x00e7uk", 89.5)
|
||||
, ( "doksanbirbu\x00e7uk", 91.5)
|
||||
, ( "doksanbibu\x00e7uk", 91.5)
|
||||
, ( "doksanikibu\x00e7uk", 92.5)
|
||||
, ( "doksan\x00fc\x00e7bu\x00e7uk", 93.5)
|
||||
, ( "doksand\x00f6rtbu\x00e7uk", 94.5)
|
||||
, ( "doksanbe\x015fbu\x00e7uk", 95.5)
|
||||
, ( "doksanalt\x0131bu\x00e7uk", 96.5)
|
||||
, ( "doksanyedibu\x00e7uk", 97.5)
|
||||
, ( "doksansekizbu\x00e7uk", 98.5)
|
||||
, ( "doksandokuzbu\x00e7uk", 99.5)
|
||||
[ ( "onbirbuçuk", 11.5)
|
||||
, ( "onbibuçuk", 11.5)
|
||||
, ( "onikibuçuk", 12.5)
|
||||
, ( "onüçbuçuk", 13.5)
|
||||
, ( "ondörtbuçuk", 14.5)
|
||||
, ( "onbeşbuçuk", 15.5)
|
||||
, ( "onaltıbuçuk", 16.5)
|
||||
, ( "onyedibuçuk", 17.5)
|
||||
, ( "onsekizbuçuk", 18.5)
|
||||
, ( "ondokuzbuçuk", 19.5)
|
||||
, ( "yirmibibuçuk", 21.5)
|
||||
, ( "yirmibirbuçuk", 21.5)
|
||||
, ( "yirmiikibuçuk", 22.5)
|
||||
, ( "yirmiüçbuçuk", 23.5)
|
||||
, ( "yirmidörtbuçuk", 24.5)
|
||||
, ( "yirmibeşbuçuk", 25.5)
|
||||
, ( "yirmialtıbuçuk", 26.5)
|
||||
, ( "yirmiyedibuçuk", 27.5)
|
||||
, ( "yirmisekizbuçuk", 28.5)
|
||||
, ( "yirmidokuzbuçuk", 29.5)
|
||||
, ( "otuzbibuçuk", 31.5)
|
||||
, ( "otuzbirbuçuk", 31.5)
|
||||
, ( "otuzikibuçuk", 32.5)
|
||||
, ( "otuzüçbuçuk", 33.5)
|
||||
, ( "otuzdörtbuçuk", 34.5)
|
||||
, ( "otuzbeşbuçuk", 35.5)
|
||||
, ( "otuzaltıbuçuk", 36.5)
|
||||
, ( "otuzyedibuçuk", 37.5)
|
||||
, ( "otuzsekizbuçuk", 38.5)
|
||||
, ( "otuzdokuzbuçuk", 39.5)
|
||||
, ( "kırkbirbuçuk", 41.5)
|
||||
, ( "kırkbibuçuk", 41.5)
|
||||
, ( "kırkikibuçuk", 42.5)
|
||||
, ( "kırküçbuçuk", 43.5)
|
||||
, ( "kırkdörtbuçuk", 44.5)
|
||||
, ( "kırkbeşbuçuk", 45.5)
|
||||
, ( "kırkaltıbuçuk", 46.5)
|
||||
, ( "kırkyedibuçuk", 47.5)
|
||||
, ( "kırksekizbuçuk", 48.5)
|
||||
, ( "kırkdokuzbuçuk", 49.5)
|
||||
, ( "ellibibuçuk", 51.5)
|
||||
, ( "ellibirbuçuk", 51.5)
|
||||
, ( "elliikibuçuk", 52.5)
|
||||
, ( "elliüçbuçuk", 53.5)
|
||||
, ( "ellidörtbuçuk", 54.5)
|
||||
, ( "ellibeşbuçuk", 55.5)
|
||||
, ( "ellialtıbuçuk", 56.5)
|
||||
, ( "elliyedibuçuk", 57.5)
|
||||
, ( "ellisekizbuçuk", 58.5)
|
||||
, ( "ellidokuzbuçuk", 59.5)
|
||||
, ( "altmışbirbuçuk", 61.5)
|
||||
, ( "atmışbirbuçuk", 61.5)
|
||||
, ( "altmışikibuçuk", 62.5)
|
||||
, ( "atmışikibuçuk", 62.5)
|
||||
, ( "atmışüçbuçuk", 63.5)
|
||||
, ( "altmışüçbuçuk", 63.5)
|
||||
, ( "altmışdörtbuçuk", 64.5)
|
||||
, ( "atmışdörtbuçuk", 64.5)
|
||||
, ( "altmışbeşbuçuk", 65.5)
|
||||
, ( "atmışbeşbuçuk", 65.5)
|
||||
, ( "altmışaltıbuçuk", 66.5)
|
||||
, ( "atmışaltıbuçuk", 66.5)
|
||||
, ( "atmışyedibuçuk", 67.5)
|
||||
, ( "altmışyedibuçuk", 67.5)
|
||||
, ( "altmışsekizbuçuk", 68.5)
|
||||
, ( "atmışsekizbuçuk", 68.5)
|
||||
, ( "altmışdokuzbuçuk", 69.5)
|
||||
, ( "atmışdokuzbuçuk", 69.5)
|
||||
, ( "yetmişbibuçuk", 71.5)
|
||||
, ( "yetmişbirbuçuk", 71.5)
|
||||
, ( "yetmişikibuçuk", 72.5)
|
||||
, ( "yetmişüçbuçuk", 73.5)
|
||||
, ( "yetmişdörtbuçuk", 74.5)
|
||||
, ( "yetmişbeşbuçuk", 75.5)
|
||||
, ( "yetmişaltıbuçuk", 76.5)
|
||||
, ( "yetmişyedibuçuk", 77.5)
|
||||
, ( "yetmişsekizbuçuk", 78.5)
|
||||
, ( "yetmişdokuzbuçuk", 79.5)
|
||||
, ( "seksenbibuçuk", 81.5)
|
||||
, ( "seksenbirbuçuk", 81.5)
|
||||
, ( "seksenikibuçuk", 82.5)
|
||||
, ( "seksenüçbuçuk", 83.5)
|
||||
, ( "seksendörtbuçuk", 84.5)
|
||||
, ( "seksenbeşbuçuk", 85.5)
|
||||
, ( "seksenaltıbuçuk", 86.5)
|
||||
, ( "seksenyedibuçuk", 87.5)
|
||||
, ( "seksensekizbuçuk", 88.5)
|
||||
, ( "seksendokuzbuçuk", 89.5)
|
||||
, ( "doksanbirbuçuk", 91.5)
|
||||
, ( "doksanbibuçuk", 91.5)
|
||||
, ( "doksanikibuçuk", 92.5)
|
||||
, ( "doksanüçbuçuk", 93.5)
|
||||
, ( "doksandörtbuçuk", 94.5)
|
||||
, ( "doksanbeşbuçuk", 95.5)
|
||||
, ( "doksanaltıbuçuk", 96.5)
|
||||
, ( "doksanyedibuçuk", 97.5)
|
||||
, ( "doksansekizbuçuk", 98.5)
|
||||
, ( "doksandokuzbuçuk", 99.5)
|
||||
]
|
||||
|
||||
ruleInteger9 :: Rule
|
||||
ruleInteger9 = Rule
|
||||
{ name = "integer 11..19 21..29 31..39 41..49 51..59 61..69 71..79 81..89 91..99"
|
||||
, pattern =
|
||||
[ regex "((on|yirmi|otuz|k\x0131rk|elli|atm\x0131\x015f|altm\x0131\x015f|yetmi\x015f|seksen|doksan)(bir|bi|iki|\x00fc\x00e7|d\x00f6rt|be\x015f|alt\x0131|yedi|sekiz|dokuz)(bu\x00e7uk))"
|
||||
[ regex "((on|yirmi|otuz|kırk|elli|atmış|altmış|yetmiş|seksen|doksan)(bir|bi|iki|üç|dört|beş|altı|yedi|sekiz|dokuz)(buçuk))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -541,7 +541,7 @@ ruleDozen :: Rule
|
||||
ruleDozen = Rule
|
||||
{ name = "dozen"
|
||||
, pattern =
|
||||
[ regex "d\x00fczine"
|
||||
[ regex "düzine"
|
||||
]
|
||||
, prod = \_ -> integer 12 >>= withGrain 1 >>= withMultipliable
|
||||
}
|
||||
@ -550,16 +550,16 @@ oneToNineMap :: HashMap Text Integer
|
||||
oneToNineMap = HashMap.fromList
|
||||
[ ( "s\305f\305r", 0)
|
||||
, ( "yok", 0)
|
||||
, ( "hi\x00e7", 0)
|
||||
, ( "hiç", 0)
|
||||
, ( "bir", 1)
|
||||
, ( "bi", 1)
|
||||
, ( "yek", 1)
|
||||
, ( "tek", 1)
|
||||
, ( "iki", 2)
|
||||
, ( "\x00fc\x00e7", 3)
|
||||
, ( "d\x00f6rt", 4)
|
||||
, ( "be\x015f", 5)
|
||||
, ( "alt\x0131", 6)
|
||||
, ( "üç", 3)
|
||||
, ( "dört", 4)
|
||||
, ( "beş", 5)
|
||||
, ( "altı", 6)
|
||||
, ( "yedi", 7)
|
||||
, ( "sekiz", 8)
|
||||
, ( "dokuz", 9)
|
||||
@ -569,7 +569,7 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..9)"
|
||||
, pattern =
|
||||
[ regex "(yok|hi(\x00e7)|s(\x0131)f(\x0131)r|bir?|[ty]ek|iki|(\x00fc)(\x00e7)|d(\x00f6)rt|be(\x015f)|alt(\x0131)|yedi|sekiz|dokuz)"
|
||||
[ regex "(yok|hi(ç)|s(ı)f(ı)r|bir?|[ty]ek|iki|(ü)(ç)|d(ö)rt|be(ş)|alt(ı)|yedi|sekiz|dokuz)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -579,23 +579,23 @@ ruleInteger = Rule
|
||||
|
||||
numeralSuffixesHalfsuffixText2Map :: HashMap Text Double
|
||||
numeralSuffixesHalfsuffixText2Map = HashMap.fromList
|
||||
[ ( "onbu\x00e7uk", 10.5)
|
||||
, ( "yirmibu\x00e7uk", 20.5)
|
||||
, ( "otuzbu\x00e7uk", 30.5)
|
||||
, ( "k\x0131rkbu\x00e7uk", 40.5)
|
||||
, ( "ellibu\x00e7uk", 50.5)
|
||||
, ( "atm\x0131\x015fbu\x00e7uk", 60.5)
|
||||
, ( "altm\x0131\x015fbu\x00e7uk", 60.5)
|
||||
, ( "yetmi\x015fbu\x00e7uk", 70.5)
|
||||
, ( "seksenbu\x00e7uk", 80.5)
|
||||
, ( "doksanbu\x00e7uk", 90.5)
|
||||
[ ( "onbuçuk", 10.5)
|
||||
, ( "yirmibuçuk", 20.5)
|
||||
, ( "otuzbuçuk", 30.5)
|
||||
, ( "kırkbuçuk", 40.5)
|
||||
, ( "ellibuçuk", 50.5)
|
||||
, ( "atmışbuçuk", 60.5)
|
||||
, ( "altmışbuçuk", 60.5)
|
||||
, ( "yetmişbuçuk", 70.5)
|
||||
, ( "seksenbuçuk", 80.5)
|
||||
, ( "doksanbuçuk", 90.5)
|
||||
]
|
||||
|
||||
ruleNumeralSuffixesHalfsuffixText2 :: Rule
|
||||
ruleNumeralSuffixesHalfsuffixText2 = Rule
|
||||
{ name = "number suffixes (half-suffix text) (10..90)"
|
||||
, pattern =
|
||||
[ regex "((on|yirmi|otuz|k\x0131rk|elli|atm\x0131\x015f|altm\x0131\x015f|yetmi\x015f|seksen|doksan)(bu\x00e7uk))"
|
||||
[ regex "((on|yirmi|otuz|kırk|elli|atmış|altmış|yetmiş|seksen|doksan)(buçuk))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -609,7 +609,7 @@ ruleNumeralSuffixesHalfSuffix = Rule
|
||||
{ name = "number suffixes (half-suffix)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "(bu\x00e7uk)(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "(buçuk)(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 0.5
|
||||
@ -644,11 +644,11 @@ tensMap = HashMap.fromList
|
||||
[ ( "on", 10)
|
||||
, ( "yirmi", 20)
|
||||
, ( "otuz", 30)
|
||||
, ( "k\x0131rk", 40)
|
||||
, ( "kırk", 40)
|
||||
, ( "elli", 50)
|
||||
, ( "altm\x0131\x015f", 60)
|
||||
, ( "atm\x0131\x015f", 60)
|
||||
, ( "yetmi\x015f", 70)
|
||||
, ( "altmış", 60)
|
||||
, ( "atmış", 60)
|
||||
, ( "yetmiş", 70)
|
||||
, ( "seksen", 80)
|
||||
, ( "doksan", 90)
|
||||
]
|
||||
@ -657,7 +657,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (10..90)"
|
||||
, pattern =
|
||||
[ regex "(on|yirmi|otuz|k\x0131rk|elli|atm\x0131\x015f|altm\x0131\x015f|yetmi\x015f|seksen|doksan)"
|
||||
[ regex "(on|yirmi|otuz|kırk|elli|atmış|altmış|yetmiş|seksen|doksan)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -669,7 +669,7 @@ ruleQuarter :: Rule
|
||||
ruleQuarter = Rule
|
||||
{ name = "quarter"
|
||||
, pattern =
|
||||
[ regex "(\x00e7eyrek)"
|
||||
[ regex "(çeyrek)"
|
||||
]
|
||||
, prod = \_ -> double 0.25
|
||||
}
|
||||
@ -679,7 +679,7 @@ ruleNumeralDotNumeral = Rule
|
||||
{ name = "number dot number"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "nokta|virg\x00fcl"
|
||||
, regex "nokta|virgül"
|
||||
, numberWith TNumeral.grain isNothing
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -29,21 +29,21 @@ import Duckling.Types
|
||||
|
||||
twentyNinetyMap :: HashMap Text Integer
|
||||
twentyNinetyMap = HashMap.fromList
|
||||
[ ( "\x0434\x0432\x0430\x0434\x0446\x044f\x0442\x044c" , 20 )
|
||||
, ( "\x0442\x0440\x0438\x0434\x0446\x044f\x0442\x044c" , 30 )
|
||||
, ( "\x0441\x043e\x0440\x043e\x043a" , 40 )
|
||||
, ( "\x043f\x2018\x044f\x0442\x0434\x0435\x0441\x044f\x0442" , 50 )
|
||||
, ( "\x0448\x0456\x0441\x0442\x0434\x0435\x0441\x044f\x0442" , 60 )
|
||||
, ( "\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442" , 70 )
|
||||
, ( "\x0434\x0435\x0432\x2018\x044f\x043d\x043e\x0441\x0442\x043e" , 90 )
|
||||
, ( "\x0432\x0456\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442" , 80 )
|
||||
[ ( "двадцять" , 20 )
|
||||
, ( "тридцять" , 30 )
|
||||
, ( "сорок" , 40 )
|
||||
, ( "п‘ятдесят" , 50 )
|
||||
, ( "шістдесят" , 60 )
|
||||
, ( "сімдесят" , 70 )
|
||||
, ( "дев‘яносто" , 90 )
|
||||
, ( "вісімдесят" , 80 )
|
||||
]
|
||||
|
||||
ruleInteger5 :: Rule
|
||||
ruleInteger5 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(\x0434\x0432\x0430\x0434\x0446\x044f\x0442\x044c|\x0442\x0440\x0438\x0434\x0446\x044f\x0442\x044c|\x0441\x043e\x0440\x043e\x043a|\x043f\x2018\x044f\x0442\x0434\x0435\x0441\x044f\x0442|\x0448\x0456\x0441\x0442\x0434\x0435\x0441\x044f\x0442|\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442|\x0432\x0456\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442|\x0434\x0435\x0432\x2018\x044f\x043d\x043e\x0441\x0442\x043e)"
|
||||
[ regex "(двадцять|тридцять|сорок|п‘ятдесят|шістдесят|сімдесят|вісімдесят|дев‘яносто)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -91,28 +91,28 @@ ruleInteger3 :: Rule
|
||||
ruleInteger3 = Rule
|
||||
{ name = "integer 2"
|
||||
, pattern =
|
||||
[ regex "(\x0434\x0432\x0430|\x0434\x0432\x0456|\x0434\x0432\x043e\x0454|\x043f\x0430\x0440\x0430|\x043f\x0430\x0440\x0443|\x043f\x0430\x0440\x043e\x0447\x043a\x0443|\x043f\x0430\x0440\x043e\x0447\x043a\x0430)"
|
||||
[ regex "(два|дві|двоє|пара|пару|парочку|парочка)"
|
||||
]
|
||||
, prod = \_ -> integer 2
|
||||
}
|
||||
|
||||
hundredsMap :: HashMap Text Integer
|
||||
hundredsMap = HashMap.fromList
|
||||
[ ( "\x0441\x0442\x043e" , 100 )
|
||||
, ( "\x0434\x0432\x0456\x0441\x0442\x0456" , 200 )
|
||||
, ( "\x0442\x0440\x0438\x0441\x0442\x0430" , 300 )
|
||||
, ( "\x0447\x043e\x0442\x0438\x0440\x0438\x0441\x0442\x0430" , 400 )
|
||||
, ( "\x043f\x2018\x044f\x0442\x0441\x043e\x0442" , 500 )
|
||||
, ( "\x0448\x0456\x0441\x0442\x0441\x043e\x0442" , 600 )
|
||||
, ( "\x0441\x0456\x043c\x0441\x043e\x0442" , 700 )
|
||||
, ( "\x0432\x0456\x0441\x0456\x043c\x0441\x043e\x0442" , 800 )
|
||||
, ( "\x0434\x0435\x0432\x2018\x044f\x0442\x0441\x043e\x0442" , 900 )
|
||||
[ ( "сто" , 100 )
|
||||
, ( "двісті" , 200 )
|
||||
, ( "триста" , 300 )
|
||||
, ( "чотириста" , 400 )
|
||||
, ( "п‘ятсот" , 500 )
|
||||
, ( "шістсот" , 600 )
|
||||
, ( "сімсот" , 700 )
|
||||
, ( "вісімсот" , 800 )
|
||||
, ( "дев‘ятсот" , 900 )
|
||||
]
|
||||
ruleInteger6 :: Rule
|
||||
ruleInteger6 = Rule
|
||||
{ name = "integer (100..900)"
|
||||
, pattern =
|
||||
[ regex "(\x0441\x0442\x043e|\x0434\x0432\x0456\x0441\x0442\x0456|\x0442\x0440\x0438\x0441\x0442\x0430|\x0447\x043e\x0442\x0438\x0440\x0438\x0441\x0442\x0430|\x043f\x2018\x044f\x0442\x0441\x043e\x0442|\x0448\x0456\x0441\x0442\x0441\x043e\x0442|\x0441\x0456\x043c\x0441\x043e\x0442|\x0432\x0456\x0441\x0456\x043c\x0441\x043e\x0442|\x0434\x0435\x0432\x2018\x044f\x0442\x0441\x043e\x0442)"
|
||||
[ regex "(сто|двісті|триста|чотириста|п‘ятсот|шістсот|сімсот|вісімсот|дев‘ятсот)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -124,7 +124,7 @@ ruleNumeralsPrefixWithMinus :: Rule
|
||||
ruleNumeralsPrefixWithMinus = Rule
|
||||
{ name = "numbers prefix with -, minus"
|
||||
, pattern =
|
||||
[ regex "-|\x043c\x0456\x043d\x0443\x0441\\s?"
|
||||
[ regex "-|мінус\\s?"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -137,18 +137,18 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "((\x043a|\x043c|\x0433)|(\x041a|\x041c|\x0413))(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "((к|м|г)|(К|М|Г))(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
Token RegexMatch (GroupMatch (match:_)):
|
||||
_) -> case Text.toLower match of
|
||||
"\x043a" -> double $ v * 1e3
|
||||
"\x041a" -> double $ v * 1e3
|
||||
"\x043c" -> double $ v * 1e6
|
||||
"\x041c" -> double $ v * 1e6
|
||||
"\x0433" -> double $ v * 1e9
|
||||
"\x0413" -> double $ v * 1e9
|
||||
"к" -> double $ v * 1e3
|
||||
"К" -> double $ v * 1e3
|
||||
"м" -> double $ v * 1e6
|
||||
"М" -> double $ v * 1e6
|
||||
"г" -> double $ v * 1e9
|
||||
"Г" -> double $ v * 1e9
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -185,36 +185,36 @@ ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer 0"
|
||||
, pattern =
|
||||
[ regex "(\x043d\x0443\x043b\x044c)"
|
||||
[ regex "(нуль)"
|
||||
]
|
||||
, prod = \_ -> integer 0
|
||||
}
|
||||
|
||||
threeNineteenMap :: HashMap Text Integer
|
||||
threeNineteenMap = HashMap.fromList
|
||||
[ ( "\x0442\x0440\x0438" , 3 )
|
||||
, ( "\x0447\x043e\x0442\x0438\x0440\x0438" , 4 )
|
||||
, ( "\x043f\x2018\x044f\x0442\x044c" , 5 )
|
||||
, ( "\x0448\x0456\x0441\x0442\x044c" , 6 )
|
||||
, ( "\x0441\x0456\x043c" , 7 )
|
||||
, ( "\x0432\x0456\x0441\x0456\x043c" , 8 )
|
||||
, ( "\x0434\x0435\x0432\x2018\x044f\x0442\x044c" , 9 )
|
||||
, ( "\x0434\x0435\x0441\x044f\x0442\x044c" , 10 )
|
||||
, ( "\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 11 )
|
||||
, ( "\x0434\x0432\x0430\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 12 )
|
||||
, ( "\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 13 )
|
||||
, ( "\x0447\x043e\x0442\x0438\x0440\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 14 )
|
||||
, ( "\x043f\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 15 )
|
||||
, ( "\x0448\x0456\x0441\x0442\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 16 )
|
||||
, ( "\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 17 )
|
||||
, ( "\x0432\x0456\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 18 )
|
||||
, ( "\x0434\x0435\x0432\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442\x044c" , 19 )
|
||||
[ ( "три" , 3 )
|
||||
, ( "чотири" , 4 )
|
||||
, ( "п‘ять" , 5 )
|
||||
, ( "шість" , 6 )
|
||||
, ( "сім" , 7 )
|
||||
, ( "вісім" , 8 )
|
||||
, ( "дев‘ять" , 9 )
|
||||
, ( "десять" , 10 )
|
||||
, ( "одинадцять" , 11 )
|
||||
, ( "дванадцять" , 12 )
|
||||
, ( "тринадцять" , 13 )
|
||||
, ( "чотирнадцять" , 14 )
|
||||
, ( "п‘ятнадцять" , 15 )
|
||||
, ( "шістнадцять" , 16 )
|
||||
, ( "сімнадцять" , 17 )
|
||||
, ( "вісімнадцять" , 18 )
|
||||
, ( "дев‘ятнадцять" , 19 )
|
||||
]
|
||||
ruleInteger4 :: Rule
|
||||
ruleInteger4 = Rule
|
||||
{ name = "integer (3..19)"
|
||||
, pattern =
|
||||
[ regex "(\x0442\x0440\x0438|\x0447\x043e\x0442\x0438\x0440\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x0447\x043e\x0442\x0438\x0440\x0438|\x043f\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x043f\x2018\x044f\x0442\x044c|\x0448\x0456\x0441\x0442\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x0448\x0456\x0441\x0442\x044c|\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x0441\x0456\x043c|\x0432\x0456\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x0432\x0456\x0441\x0456\x043c|\x0434\x0435\x0432\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x0434\x0435\x0432\x2018\x044f\x0442\x044c|\x0434\x0435\x0441\x044f\x0442\x044c|\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x0434\x0432\x0430\x043d\x0430\x0434\x0446\x044f\x0442\x044c|\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x044f\x0442\x044c)"
|
||||
[ regex "(три|чотирнадцять|чотири|п‘ятнадцять|п‘ять|шістнадцять|шість|сімнадцять|сім|вісімнадцять|вісім|дев‘ятнадцять|дев‘ять|десять|одинадцять|дванадцять|тринадцять)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -226,7 +226,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer 1"
|
||||
, pattern =
|
||||
[ regex "(\x043e\x0434\x0438\x043d|\x043e\x0434\x043d\x0430|\x043e\x0434\x043d\x0443|\x043e\x0434\x043d\x0435|\x043e\x0434\x043d\x043e\x0433\x043e)"
|
||||
[ regex "(один|одна|одну|одне|одного)"
|
||||
]
|
||||
, prod = \_ -> integer 1
|
||||
}
|
||||
@ -236,7 +236,7 @@ ruleNumeralDotNumeral = Rule
|
||||
{ name = "number dot number"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\x043a\x0440\x0430\x043f\x043a\x0430"
|
||||
, regex "крапка"
|
||||
, numberWith TNumeral.grain isNothing
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -27,21 +27,21 @@ import Duckling.Types
|
||||
|
||||
powersOfTenMap :: HashMap.HashMap Text.Text (Double, Int)
|
||||
powersOfTenMap = HashMap.fromList
|
||||
[ ( "tr\x0103", (1e2, 2) )
|
||||
, ( "tr\x0103m", (1e2, 2) )
|
||||
, ( "ngh\x00ec", (1e3, 3) )
|
||||
, ( "ngh\x00ecn", (1e3, 3) )
|
||||
, ( "tri\x1ec7", (1e6, 6) )
|
||||
, ( "tri\x1ec7u", (1e6, 6) )
|
||||
[ ( "tră", (1e2, 2) )
|
||||
, ( "trăm", (1e2, 2) )
|
||||
, ( "nghì", (1e3, 3) )
|
||||
, ( "nghìn", (1e3, 3) )
|
||||
, ( "triệ", (1e6, 6) )
|
||||
, ( "triệu", (1e6, 6) )
|
||||
, ( "t", (1e9, 9) )
|
||||
, ( "t\x1ef7", (1e9, 9) )
|
||||
, ( "tỷ", (1e9, 9) )
|
||||
]
|
||||
|
||||
rulePowersOfTen :: Rule
|
||||
rulePowersOfTen = Rule
|
||||
{ name = "powers of tens"
|
||||
, pattern =
|
||||
[ regex "(tr\x0103m?|ngh\x00ecn?|tri\x1ec7u?|t\x1ef7?)"
|
||||
[ regex "(trăm?|nghìn?|triệu?|tỷ?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -84,7 +84,7 @@ ruleNumeralsPrefixWithM :: Rule
|
||||
ruleNumeralsPrefixWithM = Rule
|
||||
{ name = "numbers prefix with -, âm"
|
||||
, pattern =
|
||||
[ regex "-|\x00e2m\\s?"
|
||||
[ regex "-|âm\\s?"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -97,7 +97,7 @@ ruleNumerals2 = Rule
|
||||
{ name = "numbers 25 35 45 55 65 75 85 95"
|
||||
, pattern =
|
||||
[ oneOf [20, 30 .. 90]
|
||||
, regex "l\x0103m"
|
||||
, regex "lăm"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 5
|
||||
@ -146,7 +146,7 @@ ruleNumeralDot = Rule
|
||||
{ name = "number dot 1 9"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "ch\x1ea5m|ph\x1ea9y"
|
||||
, regex "chấm|phẩy"
|
||||
, numberWith TNumeral.grain isNothing
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -186,7 +186,7 @@ ruleNumeralsSuffixesKMG = Rule
|
||||
{ name = "numbers suffixes (K, M, G)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "([kmg])(?=[\\W\\$\x20ac]|$)"
|
||||
, regex "([kmg])(?=[\\W\\$€]|$)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):
|
||||
@ -215,53 +215,53 @@ ruleNumeralNghn = Rule
|
||||
|
||||
integerMap :: HashMap.HashMap Text.Text Integer
|
||||
integerMap = HashMap.fromList
|
||||
[ ("kh\x00f4ng", 0)
|
||||
, ("m\x1ed9t", 1)
|
||||
, ("linh m\x1ed9t", 1)
|
||||
, ("l\x1ebb m\x1ed9t", 1)
|
||||
[ ("không", 0)
|
||||
, ("một", 1)
|
||||
, ("linh một", 1)
|
||||
, ("lẻ một", 1)
|
||||
, ("hai", 2)
|
||||
, ("l\x1ebb hai", 2)
|
||||
, ("lẻ hai", 2)
|
||||
, ("linh hai", 2)
|
||||
, ("ba", 3)
|
||||
, ("l\x1ebb", 3)
|
||||
, ("lẻ", 3)
|
||||
, ("linh ba", 3)
|
||||
, ("l\x1ebb b\x1ed1n", 4)
|
||||
, ("linh b\x1ed1n", 4)
|
||||
, ("b\x1ed1n", 4)
|
||||
, ("n\x0103m", 5)
|
||||
, ("l\x1ebb n\x0103m", 5)
|
||||
, ("linh n\x0103m", 5)
|
||||
, ("linh s\x00e1u", 6)
|
||||
, ("s\x00e1u", 6)
|
||||
, ("l\x1ebb s\x00e1u", 6)
|
||||
, ("linh b\x1ea3y", 7)
|
||||
, ("l\x1ebb b\x1ea3y", 7)
|
||||
, ("b\x1ea3y", 7)
|
||||
, ("l\x1ebb t\x00e1m", 8)
|
||||
, ("linh t\x00e1m", 8)
|
||||
, ("t\x00e1m", 8)
|
||||
, ("l\x1ebb ch\x00edn", 9)
|
||||
, ("ch\x00edn", 9)
|
||||
, ("linh ch\x00edn", 9)
|
||||
, ("linh m\x01b0\x1eddi", 10)
|
||||
, ("m\x01b0\x1eddi", 10)
|
||||
, ("l\x1ebb m\x01b0\x1eddi", 10)
|
||||
, ("m\x01b0\x1eddi m\x1ed9t", 11)
|
||||
, ("m\x01b0\x1eddi hai", 12)
|
||||
, ("m\x01b0\x1eddi ba", 13)
|
||||
, ("m\x01b0\x1eddi b\x1ed1n", 14)
|
||||
, ("m\x01b0\x1eddi l\x0103m", 15)
|
||||
, ("m\x01b0\x1eddi s\x00e1u", 16)
|
||||
, ("m\x01b0\x1eddi b\x1ea3y", 17)
|
||||
, ("m\x01b0\x1eddi t\x00e1m", 18)
|
||||
, ("m\x01b0\x1eddi ch\x00edn", 19)
|
||||
, ("lẻ bốn", 4)
|
||||
, ("linh bốn", 4)
|
||||
, ("bốn", 4)
|
||||
, ("năm", 5)
|
||||
, ("lẻ năm", 5)
|
||||
, ("linh năm", 5)
|
||||
, ("linh sáu", 6)
|
||||
, ("sáu", 6)
|
||||
, ("lẻ sáu", 6)
|
||||
, ("linh bảy", 7)
|
||||
, ("lẻ bảy", 7)
|
||||
, ("bảy", 7)
|
||||
, ("lẻ tám", 8)
|
||||
, ("linh tám", 8)
|
||||
, ("tám", 8)
|
||||
, ("lẻ chín", 9)
|
||||
, ("chín", 9)
|
||||
, ("linh chín", 9)
|
||||
, ("linh mười", 10)
|
||||
, ("mười", 10)
|
||||
, ("lẻ mười", 10)
|
||||
, ("mười một", 11)
|
||||
, ("mười hai", 12)
|
||||
, ("mười ba", 13)
|
||||
, ("mười bốn", 14)
|
||||
, ("mười lăm", 15)
|
||||
, ("mười sáu", 16)
|
||||
, ("mười bảy", 17)
|
||||
, ("mười tám", 18)
|
||||
, ("mười chín", 19)
|
||||
]
|
||||
|
||||
ruleInteger :: Rule
|
||||
ruleInteger = Rule
|
||||
{ name = "integer (0..19)"
|
||||
, pattern =
|
||||
[ regex "(kh\x00f4ng|m\x1ed9t|linh m\x1ed9t|l\x1ebb m\x1ed9t|hai|linh hai|l\x1ebb hai|ba|linh ba|l\x1ebb ba|b\x1ed1n|linh b\x1ed1n|l\x1ebb b\x1ed1n|n\x0103m|linh n\x0103m|l\x1ebb n\x0103m|s\x00e1u|l\x1ebb s\x00e1u|linh s\x00e1u|b\x1ea3y|l\x1ebb b\x1ea3y|linh b\x1ea3y|t\x00e1m|linh t\x00e1m|l\x1ebb t\x00e1m|ch\x00edn|linh ch\x00edn|l\x1ebb ch\x00edn|m\x01b0\x1eddi m\x1ed9t|m\x01b0\x1eddi hai|m\x01b0\x1eddi ba|m\x01b0\x1eddi b\x1ed1n|m\x01b0\x1eddi l\x0103m|m\x01b0\x1eddi s\x00e1u|m\x01b0\x1eddi b\x1ea3y|m\x01b0\x1eddi t\x00e1m|m\x01b0\x1eddi ch\x00edn|m\x01b0\x1eddi|linh m\x01b0\x1eddi)"
|
||||
[ regex "(không|một|linh một|lẻ một|hai|linh hai|lẻ hai|ba|linh ba|lẻ ba|bốn|linh bốn|lẻ bốn|năm|linh năm|lẻ năm|sáu|lẻ sáu|linh sáu|bảy|lẻ bảy|linh bảy|tám|linh tám|lẻ tám|chín|linh chín|lẻ chín|mười một|mười hai|mười ba|mười bốn|mười lăm|mười sáu|mười bảy|mười tám|mười chín|mười|linh mười)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -271,21 +271,21 @@ ruleInteger = Rule
|
||||
|
||||
tensMap :: HashMap.HashMap Text.Text Integer
|
||||
tensMap = HashMap.fromList
|
||||
[ ("hai m\x01b0\x01a1i", 20)
|
||||
, ("ba m\x01b0\x01a1i", 30)
|
||||
, ("b\x1ed1n m\x01b0\x01a1i", 40)
|
||||
, ("n\x0103m m\x01b0\x01a1i", 50)
|
||||
, ("s\x00e1u m\x01b0\x01a1i", 60)
|
||||
, ("b\x1ea3y m\x01b0\x01a1i", 70)
|
||||
, ("t\x00e1m m\x01b0\x01a1i", 80)
|
||||
, ("ch\x00edn m\x01b0\x01a1i", 90)
|
||||
[ ("hai mươi", 20)
|
||||
, ("ba mươi", 30)
|
||||
, ("bốn mươi", 40)
|
||||
, ("năm mươi", 50)
|
||||
, ("sáu mươi", 60)
|
||||
, ("bảy mươi", 70)
|
||||
, ("tám mươi", 80)
|
||||
, ("chín mươi", 90)
|
||||
]
|
||||
|
||||
ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ regex "(hai m\x01b0\x01a1i|ba m\x01b0\x01a1i|b\x1ed1n m\x01b0\x01a1i|n\x0103m m\x01b0\x01a1i|s\x00e1u m\x01b0\x01a1i|b\x1ea3y m\x01b0\x01a1i|t\x00e1m m\x01b0\x01a1i|ch\x00edn m\x01b0\x01a1i)"
|
||||
[ regex "(hai mươi|ba mươi|bốn mươi|năm mươi|sáu mươi|bảy mươi|tám mươi|chín mươi)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -298,7 +298,7 @@ ruleNumerals = Rule
|
||||
{ name = "numbers 21 31 41 51 61 71 81 91"
|
||||
, pattern =
|
||||
[ oneOf [20, 30 .. 90]
|
||||
, regex "m\x1ed1t"
|
||||
, regex "mốt"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v + 1
|
||||
@ -309,7 +309,7 @@ ruleT :: Rule
|
||||
ruleT = Rule
|
||||
{ name = "tá"
|
||||
, pattern =
|
||||
[ regex "t\x00e1"
|
||||
[ regex "tá"
|
||||
]
|
||||
, prod = \_ -> integer 12 >>= withGrain 1 >>= withMultipliable
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ ruleInteger5 :: Rule
|
||||
ruleInteger5 = Rule
|
||||
{ name = "integer (0..10)"
|
||||
, pattern =
|
||||
[ regex "(\x3007|\x96f6|\x4e00|\x4e8c|\x4e24|\x5169|\x4e09|\x56db|\x4e94|\x516d|\x4e03|\x516b|\x4e5d|\x5341)(\x4e2a|\x500b)?"
|
||||
[ regex "(〇|零|一|二|两|兩|三|四|五|六|七|八|九|十)(个|個)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -39,20 +39,20 @@ ruleInteger5 = Rule
|
||||
|
||||
integerMap :: HashMap.HashMap Text.Text Integer
|
||||
integerMap = HashMap.fromList
|
||||
[ ( "\x3007", 0 )
|
||||
, ( "\x96f6", 0 )
|
||||
, ( "\x4e00", 1 )
|
||||
, ( "\x5169", 2 )
|
||||
, ( "\x4e24", 2 )
|
||||
, ( "\x4e8c", 2 )
|
||||
, ( "\x4e09", 3 )
|
||||
, ( "\x56db", 4 )
|
||||
, ( "\x4e94", 5 )
|
||||
, ( "\x516d", 6 )
|
||||
, ( "\x4e03", 7 )
|
||||
, ( "\x516b", 8 )
|
||||
, ( "\x4e5d", 9 )
|
||||
, ( "\x5341", 10 )
|
||||
[ ( "〇", 0 )
|
||||
, ( "零", 0 )
|
||||
, ( "一", 1 )
|
||||
, ( "兩", 2 )
|
||||
, ( "两", 2 )
|
||||
, ( "二", 2 )
|
||||
, ( "三", 3 )
|
||||
, ( "四", 4 )
|
||||
, ( "五", 5 )
|
||||
, ( "六", 6 )
|
||||
, ( "七", 7 )
|
||||
, ( "八", 8 )
|
||||
, ( "九", 9 )
|
||||
, ( "十", 10 )
|
||||
]
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ ruleNumeralsPrefixWithNegativeOrMinus :: Rule
|
||||
ruleNumeralsPrefixWithNegativeOrMinus = Rule
|
||||
{ name = "numbers prefix with -, negative or minus"
|
||||
, pattern =
|
||||
[ regex "-|\x8d1f\\s?|\x8ca0\\s?"
|
||||
[ regex "-|负\\s?|負\\s?"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -109,7 +109,7 @@ ruleNumeral = Rule
|
||||
{ name = "<number>个"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\x4e2a"
|
||||
, regex "个"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> Just token
|
||||
@ -121,7 +121,7 @@ ruleInteger3 = Rule
|
||||
{ name = "integer (20..90)"
|
||||
, pattern =
|
||||
[ numberBetween 2 10
|
||||
, regex "\x5341"
|
||||
, regex "十"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) -> double $ v * 10
|
||||
@ -164,7 +164,7 @@ ruleInteger2 :: Rule
|
||||
ruleInteger2 = Rule
|
||||
{ name = "integer (11..19)"
|
||||
, pattern =
|
||||
[ regex "\x5341"
|
||||
[ regex "十"
|
||||
, numberBetween 1 10
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -22,7 +22,7 @@ ruleOrdinalsTh :: Rule
|
||||
ruleOrdinalsTh = Rule
|
||||
{ name = "ordinals 7th"
|
||||
, pattern =
|
||||
[ regex "(\x0633\x0627\x0628\x0639 | \x0633\x0627\x0628\x0639\x0629 | \x0627\x0644\x0633\x0627\x0628\x0639 | \x0627\x0644\x0633\x0627\x0628\x0639\x0629)"
|
||||
[ regex "(سابع | سابعة | السابع | السابعة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 7
|
||||
}
|
||||
@ -31,7 +31,7 @@ ruleOrdinalsSecond :: Rule
|
||||
ruleOrdinalsSecond = Rule
|
||||
{ name = "ordinals second"
|
||||
, pattern =
|
||||
[ regex "(\x062b\x0627\x0646\x064a|\x062b\x0627\x0646\x064a\x0629|\x0627\x0644\x062b\x0627\x0646\x064a|\x0627\x0644\x062b\x0627\x0646\x064a\x0629)"
|
||||
[ regex "(ثاني|ثانية|الثاني|الثانية)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 2
|
||||
}
|
||||
@ -40,7 +40,7 @@ ruleOrdinalsFirst :: Rule
|
||||
ruleOrdinalsFirst = Rule
|
||||
{ name = "ordinals first"
|
||||
, pattern =
|
||||
[ regex "(\x0623\x0648\x0644|\x0627\x0644\x0623\x0648\x0644|\x0623\x0648\x0644\x0649|\x0627\x0644\x0623\x0648\x0644\x0649)"
|
||||
[ regex "(أول|الأول|أولى|الأولى)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 1
|
||||
}
|
||||
@ -49,7 +49,7 @@ ruleOrdinalsFirst5 :: Rule
|
||||
ruleOrdinalsFirst5 = Rule
|
||||
{ name = "ordinals first"
|
||||
, pattern =
|
||||
[ regex "(\x0633\x0627\x062f\x0633 | \x0633\x0627\x062f\x0633\x0629 | \x0627\x0644\x0633\x0627\x062f\x0633 | \x0627\x0644\x0633\x0627\x062f\x0633\x0629)"
|
||||
[ regex "(سادس | سادسة | السادس | السادسة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 6
|
||||
}
|
||||
@ -58,7 +58,7 @@ ruleOrdinalsTh2 :: Rule
|
||||
ruleOrdinalsTh2 = Rule
|
||||
{ name = "ordinals 8th"
|
||||
, pattern =
|
||||
[ regex "(\x062b\x0627\x0645\x0646 | \x062b\x0627\x0645\x0646\x0629 | \x0627\x0644\x062b\x0627\x0645\x0646 | \x0627\x0644\x062b\x0627\x0645\x0646\x0629)"
|
||||
[ regex "(ثامن | ثامنة | الثامن | الثامنة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 8
|
||||
}
|
||||
@ -67,7 +67,7 @@ ruleOrdinalsFirst2 :: Rule
|
||||
ruleOrdinalsFirst2 = Rule
|
||||
{ name = "ordinals first"
|
||||
, pattern =
|
||||
[ regex "(\x062b\x0627\x0644\x062b|\x062b\x0627\x0644\x062b\x0629|\x0627\x0644\x062b\x0627\x0644\x062b|\x0627\x0644\x062b\x0627\x0644\x062b\x0629)"
|
||||
[ regex "(ثالث|ثالثة|الثالث|الثالثة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 3
|
||||
}
|
||||
@ -76,7 +76,7 @@ ruleOrdinalsTh4 :: Rule
|
||||
ruleOrdinalsTh4 = Rule
|
||||
{ name = "ordinals 10th"
|
||||
, pattern =
|
||||
[ regex "(\x0639\x0627\x0634\x0631 | \x0639\x0627\x0634\x0631\x0629 | \x0627\x0644\x0639\x0627\x0634\x0631 | \x0627\x0644\x0639\x0627\x0634\x0631\x0629)"
|
||||
[ regex "(عاشر | عاشرة | العاشر | العاشرة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 10
|
||||
}
|
||||
@ -85,7 +85,7 @@ ruleOrdinalsTh3 :: Rule
|
||||
ruleOrdinalsTh3 = Rule
|
||||
{ name = "ordinals 9th"
|
||||
, pattern =
|
||||
[ regex "(\x062a\x0627\x0633\x0639 | \x062a\x0627\x0633\x0639\x0629 | \x0627\x0644\x062a\x0627\x0633\x0639 | \x0627\x0644\x062a\x0627\x0633\x0639\x0629)"
|
||||
[ regex "(تاسع | تاسعة | التاسع | التاسعة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 9
|
||||
}
|
||||
@ -94,7 +94,7 @@ ruleOrdinalsFirst4 :: Rule
|
||||
ruleOrdinalsFirst4 = Rule
|
||||
{ name = "ordinals first"
|
||||
, pattern =
|
||||
[ regex "(\x062e\x0627\x0645\x0633 | \x0627\x0644\x062e\x0627\x0645\x0633 | \x062e\x0627\x0645\x0633\x0629 | \x0627\x0644\x062e\x0627\x0645\x0633\x0629)"
|
||||
[ regex "(خامس | الخامس | خامسة | الخامسة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 5
|
||||
}
|
||||
@ -103,7 +103,7 @@ ruleOrdinalsFirst3 :: Rule
|
||||
ruleOrdinalsFirst3 = Rule
|
||||
{ name = "ordinals first"
|
||||
, pattern =
|
||||
[ regex "(\x0631\x0627\x0628\x0639|\x0631\x0627\x0628\x0639\x0629 | \x0627\x0644\x0631\x0627\x0628\x0639|\x0627\x0644\x0631\x0627\x0628\x0639\x0629)"
|
||||
[ regex "(رابع|رابعة | الرابع|الرابعة)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 4
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ ruleOrdinalsFirstst :: Rule
|
||||
ruleOrdinalsFirstst = Rule
|
||||
{ name = "ordinals (first..31st)"
|
||||
, pattern =
|
||||
[ regex "(f\x00f8rste|anden|tredje|fjerde|femte|sjette|syvende|ottende|niende|tiende|elfte|tolvte|trettende|fjortende|femtende|sekstende|syttende|attende|nittende|tyvende|tenogtyvende|toogtyvende|treogtyvende|fireogtyvende|femogtyvende|seksogtyvende|syvogtyvende|otteogtyvende|niogtyvende|tredivte|enogtredivte)"
|
||||
[ regex "(første|anden|tredje|fjerde|femte|sjette|syvende|ottende|niende|tiende|elfte|tolvte|trettende|fjortende|femtende|sekstende|syttende|attende|nittende|tyvende|tenogtyvende|toogtyvende|treogtyvende|fireogtyvende|femogtyvende|seksogtyvende|syvogtyvende|otteogtyvende|niogtyvende|tredivte|enogtredivte)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"f\x00f8rste" -> Just $ ordinal 1
|
||||
"første" -> Just $ ordinal 1
|
||||
"anden" -> Just $ ordinal 2
|
||||
"tredje" -> Just $ ordinal 3
|
||||
"fjerde" -> Just $ ordinal 4
|
||||
|
@ -26,7 +26,7 @@ ruleOrdinalsFirstth :: Rule
|
||||
ruleOrdinalsFirstth = Rule
|
||||
{ name = "ordinals (first..19th)"
|
||||
, pattern =
|
||||
[ regex "(erste(r|s)?|zweite(r|s)|dritte(r|s)|vierte(r|s)|fuenfte(r|s)|sechste(r|s)|siebte(r|s)|achte(r|s)|neunte(r|s)|zehnte(r|s)|elfter|zw\x00f6lfter|dreizenter|vierzehnter|f\x00fcnfzehnter|sechzenter|siebzehnter|achtzehnter|neunzehnter)"
|
||||
[ regex "(erste(r|s)?|zweite(r|s)|dritte(r|s)|vierte(r|s)|fuenfte(r|s)|sechste(r|s)|siebte(r|s)|achte(r|s)|neunte(r|s)|zehnte(r|s)|elfter|zwölfter|dreizenter|vierzehnter|fünfzehnter|sechzenter|siebzehnter|achtzehnter|neunzehnter)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -42,9 +42,9 @@ ruleOrdinalsFirstth = Rule
|
||||
"viertes" -> Just $ ordinal 4
|
||||
"vierte" -> Just $ ordinal 4
|
||||
"vierter" -> Just $ ordinal 4
|
||||
"f\x00fcnftes" -> Just $ ordinal 5
|
||||
"f\x00fcnfter" -> Just $ ordinal 5
|
||||
"f\x00fcnfte" -> Just $ ordinal 5
|
||||
"fünftes" -> Just $ ordinal 5
|
||||
"fünfter" -> Just $ ordinal 5
|
||||
"fünfte" -> Just $ ordinal 5
|
||||
"sechste" -> Just $ ordinal 6
|
||||
"sechstes" -> Just $ ordinal 6
|
||||
"sechster" -> Just $ ordinal 6
|
||||
@ -61,10 +61,10 @@ ruleOrdinalsFirstth = Rule
|
||||
"zehnter" -> Just $ ordinal 10
|
||||
"zehntes" -> Just $ ordinal 10
|
||||
"elfter" -> Just $ ordinal 11
|
||||
"zw\x00f6lfter" -> Just $ ordinal 12
|
||||
"zwölfter" -> Just $ ordinal 12
|
||||
"dreizehnter" -> Just $ ordinal 13
|
||||
"vierzehnter" -> Just $ ordinal 14
|
||||
"f\x00fcnfzehnter" -> Just $ ordinal 15
|
||||
"fünfzehnter" -> Just $ ordinal 15
|
||||
"sechzehnter" -> Just $ ordinal 16
|
||||
"siebzehnter" -> Just $ ordinal 17
|
||||
"achtzehnter" -> Just $ ordinal 18
|
||||
|
@ -50,13 +50,13 @@ ordinalsMap = HashMap.fromList
|
||||
, ( "sexto" , 6 )
|
||||
, ( "sexta" , 6 )
|
||||
, ( "sextas" , 6 )
|
||||
, ( "s\x00e9ptimas" , 7 )
|
||||
, ( "séptimas" , 7 )
|
||||
, ( "septimas" , 7 )
|
||||
, ( "s\x00e9ptima" , 7 )
|
||||
, ( "séptima" , 7 )
|
||||
, ( "septimos" , 7 )
|
||||
, ( "septima" , 7 )
|
||||
, ( "s\x00e9ptimo" , 7 )
|
||||
, ( "s\x00e9ptimos" , 7 )
|
||||
, ( "séptimo" , 7 )
|
||||
, ( "séptimos" , 7 )
|
||||
, ( "septimo" , 7 )
|
||||
, ( "octavas" , 8 )
|
||||
, ( "octavo" , 8 )
|
||||
@ -66,21 +66,21 @@ ordinalsMap = HashMap.fromList
|
||||
, ( "novena" , 9 )
|
||||
, ( "noveno" , 9 )
|
||||
, ( "novenas" , 9 )
|
||||
, ( "d\233cimos" , 10 )
|
||||
, ( "décimos" , 10 )
|
||||
, ( "decimo" , 10 )
|
||||
, ( "decimos" , 10 )
|
||||
, ( "d\233cimo" , 10 )
|
||||
, ( "décimo" , 10 )
|
||||
, ( "decimas" , 10 )
|
||||
, ( "d\233cima" , 10 )
|
||||
, ( "décima" , 10 )
|
||||
, ( "decima" , 10 )
|
||||
, ( "d\233cimas" , 10 )
|
||||
, ( "décimas" , 10 )
|
||||
]
|
||||
|
||||
ruleOrdinalsPrimero :: Rule
|
||||
ruleOrdinalsPrimero = Rule
|
||||
{ name = "ordinals (primero..10)"
|
||||
, pattern =
|
||||
[ regex "((primer|segund|cuart|quint|sext|s(e|\x00e9)ptim|octav|noven|d(e|\x00e9)cim)(os?|as?)|(prim|terc)er)"
|
||||
[ regex "((primer|segund|cuart|quint|sext|s[eé]ptim|octav|noven|d[eé]cim)(os?|as?)|(prim|terc)er)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -26,7 +26,7 @@ ruleOrdinalsFirstth :: Rule
|
||||
ruleOrdinalsFirstth = Rule
|
||||
{ name = "ordinals (first..19th)"
|
||||
, pattern =
|
||||
[ regex "(esimene|teine|kolmas|neljas|viies|kuues|seitsmes|kaheksas|\x00fcheksas|k\x00fcmnes|\x00fcheteistk\x00fcmnes|kaheteistk\x00fcmnes|kolmeteistk\x00fcmnes|neljateistk\x00fcmnes|viieteistk\x00fcmnes|kuueteistk\x00fcmnes|seitsmeteistk\x00fcmnes|kaheksateistk\x00fcmnes|\x00fcheksateistk\x00fcmnes)"
|
||||
[ regex "(esimene|teine|kolmas|neljas|viies|kuues|seitsmes|kaheksas|üheksas|kümnes|üheteistkümnes|kaheteistkümnes|kolmeteistkümnes|neljateistkümnes|viieteistkümnes|kuueteistkümnes|seitsmeteistkümnes|kaheksateistkümnes|üheksateistkümnes)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -38,17 +38,17 @@ ruleOrdinalsFirstth = Rule
|
||||
"kuues" -> Just $ ordinal 6
|
||||
"seitsmes" -> Just $ ordinal 7
|
||||
"kaheksas" -> Just $ ordinal 8
|
||||
"\x00fcheksas" -> Just $ ordinal 9
|
||||
"k\x00fcmnes" -> Just $ ordinal 10
|
||||
"\x00fcheteistk\x00fcmnes" -> Just $ ordinal 11
|
||||
"kaheteistk\x00fcmnes" -> Just $ ordinal 12
|
||||
"kolmeteistk\x00fcmnes" -> Just $ ordinal 13
|
||||
"neljateistk\x00fcmnes" -> Just $ ordinal 14
|
||||
"viieteistk\x00fcmnes" -> Just $ ordinal 15
|
||||
"kuueteistk\x00fcmnes" -> Just $ ordinal 16
|
||||
"seitsmeteistk\x00fcmnes" -> Just $ ordinal 17
|
||||
"kaheksateistk\x00fcmnes" -> Just $ ordinal 18
|
||||
"\x00fcheksateistk\x00fcmnes" -> Just $ ordinal 19
|
||||
"üheksas" -> Just $ ordinal 9
|
||||
"kümnes" -> Just $ ordinal 10
|
||||
"üheteistkümnes" -> Just $ ordinal 11
|
||||
"kaheteistkümnes" -> Just $ ordinal 12
|
||||
"kolmeteistkümnes" -> Just $ ordinal 13
|
||||
"neljateistkümnes" -> Just $ ordinal 14
|
||||
"viieteistkümnes" -> Just $ ordinal 15
|
||||
"kuueteistkümnes" -> Just $ ordinal 16
|
||||
"seitsmeteistkümnes" -> Just $ ordinal 17
|
||||
"kaheksateistkümnes" -> Just $ ordinal 18
|
||||
"üheksateistkümnes" -> Just $ ordinal 19
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
|
@ -27,48 +27,48 @@ import Duckling.Types
|
||||
|
||||
ruleOrdinalsPremierseiziemeMap :: HashMap Text Int
|
||||
ruleOrdinalsPremierseiziemeMap = HashMap.fromList
|
||||
[ ( "premi\x00e8re" , 1 )
|
||||
[ ( "première" , 1 )
|
||||
, ( "premiere" , 1 )
|
||||
, ( "premier" , 1 )
|
||||
, ( "deuxi\x00e8me" , 2 )
|
||||
, ( "deuxième" , 2 )
|
||||
, ( "deuxieme" , 2 )
|
||||
, ( "second" , 2 )
|
||||
, ( "seconde" , 2 )
|
||||
, ( "troisi\x00e8me" , 3 )
|
||||
, ( "troisième" , 3 )
|
||||
, ( "troisieme" , 3 )
|
||||
, ( "quatrieme" , 4 )
|
||||
, ( "quatri\x00e8me" , 4 )
|
||||
, ( "quatrième" , 4 )
|
||||
, ( "cinquieme" , 5 )
|
||||
, ( "cinqui\x00e8me" , 5 )
|
||||
, ( "sixi\x00e8me" , 6 )
|
||||
, ( "cinquième" , 5 )
|
||||
, ( "sixième" , 6 )
|
||||
, ( "sixieme" , 6 )
|
||||
, ( "septieme" , 7 )
|
||||
, ( "septi\x00e8me" , 7 )
|
||||
, ( "huiti\x00e8me" , 8 )
|
||||
, ( "septième" , 7 )
|
||||
, ( "huitième" , 8 )
|
||||
, ( "huitieme" , 8 )
|
||||
, ( "neuvieme" , 9 )
|
||||
, ( "neuvi\x00e8me" , 9 )
|
||||
, ( "dixi\x00e8me" , 10 )
|
||||
, ( "neuvième" , 9 )
|
||||
, ( "dixième" , 10 )
|
||||
, ( "dixieme" , 10 )
|
||||
, ( "onzi\x00e8me" , 11 )
|
||||
, ( "onzième" , 11 )
|
||||
, ( "onzieme" , 11 )
|
||||
, ( "douzieme" , 12 )
|
||||
, ( "douzi\x00e8me" , 12 )
|
||||
, ( "douzième" , 12 )
|
||||
, ( "treizieme" , 13 )
|
||||
, ( "treizi\x00e8me" , 13 )
|
||||
, ( "quatorzi\x00e8me", 14 )
|
||||
, ( "treizième" , 13 )
|
||||
, ( "quatorzième", 14 )
|
||||
, ( "quatorzieme" , 14 )
|
||||
, ( "quinzi\x00e8me" , 15 )
|
||||
, ( "quinzième" , 15 )
|
||||
, ( "quinzieme" , 15 )
|
||||
, ( "seizieme" , 16 )
|
||||
, ( "seizi\x00e8me" , 16 )
|
||||
, ( "seizième" , 16 )
|
||||
]
|
||||
|
||||
ruleOrdinalsPremierseizieme :: Rule
|
||||
ruleOrdinalsPremierseizieme = Rule
|
||||
{ name = "ordinals (premier..seizieme)"
|
||||
, pattern =
|
||||
[ regex "(premi(ere?|\x00e8re)|(deux|trois|quatr|cinqu|six|sept|huit|neuv|dix|onz|douz|treiz|quatorz|quinz|seiz)i(e|\x00e8)me|seconde?)"
|
||||
[ regex "(premi(ere?|ère)|(deux|trois|quatr|cinqu|six|sept|huit|neuv|dix|onz|douz|treiz|quatorz|quinz|seiz)i(e|è)me|seconde?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -80,7 +80,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "0*(\\d+) ?(ere?|\x00e8re|\x00e8me|eme|e)"
|
||||
[ regex "0*(\\d+) ?(ere?|ère|ème|eme|e)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> do
|
||||
|
@ -26,79 +26,79 @@ ruleOrdinalsChadDaraEtc :: Rule
|
||||
ruleOrdinalsChadDaraEtc = Rule
|
||||
{ name = "ordinals (chéad, dara, etc.)"
|
||||
, pattern =
|
||||
[ regex "(ch(\x00e9|e)ad|aon(\x00fa|u)|t-aon(\x00fa|u)|dara|tr(\x00ed|i)(\x00fa|u)|ceathr(\x00fa|u)|c(\x00fa|u)igi(\x00fa|u)|s(\x00e9|e)(\x00fa|u)|seacht(\x00fa|u)|ocht(\x00fa|u)|t-ocht(\x00fa|u)|nao(\x00fa|u)|deichi(\x00fa|u)|fichi(\x00fa|u)|tr(\x00ed|i)ochad(\x00fa|u)|daichead(\x00fa|u)|caogad(\x00fa|u)|seascad(\x00fa|u)|seacht(\x00f3|o)d(\x00fa|u)|ocht(\x00f3|o)d(\x00fa|u)|t-ocht(\x00f3|o)d(\x00fa|u)|n(\x00f3|o)chad(\x00fa|u)|c(\x00e9|e)ad(\x00fa|u)|mili(\x00fa|u)|milli(\x00fa|u)n(\x00fa|u))"
|
||||
[ regex "(ch(é|e)ad|aon(ú|u)|t-aon(ú|u)|dara|tr(í|i)(ú|u)|ceathr(ú|u)|c(ú|u)igi(ú|u)|s(é|e)(ú|u)|seacht(ú|u)|ocht(ú|u)|t-ocht(ú|u)|nao(ú|u)|deichi(ú|u)|fichi(ú|u)|tr(í|i)ochad(ú|u)|daichead(ú|u)|caogad(ú|u)|seascad(ú|u)|seacht(ó|o)d(ú|u)|ocht(ó|o)d(ú|u)|t-ocht(ó|o)d(ú|u)|n(ó|o)chad(ú|u)|c(é|e)ad(ú|u)|mili(ú|u)|milli(ú|u)n(ú|u))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"t-aonu" -> Just $ ordinal 1
|
||||
"aonu" -> Just $ ordinal 1
|
||||
"aon\x00fa" -> Just $ ordinal 1
|
||||
"ch\x00e9ad" -> Just $ ordinal 1
|
||||
"aonú" -> Just $ ordinal 1
|
||||
"chéad" -> Just $ ordinal 1
|
||||
"chead" -> Just $ ordinal 1
|
||||
"t-aon\x00fa" -> Just $ ordinal 1
|
||||
"t-aonú" -> Just $ ordinal 1
|
||||
"dara" -> Just $ ordinal 2
|
||||
"tri\x00fa" -> Just $ ordinal 3
|
||||
"tr\x00edu" -> Just $ ordinal 3
|
||||
"tr\x00ed\x00fa" -> Just $ ordinal 3
|
||||
"triú" -> Just $ ordinal 3
|
||||
"tríu" -> Just $ ordinal 3
|
||||
"tríú" -> Just $ ordinal 3
|
||||
"triu" -> Just $ ordinal 3
|
||||
"ceathr\x00fa" -> Just $ ordinal 4
|
||||
"ceathrú" -> Just $ ordinal 4
|
||||
"ceathru" -> Just $ ordinal 4
|
||||
"c\x00faigiu" -> Just $ ordinal 5
|
||||
"c\x00faigi\x00fa" -> Just $ ordinal 5
|
||||
"cúigiu" -> Just $ ordinal 5
|
||||
"cúigiú" -> Just $ ordinal 5
|
||||
"cuigiu" -> Just $ ordinal 5
|
||||
"cuigi\x00fa" -> Just $ ordinal 5
|
||||
"s\x00e9u" -> Just $ ordinal 6
|
||||
"s\x00e9\x00fa" -> Just $ ordinal 6
|
||||
"cuigiú" -> Just $ ordinal 5
|
||||
"séu" -> Just $ ordinal 6
|
||||
"séú" -> Just $ ordinal 6
|
||||
"seu" -> Just $ ordinal 6
|
||||
"se\x00fa" -> Just $ ordinal 6
|
||||
"seú" -> Just $ ordinal 6
|
||||
"seachtu" -> Just $ ordinal 7
|
||||
"seacht\x00fa" -> Just $ ordinal 7
|
||||
"t-ocht\x00fa" -> Just $ ordinal 8
|
||||
"seachtú" -> Just $ ordinal 7
|
||||
"t-ochtú" -> Just $ ordinal 8
|
||||
"ochtu" -> Just $ ordinal 8
|
||||
"t-ochtu" -> Just $ ordinal 8
|
||||
"ocht\x00fa" -> Just $ ordinal 8
|
||||
"ochtú" -> Just $ ordinal 8
|
||||
"naou" -> Just $ ordinal 9
|
||||
"nao\x00fa" -> Just $ ordinal 9
|
||||
"naoú" -> Just $ ordinal 9
|
||||
"deichiu" -> Just $ ordinal 10
|
||||
"deichi\x00fa" -> Just $ ordinal 10
|
||||
"deichiú" -> Just $ ordinal 10
|
||||
"fichiu" -> Just $ ordinal 20
|
||||
"fichi\x00fa" -> Just $ ordinal 20
|
||||
"tr\x00edochadu" -> Just $ ordinal 30
|
||||
"fichiú" -> Just $ ordinal 20
|
||||
"tríochadu" -> Just $ ordinal 30
|
||||
"triochadu" -> Just $ ordinal 30
|
||||
"tr\x00edochad\x00fa" -> Just $ ordinal 30
|
||||
"triochad\x00fa" -> Just $ ordinal 30
|
||||
"daichead\x00fa" -> Just $ ordinal 40
|
||||
"tríochadú" -> Just $ ordinal 30
|
||||
"triochadú" -> Just $ ordinal 30
|
||||
"daicheadú" -> Just $ ordinal 40
|
||||
"daicheadu" -> Just $ ordinal 40
|
||||
"caogadu" -> Just $ ordinal 50
|
||||
"caogad\x00fa" -> Just $ ordinal 50
|
||||
"caogadú" -> Just $ ordinal 50
|
||||
"seascadu" -> Just $ ordinal 60
|
||||
"seascad\x00fa" -> Just $ ordinal 60
|
||||
"seascadú" -> Just $ ordinal 60
|
||||
"seachtodu" -> Just $ ordinal 70
|
||||
"seachtod\x00fa" -> Just $ ordinal 70
|
||||
"seacht\x00f3d\x00fa" -> Just $ ordinal 70
|
||||
"seacht\x00f3du" -> Just $ ordinal 70
|
||||
"ocht\x00f3du" -> Just $ ordinal 80
|
||||
"seachtodú" -> Just $ ordinal 70
|
||||
"seachtódú" -> Just $ ordinal 70
|
||||
"seachtódu" -> Just $ ordinal 70
|
||||
"ochtódu" -> Just $ ordinal 80
|
||||
"ochtodu" -> Just $ ordinal 80
|
||||
"t-ochtodu" -> Just $ ordinal 80
|
||||
"t-ocht\x00f3d\x00fa" -> Just $ ordinal 80
|
||||
"t-ochtod\x00fa" -> Just $ ordinal 80
|
||||
"ocht\x00f3d\x00fa" -> Just $ ordinal 80
|
||||
"t-ocht\x00f3du" -> Just $ ordinal 80
|
||||
"ochtod\x00fa" -> Just $ ordinal 80
|
||||
"n\x00f3chad\x00fa" -> Just $ ordinal 90
|
||||
"n\x00f3chadu" -> Just $ ordinal 90
|
||||
"nochad\x00fa" -> Just $ ordinal 90
|
||||
"t-ochtódú" -> Just $ ordinal 80
|
||||
"t-ochtodú" -> Just $ ordinal 80
|
||||
"ochtódú" -> Just $ ordinal 80
|
||||
"t-ochtódu" -> Just $ ordinal 80
|
||||
"ochtodú" -> Just $ ordinal 80
|
||||
"nóchadú" -> Just $ ordinal 90
|
||||
"nóchadu" -> Just $ ordinal 90
|
||||
"nochadú" -> Just $ ordinal 90
|
||||
"nochadu" -> Just $ ordinal 90
|
||||
"c\x00e9ad\x00fa" -> Just $ ordinal 100
|
||||
"cead\x00fa" -> Just $ ordinal 100
|
||||
"céadú" -> Just $ ordinal 100
|
||||
"ceadú" -> Just $ ordinal 100
|
||||
"ceadu" -> Just $ ordinal 100
|
||||
"c\x00e9adu" -> Just $ ordinal 100
|
||||
"céadu" -> Just $ ordinal 100
|
||||
"miliu" -> Just $ ordinal 1000
|
||||
"mili\x00fa" -> Just $ ordinal 1000
|
||||
"milliun\x00fa" -> Just $ ordinal 1000000
|
||||
"miliú" -> Just $ ordinal 1000
|
||||
"milliunú" -> Just $ ordinal 1000000
|
||||
"milliunu" -> Just $ ordinal 1000000
|
||||
"milli\x00fanu" -> Just $ ordinal 1000000
|
||||
"milli\x00fan\x00fa" -> Just $ ordinal 1000000
|
||||
"milliúnu" -> Just $ ordinal 1000000
|
||||
"milliúnú" -> Just $ ordinal 1000000
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -107,7 +107,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "0*(\\d+) ?(adh|a|d|\x00fa|u)"
|
||||
[ regex "0*(\\d+) ?(adh|a|d|ú|u)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> ordinal <$> parseInt match
|
||||
|
@ -29,7 +29,7 @@ ruleOrdinal4 :: Rule
|
||||
ruleOrdinal4 = Rule
|
||||
{ name = "ordinal 4"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05e8\x05d1\x05e2\x05d4|\x05e8\x05d1\x05d9\x05e2\x05d9)"
|
||||
[ regex "(ארבעה|רביעי)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 4
|
||||
}
|
||||
@ -38,7 +38,7 @@ ruleOrdinal9 :: Rule
|
||||
ruleOrdinal9 = Rule
|
||||
{ name = "ordinal 9"
|
||||
, pattern =
|
||||
[ regex "(\x05ea\x05e9\x05e2\x05d4|\x05ea\x05e9\x05d9\x05e2\x05d9)"
|
||||
[ regex "(תשעה|תשיעי)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 9
|
||||
}
|
||||
@ -47,7 +47,7 @@ ruleOrdinal10 :: Rule
|
||||
ruleOrdinal10 = Rule
|
||||
{ name = "ordinal 10"
|
||||
, pattern =
|
||||
[ regex "(\x05e2\x05e9\x05e8\x05d4|\x05e2\x05e9\x05d9\x05e8\x05d9)"
|
||||
[ regex "(עשרה|עשירי)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 10
|
||||
}
|
||||
@ -56,7 +56,7 @@ ruleOrdinal12 :: Rule
|
||||
ruleOrdinal12 = Rule
|
||||
{ name = "ordinal 12"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05e0\x05d9\x05d9\x05dd \x05e2\x05e9\x05e8|\x05ea\x05e8\x05d9 \x05e2\x05e9\x05e8)"
|
||||
[ regex "(שניים עשר|תרי עשר)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 12
|
||||
}
|
||||
@ -65,7 +65,7 @@ ruleOrdinal17 :: Rule
|
||||
ruleOrdinal17 = Rule
|
||||
{ name = "ordinal 17"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05d1\x05e2(\x05d4)? \x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(שבע(ה)? עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 17
|
||||
}
|
||||
@ -74,7 +74,7 @@ ruleOrdinal18 :: Rule
|
||||
ruleOrdinal18 = Rule
|
||||
{ name = "ordinal 18"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05de\x05d5\x05e0\x05d4 \x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(שמונה עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 18
|
||||
}
|
||||
@ -94,7 +94,7 @@ ruleOrdinal15 :: Rule
|
||||
ruleOrdinal15 = Rule
|
||||
{ name = "ordinal 15"
|
||||
, pattern =
|
||||
[ regex "(\x05d7\x05de\x05d9\x05e9\x05d4 \x05e2\x05e9\x05e8|\x05d7\x05de\x05e9 \x05e2\x05e9\x05e8\x05d4?)"
|
||||
[ regex "(חמישה עשר|חמש עשרה?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 15
|
||||
}
|
||||
@ -103,7 +103,7 @@ ruleOrdinal5 :: Rule
|
||||
ruleOrdinal5 = Rule
|
||||
{ name = "ordinal 5"
|
||||
, pattern =
|
||||
[ regex "(\x05d7\x05de\x05d9\x05e9\x05d9|\x05d7\x05de\x05d9\x05e9\x05d4)"
|
||||
[ regex "(חמישי|חמישה)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 5
|
||||
}
|
||||
@ -112,7 +112,7 @@ ruleOrdinal16 :: Rule
|
||||
ruleOrdinal16 = Rule
|
||||
{ name = "ordinal 16"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05e9(\x05d4)? \x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(שש(ה)? עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 16
|
||||
}
|
||||
@ -121,7 +121,7 @@ ruleOrdinal14 :: Rule
|
||||
ruleOrdinal14 = Rule
|
||||
{ name = "ordinal 14"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05e8\x05d1\x05e2(\x05d4)? \x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(ארבע(ה)? עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 14
|
||||
}
|
||||
@ -130,18 +130,18 @@ ruleOrdinal20 :: Rule
|
||||
ruleOrdinal20 = Rule
|
||||
{ name = "ordinal 20..90"
|
||||
, pattern =
|
||||
[ regex "(\x05e2\x05e9\x05e8\x05d9\x05dd|\x05e9\x05dc\x05d5\x05e9\x05d9\x05dd|\x05d0\x05e8\x05d1\x05e2\x05d9\x05dd|\x05d7\x05de\x05d9\x05e9\x05d9\x05dd|\x05e9\x05d9\x05e9\x05d9\x05dd|\x05e9\x05d1\x05e2\x05d9\x05dd|\x05e9\x05de\x05d5\x05e0\x05d9\x05dd|\x05ea\x05e9\x05e2\x05d9\x05dd)"
|
||||
[ regex "(עשרים|שלושים|ארבעים|חמישים|שישים|שבעים|שמונים|תשעים)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x05e2\x05e9\x05e8\x05d9\x05dd" -> Just $ ordinal 20
|
||||
"\x05e9\x05dc\x05d5\x05e9\x05d9\x05dd" -> Just $ ordinal 30
|
||||
"\x05d0\x05e8\x05d1\x05e2\x05d9\x05dd" -> Just $ ordinal 40
|
||||
"\x05d7\x05de\x05d9\x05e9\x05d9\x05dd" -> Just $ ordinal 50
|
||||
"\x05e9\x05d9\x05e9\x05d9\x05dd" -> Just $ ordinal 60
|
||||
"\x05e9\x05d1\x05e2\x05d9\x05dd" -> Just $ ordinal 70
|
||||
"\x05e9\x05de\x05d5\x05e0\x05d9\x05dd" -> Just $ ordinal 80
|
||||
"\x05ea\x05e9\x05e2\x05d9\x05dd" -> Just $ ordinal 90
|
||||
"עשרים" -> Just $ ordinal 20
|
||||
"שלושים" -> Just $ ordinal 30
|
||||
"ארבעים" -> Just $ ordinal 40
|
||||
"חמישים" -> Just $ ordinal 50
|
||||
"שישים" -> Just $ ordinal 60
|
||||
"שבעים" -> Just $ ordinal 70
|
||||
"שמונים" -> Just $ ordinal 80
|
||||
"תשעים" -> Just $ ordinal 90
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -150,7 +150,7 @@ ruleOrdinal :: Rule
|
||||
ruleOrdinal = Rule
|
||||
{ name = "ordinal 1"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05d7\x05d3|\x05e8\x05d0\x05e9\x05d5\x05df)"
|
||||
[ regex "(אחד|ראשון)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 1
|
||||
}
|
||||
@ -159,7 +159,7 @@ ruleOrdinal13 :: Rule
|
||||
ruleOrdinal13 = Rule
|
||||
{ name = "ordinal 13"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05dc\x05d5\x05e9(\x05d4)? \x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(שלוש(ה)? עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 13
|
||||
}
|
||||
@ -168,7 +168,7 @@ ruleOrdinal7 :: Rule
|
||||
ruleOrdinal7 = Rule
|
||||
{ name = "ordinal 7"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05d1\x05e2\x05d4|\x05e9\x05d1\x05d9\x05e2\x05d9)"
|
||||
[ regex "(שבעה|שביעי)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 7
|
||||
}
|
||||
@ -177,7 +177,7 @@ ruleOrdinal8 :: Rule
|
||||
ruleOrdinal8 = Rule
|
||||
{ name = "ordinal 8"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05de\x05d5\x05e0\x05d4|\x05e9\x05de\x05d9\x05e0\x05d9)"
|
||||
[ regex "(שמונה|שמיני)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 8
|
||||
}
|
||||
@ -186,7 +186,7 @@ ruleOrdinal2 :: Rule
|
||||
ruleOrdinal2 = Rule
|
||||
{ name = "ordinal 2"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05ea\x05d9\x05d9\x05dd|\x05e9\x05e0\x05d9\x05d9\x05dd|\x05e9\x05e0\x05d9)"
|
||||
[ regex "(שתיים|שניים|שני)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 2
|
||||
}
|
||||
@ -195,7 +195,7 @@ ruleOrdinal11 :: Rule
|
||||
ruleOrdinal11 = Rule
|
||||
{ name = "ordinal 11"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05d7\x05d3 \x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(אחד עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 11
|
||||
}
|
||||
@ -204,7 +204,7 @@ ruleOrdinal3 :: Rule
|
||||
ruleOrdinal3 = Rule
|
||||
{ name = "ordinal 3"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05dc\x05d5\x05e9\x05d4|\x05e9\x05dc\x05d9\x05e9\x05d9)"
|
||||
[ regex "(שלושה|שלישי)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 3
|
||||
}
|
||||
@ -213,7 +213,7 @@ ruleOrdinal6 :: Rule
|
||||
ruleOrdinal6 = Rule
|
||||
{ name = "ordinal 6"
|
||||
, pattern =
|
||||
[ regex "(\x05e9\x05e9\x05d4|\x05e9\x05d9\x05e9\x05d9)"
|
||||
[ regex "(ששה|שישי)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 6
|
||||
}
|
||||
@ -222,7 +222,7 @@ ruleOrdinal19 :: Rule
|
||||
ruleOrdinal19 = Rule
|
||||
{ name = "ordinal 19"
|
||||
, pattern =
|
||||
[ regex "(\x05ea\x05e9\x05e2(\x05d4)? \x05e2\x05e9\x05e8(\x05d4)?)"
|
||||
[ regex "(תשע(ה)? עשר(ה)?)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 19
|
||||
}
|
||||
@ -232,7 +232,7 @@ ruleCompositeWithAnd = Rule
|
||||
{ name = "ordinal composition (with and)"
|
||||
, pattern =
|
||||
[ dimension Ordinal
|
||||
, regex "\x05d5"
|
||||
, regex "ו"
|
||||
, dimension Ordinal
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -152,7 +152,7 @@ ruleOrdinalsFirstth :: Rule
|
||||
ruleOrdinalsFirstth = Rule
|
||||
{ name = "ordinals (first..19th)"
|
||||
, pattern =
|
||||
[ regex "(prv(i|a|o(ga?)?)|drug(i|a|o(ga?)?)|tre(c|\x0107)(i|a|e(ga?)?)|(\x010d|c)etvrt(i|a|o(ga?)?)|pet(i|a|o(ga?)?)|(\x0161|s)est(i|a|o(ga?)?)|sedm(i|a|o(ga?)?)|osm(i|a|o(ga?)?)|devet(i|a|o(ga?)?)|deset(i|a|o(ga?)?)|jedanaest(i|a|o(ga?)?)|dvanaest(i|a|o(ga?)?)|trinaest(i|a|o(ga?)?)|(c|\x010d)etrnaest(i|a|o(ga?)?)|petnaest(i|a|o(ga?)?)|(s|\x0161)esnaest(i|a|o(ga?)?)|sedamnaest(i|a|o(ga?)?)|osamnaest(i|a|o(ga?)?)|devetnaest(i|a|o(ga?)?))"
|
||||
[ regex "(prv(i|a|o(ga?)?)|drug(i|a|o(ga?)?)|tre(c|ć)(i|a|e(ga?)?)|(č|c)etvrt(i|a|o(ga?)?)|pet(i|a|o(ga?)?)|(š|s)est(i|a|o(ga?)?)|sedm(i|a|o(ga?)?)|osm(i|a|o(ga?)?)|devet(i|a|o(ga?)?)|deset(i|a|o(ga?)?)|jedanaest(i|a|o(ga?)?)|dvanaest(i|a|o(ga?)?)|trinaest(i|a|o(ga?)?)|(c|č)etrnaest(i|a|o(ga?)?)|petnaest(i|a|o(ga?)?)|(s|š)esnaest(i|a|o(ga?)?)|sedamnaest(i|a|o(ga?)?)|osamnaest(i|a|o(ga?)?)|devetnaest(i|a|o(ga?)?))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -78,7 +78,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "0*(\\d+) ?(\x00aa|\x00b0|\x00b0)"
|
||||
[ regex "0*(\\d+) ?(ª|°|°)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> ordinal <$> parseInt match
|
||||
|
@ -25,7 +25,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "\x7b2c"
|
||||
[ regex "第"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -26,7 +26,7 @@ ruleOrdinals = Rule
|
||||
{ name = "ordinals (첫번째)"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "\xbc88\xc9f8|\xc9f8(\xbc88)?"
|
||||
, regex "번째|째(번)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral (NumeralData {TNumeral.value = v}):_) ->
|
||||
|
@ -26,18 +26,18 @@ ruleOrdinalsFirstst :: Rule
|
||||
ruleOrdinalsFirstst = Rule
|
||||
{ name = "ordinals (first..31st)"
|
||||
, pattern =
|
||||
[ regex "(f\x00f8rste|andre|tredje|fjerde|femtende|femte|sjette|syvende|\x00e5ttende|niende|tiende|ellevte|tolvte|trettende|fjortende|sekstende|syttende|attende|nittende|tyvende|tjuende|enogtyvende|toogtyvende|treogtyvende|fireogtyvende|femogtyvende|seksogtyvende|syvogtyvende|\x00e5tteogtyvende|niogtyvende|enogtjuende|toogtjuende|treogtjuende|fireogtjuende|femogtjuende|seksogtjuende|syvogtjuende|\x00e5tteogtyvend|niogtjuende|tredefte|enogtredefte)"
|
||||
[ regex "(første|andre|tredje|fjerde|femtende|femte|sjette|syvende|åttende|niende|tiende|ellevte|tolvte|trettende|fjortende|sekstende|syttende|attende|nittende|tyvende|tjuende|enogtyvende|toogtyvende|treogtyvende|fireogtyvende|femogtyvende|seksogtyvende|syvogtyvende|åtteogtyvende|niogtyvende|enogtjuende|toogtjuende|treogtjuende|fireogtjuende|femogtjuende|seksogtjuende|syvogtjuende|åtteogtyvend|niogtjuende|tredefte|enogtredefte)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"f\x00f8rste" -> Just $ ordinal 1
|
||||
"første" -> Just $ ordinal 1
|
||||
"andre" -> Just $ ordinal 2
|
||||
"tredje" -> Just $ ordinal 3
|
||||
"fjerde" -> Just $ ordinal 4
|
||||
"femte" -> Just $ ordinal 5
|
||||
"sjette" -> Just $ ordinal 6
|
||||
"syvende" -> Just $ ordinal 7
|
||||
"\x00e5ttende" -> Just $ ordinal 8
|
||||
"åttende" -> Just $ ordinal 8
|
||||
"niende" -> Just $ ordinal 9
|
||||
"tiende" -> Just $ ordinal 10
|
||||
"ellevte" -> Just $ ordinal 11
|
||||
@ -65,8 +65,8 @@ ruleOrdinalsFirstst = Rule
|
||||
"seksogtyvende" -> Just $ ordinal 26
|
||||
"syvogtyvende" -> Just $ ordinal 27
|
||||
"syvogtjuende" -> Just $ ordinal 27
|
||||
"\x00e5tteogtyvende" -> Just $ ordinal 28
|
||||
"\x00e5tteogtjuende" -> Just $ ordinal 28
|
||||
"åtteogtyvende" -> Just $ ordinal 28
|
||||
"åtteogtjuende" -> Just $ ordinal 28
|
||||
"niogtyvende" -> Just $ ordinal 29
|
||||
"niogtjuende" -> Just $ ordinal 29
|
||||
"tredefte" -> Just $ ordinal 30
|
||||
|
@ -27,7 +27,7 @@ ruleThOrdinalNoSpace :: Rule
|
||||
ruleThOrdinalNoSpace = Rule
|
||||
{ name = "24th ordinal no space"
|
||||
, pattern =
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|\x0105)|ej)czwart(y|ego|emu|ym|(a|\x0105)|ej)"
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|ą)|ej)czwart(y|ego|emu|ym|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 24
|
||||
}
|
||||
@ -36,7 +36,7 @@ ruleThOrdinal16 :: Rule
|
||||
ruleThOrdinal16 = Rule
|
||||
{ name = "31-39th ordinal"
|
||||
, pattern =
|
||||
[ regex "trzydziest(ym|y|ego|emu|(a|\x0105)|ej)( |-)?"
|
||||
[ regex "trzydziest(ym|y|ego|emu|(a|ą)|ej)( |-)?"
|
||||
, dimension Ordinal
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -49,7 +49,7 @@ ruleThOrdinal3 :: Rule
|
||||
ruleThOrdinal3 = Rule
|
||||
{ name = "10th ordinal"
|
||||
, pattern =
|
||||
[ regex "dziesi(a|\x0105)t(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "dziesi(a|ą)t(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 10
|
||||
}
|
||||
@ -69,7 +69,7 @@ ruleThOrdinal8 :: Rule
|
||||
ruleThOrdinal8 = Rule
|
||||
{ name = "15th ordinal"
|
||||
, pattern =
|
||||
[ regex "pi(e|\x0119)tnast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "pi(e|ę)tnast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 15
|
||||
}
|
||||
@ -78,7 +78,7 @@ ruleThOrdinal13 :: Rule
|
||||
ruleThOrdinal13 = Rule
|
||||
{ name = "20th ordinal"
|
||||
, pattern =
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 20
|
||||
}
|
||||
@ -87,7 +87,7 @@ ruleThOrdinal4 :: Rule
|
||||
ruleThOrdinal4 = Rule
|
||||
{ name = "11th ordinal"
|
||||
, pattern =
|
||||
[ regex "jedenast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "jedenast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 11
|
||||
}
|
||||
@ -96,7 +96,7 @@ ruleFifthOrdinal :: Rule
|
||||
ruleFifthOrdinal = Rule
|
||||
{ name = "fifth ordinal"
|
||||
, pattern =
|
||||
[ regex "pi(a|\x0105)t(y|ego|emu|m|(a|\x0105)|ej)"
|
||||
[ regex "pi(a|ą)t(y|ego|emu|m|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 5
|
||||
}
|
||||
@ -105,7 +105,7 @@ ruleThOrdinal11 :: Rule
|
||||
ruleThOrdinal11 = Rule
|
||||
{ name = "18th ordinal"
|
||||
, pattern =
|
||||
[ regex "osiemnast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "osiemnast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 18
|
||||
}
|
||||
@ -114,7 +114,7 @@ ruleSecondOrdinal :: Rule
|
||||
ruleSecondOrdinal = Rule
|
||||
{ name = "second ordinal"
|
||||
, pattern =
|
||||
[ regex "drugi?(ego|emu|m|(a|\x0105)|ej)?"
|
||||
[ regex "drugi?(ego|emu|m|(a|ą)|ej)?"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 2
|
||||
}
|
||||
@ -123,7 +123,7 @@ ruleNdOrdinalNoSpace :: Rule
|
||||
ruleNdOrdinalNoSpace = Rule
|
||||
{ name = "22nd ordinal no space"
|
||||
, pattern =
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|\x0105)|ej)drugi?(ego|emu|m|(a|\x0105)|ej)?"
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|ą)|ej)drugi?(ego|emu|m|(a|ą)|ej)?"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 22
|
||||
}
|
||||
@ -132,7 +132,7 @@ ruleSeventhOrdinal :: Rule
|
||||
ruleSeventhOrdinal = Rule
|
||||
{ name = "seventh ordinal"
|
||||
, pattern =
|
||||
[ regex "si(o|\x00f3)dm(y|ego|emu|m|(a|\x0105)|ej)"
|
||||
[ regex "si(o|ó)dm(y|ego|emu|m|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 7
|
||||
}
|
||||
@ -141,7 +141,7 @@ ruleStOrdinalNoSpace :: Rule
|
||||
ruleStOrdinalNoSpace = Rule
|
||||
{ name = "21st ordinal no space"
|
||||
, pattern =
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|\x0105)|ej)pierw?sz(y|ego|emu|m|(a|\x0105)|ej)"
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|ą)|ej)pierw?sz(y|ego|emu|m|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 21
|
||||
}
|
||||
@ -150,7 +150,7 @@ ruleThOrdinal7 :: Rule
|
||||
ruleThOrdinal7 = Rule
|
||||
{ name = "14th ordinal"
|
||||
, pattern =
|
||||
[ regex "czternast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "czternast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 14
|
||||
}
|
||||
@ -159,7 +159,7 @@ ruleThOrdinal2 :: Rule
|
||||
ruleThOrdinal2 = Rule
|
||||
{ name = "9th ordinal"
|
||||
, pattern =
|
||||
[ regex "dziewi(a|\x0105)t(ym|y|ego|em|emu|(a|\x0105)|ej)"
|
||||
[ regex "dziewi(a|ą)t(ym|y|ego|em|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 9
|
||||
}
|
||||
@ -168,7 +168,7 @@ ruleThOrdinal9 :: Rule
|
||||
ruleThOrdinal9 = Rule
|
||||
{ name = "16th ordinal"
|
||||
, pattern =
|
||||
[ regex "szesnast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "szesnast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 16
|
||||
}
|
||||
@ -177,7 +177,7 @@ ruleThOrdinal :: Rule
|
||||
ruleThOrdinal = Rule
|
||||
{ name = "8th ordinal"
|
||||
, pattern =
|
||||
[ regex "(o|\x00f3|\x00d3)sm(y|ego|emu|m|(a|\x0105)|ej)"
|
||||
[ regex "(o|ó|Ó)sm(y|ego|emu|m|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 8
|
||||
}
|
||||
@ -186,7 +186,7 @@ ruleThOrdinal14 :: Rule
|
||||
ruleThOrdinal14 = Rule
|
||||
{ name = "21-29th ordinal"
|
||||
, pattern =
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|\x0105)|ej)( |-)?"
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|ą)|ej)( |-)?"
|
||||
, dimension Ordinal
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -199,7 +199,7 @@ ruleThOrdinal10 :: Rule
|
||||
ruleThOrdinal10 = Rule
|
||||
{ name = "17th ordinal"
|
||||
, pattern =
|
||||
[ regex "siedemnast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "siedemnast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 17
|
||||
}
|
||||
@ -208,7 +208,7 @@ ruleRdOrdinalNoSpace :: Rule
|
||||
ruleRdOrdinalNoSpace = Rule
|
||||
{ name = "23rd ordinal no space"
|
||||
, pattern =
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|\x0105)|ej)trzeci(ego|ch|emu|m|mi|ej|(a|\x0105))?"
|
||||
[ regex "dwudziest(ym|y|ego|emu|(a|ą)|ej)trzeci(ego|ch|emu|m|mi|ej|(a|ą))?"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 23
|
||||
}
|
||||
@ -217,7 +217,7 @@ ruleThOrdinal5 :: Rule
|
||||
ruleThOrdinal5 = Rule
|
||||
{ name = "12th ordinal"
|
||||
, pattern =
|
||||
[ regex "dwunast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "dwunast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 12
|
||||
}
|
||||
@ -226,7 +226,7 @@ ruleThOrdinal6 :: Rule
|
||||
ruleThOrdinal6 = Rule
|
||||
{ name = "13th ordinal"
|
||||
, pattern =
|
||||
[ regex "trzynast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "trzynast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 13
|
||||
}
|
||||
@ -235,7 +235,7 @@ ruleFirstOrdinal :: Rule
|
||||
ruleFirstOrdinal = Rule
|
||||
{ name = "first ordinal"
|
||||
, pattern =
|
||||
[ regex "pierw?sz(y|ego|emu|m|(a|\x0105)|ej)"
|
||||
[ regex "pierw?sz(y|ego|emu|m|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 1
|
||||
}
|
||||
@ -244,7 +244,7 @@ ruleSixthOrdinal :: Rule
|
||||
ruleSixthOrdinal = Rule
|
||||
{ name = "sixth ordinal"
|
||||
, pattern =
|
||||
[ regex "sz(o|\x00f3)st(y|ego|emu|m|(a|\x0105)|ej)"
|
||||
[ regex "sz(o|ó)st(y|ego|emu|m|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 6
|
||||
}
|
||||
@ -253,7 +253,7 @@ ruleFourthOrdinal :: Rule
|
||||
ruleFourthOrdinal = Rule
|
||||
{ name = "fourth ordinal"
|
||||
, pattern =
|
||||
[ regex "czwart(y|ego|emu|ym|(a|\x0105)|ej)"
|
||||
[ regex "czwart(y|ego|emu|ym|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 4
|
||||
}
|
||||
@ -262,7 +262,7 @@ ruleThOrdinal15 :: Rule
|
||||
ruleThOrdinal15 = Rule
|
||||
{ name = "30th ordinal"
|
||||
, pattern =
|
||||
[ regex "trzydziest(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "trzydziest(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 30
|
||||
}
|
||||
@ -271,7 +271,7 @@ ruleThOrdinal12 :: Rule
|
||||
ruleThOrdinal12 = Rule
|
||||
{ name = "19th ordinal"
|
||||
, pattern =
|
||||
[ regex "dziewi(\x0119|e)tnast(ym|y|ego|emu|(a|\x0105)|ej)"
|
||||
[ regex "dziewi(ę|e)tnast(ym|y|ego|emu|(a|ą)|ej)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 19
|
||||
}
|
||||
@ -280,7 +280,7 @@ ruleThirdOrdinal :: Rule
|
||||
ruleThirdOrdinal = Rule
|
||||
{ name = "third ordinal"
|
||||
, pattern =
|
||||
[ regex "trzeci(ego|ch|emu|m|mi|ej|(a|\x0105))?"
|
||||
[ regex "trzeci(ego|ch|emu|m|mi|ej|(a|ą))?"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 3
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ ruleOrdinalsPrimeiro :: Rule
|
||||
ruleOrdinalsPrimeiro = Rule
|
||||
{ name = "ordinals (primeiro..10)"
|
||||
, pattern =
|
||||
[ regex "((primeir|segund|quart|quint|sext|s(e|\x00e9)tim|oitav|non|d(e|\x00e9)cim)(os?|as?))"
|
||||
[ regex "((primeir|segund|quart|quint|sext|s(e|é)tim|oitav|non|d(e|é)cim)(os?|as?))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
@ -54,13 +54,13 @@ ruleOrdinalsPrimeiro = Rule
|
||||
"sexta" -> Just $ ordinal 6
|
||||
"sextas" -> Just $ ordinal 6
|
||||
"setimas" -> Just $ ordinal 7
|
||||
"s\x00e9tima" -> Just $ ordinal 7
|
||||
"sétima" -> Just $ ordinal 7
|
||||
"setimo" -> Just $ ordinal 7
|
||||
"setimos" -> Just $ ordinal 7
|
||||
"setima" -> Just $ ordinal 7
|
||||
"s\x00e9timos" -> Just $ ordinal 7
|
||||
"s\x00e9timo" -> Just $ ordinal 7
|
||||
"s\x00e9timas" -> Just $ ordinal 7
|
||||
"sétimos" -> Just $ ordinal 7
|
||||
"sétimo" -> Just $ ordinal 7
|
||||
"sétimas" -> Just $ ordinal 7
|
||||
"oitavas" -> Just $ ordinal 8
|
||||
"oitava" -> Just $ ordinal 8
|
||||
"oitavo" -> Just $ ordinal 8
|
||||
@ -69,14 +69,14 @@ ruleOrdinalsPrimeiro = Rule
|
||||
"nona" -> Just $ ordinal 9
|
||||
"nono" -> Just $ ordinal 9
|
||||
"nonas" -> Just $ ordinal 9
|
||||
"d\x00e9cimos" -> Just $ ordinal 10
|
||||
"décimos" -> Just $ ordinal 10
|
||||
"decimo" -> Just $ ordinal 10
|
||||
"decimos" -> Just $ ordinal 10
|
||||
"d\x00e9cimo" -> Just $ ordinal 10
|
||||
"décimo" -> Just $ ordinal 10
|
||||
"decimas" -> Just $ ordinal 10
|
||||
"d\x00e9cima" -> Just $ ordinal 10
|
||||
"décima" -> Just $ ordinal 10
|
||||
"decima" -> Just $ ordinal 10
|
||||
"d\x00e9cimas" -> Just $ ordinal 10
|
||||
"décimas" -> Just $ ordinal 10
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ ordinalMap = HashMap.fromList
|
||||
, ("\537apte", 7)
|
||||
, ("opt", 8)
|
||||
, ("noua", 9)
|
||||
, ("nou\x0103", 9)
|
||||
, ("nouă", 9)
|
||||
]
|
||||
|
||||
ruleSpelledOutOrdinals :: Rule
|
||||
ruleSpelledOutOrdinals = Rule
|
||||
{ name = "spelled out ordinals"
|
||||
, pattern =
|
||||
[ regex "al?\\s(doi|trei|patru|cinci|(s|\x0219)a(s|pt)e|opt|nou(a|\x0103))[ -]?(le)?a"
|
||||
[ regex "al?\\s(doi|trei|patru|cinci|(s|ș)a(s|pt)e|opt|nou(a|ă))[ -]?(le)?a"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -27,30 +27,30 @@ ruleOrdinalsFirstth :: Rule
|
||||
ruleOrdinalsFirstth = Rule
|
||||
{ name = "ordinals (first..19th)"
|
||||
, pattern =
|
||||
[ regex "(\x043f\x0435\x0440\x0432|\x0432\x0442\x043e\x0440|\x0442\x0440\x0435\x0442|\x0447\x0435\x0442\x0432\x0435\x0440\x0442|\x043f\x044f\x0442|\x0448\x0435\x0441\x0442|\x0441\x0435\x0434\x044c\x043c|\x0432\x043e\x0441\x044c\x043c|\x0434\x0435\x0432\x044f\x0442|\x0434\x0435\x0441\x044f\x0442|\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x0430\x0442|\x0434\x0432\x0435\x043d\x0430\x0434\x0446\x0430\x0442|\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x0430\x0442|\x0447\x0435\x0442\x044b\x0440\x043d\x0430\x0434\x0446\x0430\x0442|\x043f\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442|\x0448\x0435\x0441\x0442\x043d\x0430\x0434\x0446\x0430\x0442|\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442|\x0432\x043e\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442|\x0434\x0435\x0432\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442|\x0434\x0432\x0430\x0434\x0446\x0430\x0442)(\x044b\x0439|\x043e\x0439|\x0438\x0439|\x0430\x044f|\x043e\x0435)"
|
||||
[ regex "(перв|втор|трет|четверт|пят|шест|седьм|восьм|девят|десят|одинадцат|двенадцат|тринадцат|четырнадцат|пятнадцат|шестнадцат|семнадцат|восемнадцат|девятнадцат|двадцат)(ый|ой|ий|ая|ое)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\x043f\x0435\x0440\x0432" -> Just $ ordinal 1
|
||||
"\x0432\x0442\x043e\x0440" -> Just $ ordinal 2
|
||||
"\x0442\x0440\x0435\x0442" -> Just $ ordinal 3
|
||||
"\x0447\x0435\x0442\x0432\x0435\x0440\x0442" -> Just $ ordinal 4
|
||||
"\x043f\x044f\x0442" -> Just $ ordinal 5
|
||||
"\x0448\x0435\x0441\x0442" -> Just $ ordinal 6
|
||||
"\x0441\x0435\x0434\x044c\x043c" -> Just $ ordinal 7
|
||||
"\x0432\x043e\x0441\x044c\x043c" -> Just $ ordinal 8
|
||||
"\x0434\x0435\x0432\x044f\x0442" -> Just $ ordinal 9
|
||||
"\x0434\x0435\x0441\x044f\x0442" -> Just $ ordinal 10
|
||||
"\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 11
|
||||
"\x0434\x0432\x0435\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 12
|
||||
"\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 13
|
||||
"\x0447\x0435\x0442\x044b\x0440\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 14
|
||||
"\x043f\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 15
|
||||
"\x0448\x0435\x0441\x0442\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 16
|
||||
"\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 17
|
||||
"\x0432\x043e\x0441\x0435\x043c\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 18
|
||||
"\x0434\x0435\x0432\x044f\x0442\x043d\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 19
|
||||
"\x0434\x0432\x0430\x0434\x0446\x0430\x0442" -> Just $ ordinal 20
|
||||
"перв" -> Just $ ordinal 1
|
||||
"втор" -> Just $ ordinal 2
|
||||
"трет" -> Just $ ordinal 3
|
||||
"четверт" -> Just $ ordinal 4
|
||||
"пят" -> Just $ ordinal 5
|
||||
"шест" -> Just $ ordinal 6
|
||||
"седьм" -> Just $ ordinal 7
|
||||
"восьм" -> Just $ ordinal 8
|
||||
"девят" -> Just $ ordinal 9
|
||||
"десят" -> Just $ ordinal 10
|
||||
"одинадцат" -> Just $ ordinal 11
|
||||
"двенадцат" -> Just $ ordinal 12
|
||||
"тринадцат" -> Just $ ordinal 13
|
||||
"четырнадцат" -> Just $ ordinal 14
|
||||
"пятнадцат" -> Just $ ordinal 15
|
||||
"шестнадцат" -> Just $ ordinal 16
|
||||
"семнадцат" -> Just $ ordinal 17
|
||||
"восемнадцат" -> Just $ ordinal 18
|
||||
"девятнадцат" -> Just $ ordinal 19
|
||||
"двадцат" -> Just $ ordinal 20
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -59,33 +59,33 @@ ruleOrdinal :: Rule
|
||||
ruleOrdinal = Rule
|
||||
{ name = "ordinal 21..99"
|
||||
, pattern =
|
||||
[ regex "(\x0434\x0432\x0430\x0434\x0446\x0430\x0442\x044c|\x0442\x0440\x0438\x0434\x0446\x0430\x0442\x044c|\x0441\x043e\x0440\x043e\x043a|\x043f\x044f\x0442\x044c\x0434\x0435\x0441\x044f\x0442|\x0448\x0435\x0441\x0442\x044c\x0434\x0435\x0441\x044f\x0442|\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442|\x0432\x043e\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442|\x0434\x0435\x0432\x044f\x043d\x043e\x0441\x0442\x043e)"
|
||||
, regex "(\x043f\x0435\x0440\x0432|\x0432\x0442\x043e\x0440|\x0442\x0440\x0435\x0442|\x0447\x0435\x0442\x0432\x0435\x0440\x0442|\x043f\x044f\x0442|\x0448\x0435\x0441\x0442|\x0441\x0435\x0434\x044c\x043c|\x0432\x043e\x0441\x044c\x043c|\x0434\x0435\x0432\x044f\x0442)(\x044b\x0439|\x043e\x0439|\x0438\x0439|\x0430\x044f|\x043e\x0435)"
|
||||
[ regex "(двадцать|тридцать|сорок|пятьдесят|шестьдесят|семьдесят|восемьдесят|девяносто)"
|
||||
, regex "(перв|втор|трет|четверт|пят|шест|седьм|восьм|девят)(ый|ой|ий|ая|ое)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (m1:_)):
|
||||
Token RegexMatch (GroupMatch (m2:_)):
|
||||
_) -> do
|
||||
dozen <- case Text.toLower m1 of
|
||||
"\x0434\x0432\x0430\x0434\x0446\x0430\x0442\x044c" -> Just 20
|
||||
"\x0442\x0440\x0438\x0434\x0446\x0430\x0442\x044c" -> Just 30
|
||||
"\x0441\x043e\x0440\x043e\x043a" -> Just 40
|
||||
"\x043f\x044f\x0442\x044c\x0434\x0435\x0441\x044f\x0442" -> Just 50
|
||||
"\x0448\x0435\x0441\x0442\x044c\x0434\x0435\x0441\x044f\x0442" -> Just 60
|
||||
"\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442" -> Just 70
|
||||
"\x0432\x043e\x0441\x0435\x043c\x044c\x0434\x0435\x0441\x044f\x0442" -> Just 80
|
||||
"\x0434\x0435\x0432\x044f\x043d\x043e\x0441\x0442\x043e" -> Just 90
|
||||
"двадцать" -> Just 20
|
||||
"тридцать" -> Just 30
|
||||
"сорок" -> Just 40
|
||||
"пятьдесят" -> Just 50
|
||||
"шестьдесят" -> Just 60
|
||||
"семьдесят" -> Just 70
|
||||
"восемьдесят" -> Just 80
|
||||
"девяносто" -> Just 90
|
||||
_ -> Nothing
|
||||
unit <- case Text.toLower m2 of
|
||||
"\x043f\x0435\x0440\x0432" -> Just 1
|
||||
"\x0432\x0442\x043e\x0440" -> Just 2
|
||||
"\x0442\x0440\x0435\x0442" -> Just 3
|
||||
"\x0447\x0435\x0442\x0432\x0435\x0440\x0442" -> Just 4
|
||||
"\x043f\x044f\x0442" -> Just 5
|
||||
"\x0448\x0435\x0441\x0442" -> Just 6
|
||||
"\x0441\x0435\x0434\x044c\x043c" -> Just 7
|
||||
"\x0432\x043e\x0441\x044c\x043c" -> Just 8
|
||||
"\x0434\x0435\x0432\x044f\x0442" -> Just 9
|
||||
"перв" -> Just 1
|
||||
"втор" -> Just 2
|
||||
"трет" -> Just 3
|
||||
"четверт" -> Just 4
|
||||
"пят" -> Just 5
|
||||
"шест" -> Just 6
|
||||
"седьм" -> Just 7
|
||||
"восьм" -> Just 8
|
||||
"девят" -> Just 9
|
||||
_ -> Nothing
|
||||
Just . ordinal $ dozen + unit
|
||||
_ -> Nothing
|
||||
@ -95,7 +95,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "0*(\\d+)-?((\x044b|\x043e|\x0438)?\x0439|\x0430\x044f|\x043e\x0435)"
|
||||
[ regex "0*(\\d+)-?((ы|о|и)?й|ая|ое)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> ordinal <$> parseInt match
|
||||
|
@ -28,16 +28,16 @@ import Duckling.Types
|
||||
|
||||
ordinalsMap :: HashMap Text Int
|
||||
ordinalsMap = HashMap.fromList
|
||||
[ ( "f\x00f6rsta", 1 )
|
||||
, ( "f\x00f6rste", 1 )
|
||||
[ ( "första", 1 )
|
||||
, ( "förste", 1 )
|
||||
, ( "andra", 2 )
|
||||
, ( "andre", 2)
|
||||
, ( "tredje", 3 )
|
||||
, ( "fj\x00e4rde", 4 )
|
||||
, ( "fjärde", 4 )
|
||||
, ( "femte", 5 )
|
||||
, ( "sj\x00e4tte", 6 )
|
||||
, ( "sjätte", 6 )
|
||||
, ( "sjunde", 7 )
|
||||
, ( "\x00e5ttonde", 8 )
|
||||
, ( "åttonde", 8 )
|
||||
, ( "nionde", 9 )
|
||||
, ( "tionde", 10 )
|
||||
, ( "elfte", 11 )
|
||||
@ -55,7 +55,7 @@ ordinalsMap = HashMap.fromList
|
||||
, ( "femtionde", 50 )
|
||||
, ( "sextionde", 60 )
|
||||
, ( "sjuttionde", 70 )
|
||||
, ( "\x00e5ttionde", 80 )
|
||||
, ( "åttionde", 80 )
|
||||
, ( "nittionde", 90 )
|
||||
]
|
||||
|
||||
@ -67,7 +67,7 @@ cardinalsMap = HashMap.fromList
|
||||
, ( "femtio", 50 )
|
||||
, ( "sextio", 60 )
|
||||
, ( "sjuttio", 70 )
|
||||
, ( "\x00e5ttio", 80 )
|
||||
, ( "åttio", 80 )
|
||||
, ( "nittio", 90 )
|
||||
]
|
||||
|
||||
@ -75,7 +75,7 @@ ruleOrdinals :: Rule
|
||||
ruleOrdinals = Rule
|
||||
{ name = "ordinals (first..twentieth,thirtieth,...)"
|
||||
, pattern =
|
||||
[ regex "(f\x00f6rsta|f\x00f6rste|andra|andre|tredje|fj\x00e4rde|femte|sj\x00e4tte|sjunde|\x00e5ttonde|nionde|tionde|elfte|tolfte|trettionde|fjortonde|femtonde|sextonde|sjuttonde|artonde|nittonde|tjugonde|trettionde|fyrtionde|femtonde|sextionde|sjuttionde|\x00e5ttionde|nittionde)"
|
||||
[ regex "(första|förste|andra|andre|tredje|fjärde|femte|sjätte|sjunde|åttonde|nionde|tionde|elfte|tolfte|trettionde|fjortonde|femtonde|sextonde|sjuttonde|artonde|nittonde|tjugonde|trettionde|fyrtionde|femtonde|sextionde|sjuttionde|åttionde|nittionde)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -87,7 +87,7 @@ ruleCompositeOrdinals :: Rule
|
||||
ruleCompositeOrdinals = Rule
|
||||
{ name = "ordinals (composite, e.g., eighty-seven)"
|
||||
, pattern =
|
||||
[ regex "(tjugo|trettio|fyrtio|femtio|sextio|sjuttio|\x00e5ttio|nittio)(f\x00f6rsta|f\x00f6rste|andra|andre|tredje|fj\x00e4rde|femte|sj\x00e4tte|sjunde|\x00e5ttonde|nionde)"
|
||||
[ regex "(tjugo|trettio|fyrtio|femtio|sextio|sjuttio|åttio|nittio)(första|förste|andra|andre|tredje|fjärde|femte|sjätte|sjunde|åttonde|nionde)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (tens:units:_)):_) -> do
|
||||
|
@ -29,30 +29,30 @@ ordinals :: [Text]
|
||||
ordinals =
|
||||
[ "birinci"
|
||||
, "ikinci"
|
||||
, "\x00fc\x00e7\x00fcnc\x00fc"
|
||||
, "d\x00f6rd\x00fcnc\x00fc"
|
||||
, "be\x015finci"
|
||||
, "alt\x0131nc\x0131"
|
||||
, "üçüncü"
|
||||
, "dördüncü"
|
||||
, "beşinci"
|
||||
, "altıncı"
|
||||
, "yedinci"
|
||||
, "sekizinci"
|
||||
, "dokuzuncu"
|
||||
, "onuncu"
|
||||
, "on birinci"
|
||||
, "on ikinci"
|
||||
, "on \x00fc\x00e7\x00fcnc\x00fc"
|
||||
, "on d\x00f6rd\x00fcnc\x00fc"
|
||||
, "on be\x015finci"
|
||||
, "on alt\x0131nc\x0131"
|
||||
, "on üçüncü"
|
||||
, "on dördüncü"
|
||||
, "on beşinci"
|
||||
, "on altıncı"
|
||||
, "on yedinci"
|
||||
, "on sekizinci"
|
||||
, "on dokuzuncu"
|
||||
, "yirminci"
|
||||
, "yirmi birinci"
|
||||
, "yirmi ikinci"
|
||||
, "yirmi \x00fc\x00e7\x00fcnc\x00fc"
|
||||
, "yirmi d\x00f6rd\x00fcnc\x00fc"
|
||||
, "yirmi be\x015finci"
|
||||
, "yirmi alt\x0131nc\x0131"
|
||||
, "yirmi üçüncü"
|
||||
, "yirmi dördüncü"
|
||||
, "yirmi beşinci"
|
||||
, "yirmi altıncı"
|
||||
, "yirmi yedinci"
|
||||
, "yirmi sekizinci"
|
||||
, "yirmi dokuzuncu"
|
||||
@ -80,7 +80,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "0*(\\d+) ?('?)(inci|nci|\x0131nc\x0131|nc\x0131|uncu|ncu|\x00fcnc\x00fc|nc\x00fc|.)"
|
||||
[ regex "0*(\\d+) ?('?)(inci|nci|ıncı|ncı|uncu|ncu|üncü|ncü|.)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
|
@ -28,33 +28,33 @@ import Duckling.Types
|
||||
|
||||
ordinalsFirstThMap :: HashMap Text Int
|
||||
ordinalsFirstThMap = HashMap.fromList
|
||||
[ ( "\x043f\x0435\x0440\x0448" , 1 )
|
||||
, ( "\x0434\x0440\x0443\x0433" , 2 )
|
||||
, ( "\x0442\x0440\x0435\x0442" , 3 )
|
||||
, ( "\x0447\x0435\x0442\x0432\x0435\x0440\x0442" , 4 )
|
||||
, ( "\x043f\x2018\x044f\x0442" , 5 )
|
||||
, ( "\x0448\x043e\x0441\x0442" , 6 )
|
||||
, ( "\x0441\x044c\x043e\x043c" , 7 )
|
||||
, ( "\x0432\x043e\x0441\x044c\x043c" , 8 )
|
||||
, ( "\x0434\x0435\x0432\x2018\x044f\x0442" , 9 )
|
||||
, ( "\x0434\x0435\x0441\x044f\x0442" , 10 )
|
||||
, ( "\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x044f\x0442" , 11 )
|
||||
, ( "\x0434\x0432\x0430\x043d\x0430\x0434\x0446\x044f\x0442" , 12 )
|
||||
, ( "\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x044f\x0442" , 13 )
|
||||
, ( "\x0447\x043e\x0442\x0438\x0440\x043d\x0430\x0434\x0446\x044f\x0442" , 14 )
|
||||
, ( "\x043f\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442" , 15 )
|
||||
, ( "\x0448\x0456\x0441\x0442\x043d\x0430\x0434\x0446\x044f\x0442" , 16 )
|
||||
, ( "\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442" , 17 )
|
||||
, ( "\x0432\x0456\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442" , 18 )
|
||||
, ( "\x0434\x0435\x0432\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442" , 19 )
|
||||
, ( "\x0434\x0432\x0430\x0434\x0446\x044f\x0442" , 20 )
|
||||
[ ( "перш" , 1 )
|
||||
, ( "друг" , 2 )
|
||||
, ( "трет" , 3 )
|
||||
, ( "четверт" , 4 )
|
||||
, ( "п‘ят" , 5 )
|
||||
, ( "шост" , 6 )
|
||||
, ( "сьом" , 7 )
|
||||
, ( "восьм" , 8 )
|
||||
, ( "дев‘ят" , 9 )
|
||||
, ( "десят" , 10 )
|
||||
, ( "одинадцят" , 11 )
|
||||
, ( "дванадцят" , 12 )
|
||||
, ( "тринадцят" , 13 )
|
||||
, ( "чотирнадцят" , 14 )
|
||||
, ( "п‘ятнадцят" , 15 )
|
||||
, ( "шістнадцят" , 16 )
|
||||
, ( "сімнадцят" , 17 )
|
||||
, ( "вісімнадцят" , 18 )
|
||||
, ( "дев‘ятнадцят" , 19 )
|
||||
, ( "двадцят" , 20 )
|
||||
]
|
||||
|
||||
ruleOrdinalsFirstth :: Rule
|
||||
ruleOrdinalsFirstth = Rule
|
||||
{ name = "ordinals (first..19th)"
|
||||
, pattern =
|
||||
[ regex "(\x043f\x0435\x0440\x0448|\x0434\x0440\x0443\x0433|\x0442\x0440\x0435\x0442|\x0447\x0435\x0442\x0432\x0435\x0440\x0442|\x043f\x2018\x044f\x0442|\x0448\x043e\x0441\x0442|\x0441\x044c\x043e\x043c|\x0432\x043e\x0441\x044c\x043c|\x0434\x0435\x0432\x2018\x044f\x0442|\x0434\x0435\x0441\x044f\x0442|\x043e\x0434\x0438\x043d\x0430\x0434\x0446\x044f\x0442|\x0434\x0432\x0430\x043d\x0430\x0434\x0446\x044f\x0442|\x0442\x0440\x0438\x043d\x0430\x0434\x0446\x044f\x0442|\x0447\x043e\x0442\x0438\x0440\x043d\x0430\x0434\x0446\x044f\x0442|\x043f\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442|\x0448\x0456\x0441\x0442\x043d\x0430\x0434\x0446\x044f\x0442|\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442|\x0432\x0456\x0441\x0456\x043c\x043d\x0430\x0434\x0446\x044f\x0442|\x0434\x0435\x0432\x2018\x044f\x0442\x043d\x0430\x0434\x0446\x044f\x0442|\x0434\x0432\x0430\x0434\x0446\x044f\x0442)(\x0438\x0439|\x0456\x0439|\x0430|\x044f|\x0435|\x0454)"
|
||||
[ regex "(перш|друг|трет|четверт|п‘ят|шост|сьом|восьм|дев‘ят|десят|одинадцят|дванадцят|тринадцят|чотирнадцят|п‘ятнадцят|шістнадцят|сімнадцят|вісімнадцят|дев‘ятнадцят|двадцят)(ий|ій|а|я|е|є)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
@ -64,22 +64,22 @@ ruleOrdinalsFirstth = Rule
|
||||
|
||||
ordinalTensMap :: HashMap Text Int
|
||||
ordinalTensMap = HashMap.fromList
|
||||
[ ( "\x0434\x0432\x0430\x0434\x0446\x044f\x0442\x044c" , 20 )
|
||||
, ( "\x0442\x0440\x0438\x0434\x0446\x044f\x0442\x044c" , 30 )
|
||||
, ( "\x0441\x043e\x0440\x043e\x043a" , 40 )
|
||||
, ( "\x043f\x2018\x044f\x0442\x0434\x0435\x0441\x044f\x0442" , 50 )
|
||||
, ( "\x0448\x0456\x0441\x0442\x0434\x0435\x0441\x044f\x0442" , 60 )
|
||||
, ( "\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442" , 70 )
|
||||
, ( "\x0432\x0456\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442" , 80 )
|
||||
, ( "\x0434\x0435\x0432\x2018\x044f\x043d\x043e\x0441\x0442\x043e" , 90 )
|
||||
[ ( "двадцять" , 20 )
|
||||
, ( "тридцять" , 30 )
|
||||
, ( "сорок" , 40 )
|
||||
, ( "п‘ятдесят" , 50 )
|
||||
, ( "шістдесят" , 60 )
|
||||
, ( "сімдесят" , 70 )
|
||||
, ( "вісімдесят" , 80 )
|
||||
, ( "дев‘яносто" , 90 )
|
||||
]
|
||||
|
||||
ruleOrdinal :: Rule
|
||||
ruleOrdinal = Rule
|
||||
{ name = "ordinal 21..99"
|
||||
, pattern =
|
||||
[ regex "(\x0434\x0432\x0430\x0434\x0446\x044f\x0442\x044c|\x0442\x0440\x0438\x0434\x0446\x044f\x0442\x044c|\x0441\x043e\x0440\x043e\x043a|\x043f\x2018\x044f\x0442\x0434\x0435\x0441\x044f\x0442|\x0448\x0456\x0441\x0442\x044c\x0434\x0435\x0441\x044f\x0442|\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442|\x0432\x0456\x0441\x0456\x043c\x0434\x0435\x0441\x044f\x0442|\x0434\x0435\x0432\x2018\x044f\x043d\x043e\x0441\x0442\x043e)"
|
||||
, regex "(\x043f\x0435\x0440\x0448|\x0434\x0440\x0443\x0433|\x0442\x0440\x0435\x0442|\x0447\x0435\x0442\x0432\x0435\x0440\x0442|\x043f\x2018\x044f\x0442|\x0448\x043e\x0441\x0442|\x0441\x044c\x043e\x043c|\x0432\x043e\x0441\x044c\x043c|\x0434\x0435\x0432\x2018\x044f\x0442)(\x0438\x0439|\x0456\x0439|\x0430|\x044f|\x0435|\x0454)"
|
||||
[ regex "(двадцять|тридцять|сорок|п‘ятдесят|шістьдесят|сімдесят|вісімдесят|дев‘яносто)"
|
||||
, regex "(перш|друг|трет|четверт|п‘ят|шост|сьом|восьм|дев‘ят)(ий|ій|а|я|е|є)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (m1:_)):
|
||||
@ -95,7 +95,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "0*(\\d+)-?((\x0438|\x0456)?\x0439|\x0430|\x044f|\x0435|\x0454)"
|
||||
[ regex "0*(\\d+)-?((и|і)?й|а|я|е|є)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> ordinal <$> parseInt match
|
||||
|
@ -22,7 +22,7 @@ ruleOrdinals :: Rule
|
||||
ruleOrdinals = Rule
|
||||
{ name = "ordinals"
|
||||
, pattern =
|
||||
[ regex "(\x0111\x1ea7u ti\x00ean|th\x1ee9 nh\x1ea5t|th\x1ee9 1)"
|
||||
[ regex "(đầu tiên|thứ nhất|thứ 1)"
|
||||
]
|
||||
, prod = \_ -> Just $ ordinal 1
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ ruleOrdinalDigits :: Rule
|
||||
ruleOrdinalDigits = Rule
|
||||
{ name = "ordinal (digits)"
|
||||
, pattern =
|
||||
[ regex "\x7b2c"
|
||||
[ regex "第"
|
||||
, dimension Numeral
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -29,7 +29,7 @@ ruleNumeralUnits = Rule
|
||||
{ name = "<number> <units>"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "(tasses?|cuill?(e|\x00e8)res? (a|\x00e0) soupe?)"
|
||||
, regex "(tasses?|cuill?(e|è)res? (a|à) soupe?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral NumeralData {TNumeral.value = v}:
|
||||
@ -46,7 +46,7 @@ ruleQuantityOfProduct = Rule
|
||||
{ name = "<quantity> of product"
|
||||
, pattern =
|
||||
[ dimension Quantity
|
||||
, regex "de (caf(e|\x00e9)|sucre)"
|
||||
, regex "de (caf(e|é)|sucre)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Quantity qd:
|
||||
|
@ -28,7 +28,7 @@ ruleQuantityOfProduct = Rule
|
||||
{ name = "<quantity> of product"
|
||||
, pattern =
|
||||
[ dimension Quantity
|
||||
, regex "\xc758 (\xc0bc\xacb9\xc0b4|\xcf5c\xb77c)"
|
||||
, regex "의 (삼겹살|콜라)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Quantity qd:
|
||||
@ -41,7 +41,7 @@ ruleQuantityOfProduct2 :: Rule
|
||||
ruleQuantityOfProduct2 = Rule
|
||||
{ name = "<quantity> of product"
|
||||
, pattern =
|
||||
[ regex "(\xc0bc\xacb9\xc0b4|\xcf5c\xb77c)"
|
||||
[ regex "(삼겹살|콜라)"
|
||||
, dimension Quantity
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -56,22 +56,22 @@ ruleNumeralUnits = Rule
|
||||
{ name = "<number> <units>"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "(\xac1c|\xd310|\xadf8(\xb7a8|\xb78c)|\xadfc|\xd30c\xc6b4(\xb4dc|\xc988)|\xc8111\xc2dc|\xadf8\xb987|\xcef5)"
|
||||
, regex "(개|판|그(램|람)|근|파운(드|즈)|접1시|그릇|컵)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral NumeralData {TNumeral.value = v}:
|
||||
Token RegexMatch (GroupMatch (match:_)):
|
||||
_) -> case match of
|
||||
"\xac1c" -> Just . Token Quantity $ quantity TQuantity.Unnamed v
|
||||
"\xd310" -> Just . Token Quantity $ quantity (TQuantity.Custom "판") v
|
||||
"\xadfc" -> Just . Token Quantity $ quantity (TQuantity.Custom "근") v
|
||||
"\xadf8\xb7a8" -> Just . Token Quantity $ quantity TQuantity.Gram v
|
||||
"\xadf8\xb78c" -> Just . Token Quantity $ quantity TQuantity.Gram v
|
||||
"\xd30c\xc6b4\xb4dc" -> Just . Token Quantity $ quantity TQuantity.Pound v
|
||||
"\xd30c\xc6b4\xc988" -> Just . Token Quantity $ quantity TQuantity.Pound v
|
||||
"\xc8111\xc2dc" -> Just . Token Quantity $ quantity TQuantity.Dish v
|
||||
"\xadf8\xb987" -> Just . Token Quantity $ quantity TQuantity.Bowl v
|
||||
"\xcef5" -> Just . Token Quantity $ quantity TQuantity.Cup v
|
||||
"개" -> Just . Token Quantity $ quantity TQuantity.Unnamed v
|
||||
"판" -> Just . Token Quantity $ quantity (TQuantity.Custom "판") v
|
||||
"근" -> Just . Token Quantity $ quantity (TQuantity.Custom "근") v
|
||||
"그램" -> Just . Token Quantity $ quantity TQuantity.Gram v
|
||||
"그람" -> Just . Token Quantity $ quantity TQuantity.Gram v
|
||||
"파운드" -> Just . Token Quantity $ quantity TQuantity.Pound v
|
||||
"파운즈" -> Just . Token Quantity $ quantity TQuantity.Pound v
|
||||
"접1시" -> Just . Token Quantity $ quantity TQuantity.Dish v
|
||||
"그릇" -> Just . Token Quantity $ quantity TQuantity.Bowl v
|
||||
"컵" -> Just . Token Quantity $ quantity TQuantity.Cup v
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ ruleQuantityOfProduct = Rule
|
||||
{ name = "<quantity> of product"
|
||||
, pattern =
|
||||
[ dimension Quantity
|
||||
, regex "de (caf(e|\x00e9)|a(\x00e7|c)ucar)"
|
||||
, regex "de (caf(e|é)|a(ç|c)ucar)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Quantity qd:
|
||||
|
@ -28,7 +28,7 @@ ruleNumeralUnits = Rule
|
||||
{ name = "<number> <units>"
|
||||
, pattern =
|
||||
[ dimension Numeral
|
||||
, regex "livr(a|e|\x0103)"
|
||||
, regex "livr(a|e|ă)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Numeral NumeralData {TNumeral.value = v}:_) ->
|
||||
@ -41,7 +41,7 @@ ruleQuantityOfProduct = Rule
|
||||
{ name = "<quantity> of product"
|
||||
, pattern =
|
||||
[ dimension Quantity
|
||||
, regex "de (carne|can(a|\x0103)|zah(a|\x0103)r)"
|
||||
, regex "de (carne|can(a|ă)|zah(a|ă)r)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Quantity qd:
|
||||
|
@ -26,7 +26,7 @@ ruleLatentTempTemp = Rule
|
||||
{ name = "<latent temp> temp"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(grados?)|\x00b0"
|
||||
, regex "(grados?)|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -39,7 +39,7 @@ ruleTempCelsius = Rule
|
||||
{ name = "<temp> Celsius"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(cent(i|\x00ed)grados?|c(el[cs]?(ius)?)?\\.?)"
|
||||
, regex "(cent(i|í)grados?|c(el[cs]?(ius)?)?\\.?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
|
@ -26,7 +26,7 @@ ruleLatentTempDegrees = Rule
|
||||
{ name = "<latent temp> degrees"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(deg(r(\x00e9|e|\x00e8))?s?\\.?)|\x00b0"
|
||||
, regex "(deg(r(é|e|è))?s?\\.?)|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -65,7 +65,7 @@ ruleLatentTempEnDessousDeZero = Rule
|
||||
{ name = "<latent temp> en dessous de zero"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "en dessous de (0|z(\x00e9|e)ro)"
|
||||
, regex "en dessous de (0|z(é|e)ro)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td@(TemperatureData {TTemperature.value = v}):_) ->
|
||||
|
@ -26,7 +26,7 @@ ruleLatentTempCim = Rule
|
||||
{ name = "<latent temp> céim"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "g?ch?(\x00e9|e)im(e(anna)?)?|\x00b0"
|
||||
, regex "g?ch?(é|e)im(e(anna)?)?|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -39,7 +39,7 @@ ruleTempCelsius = Rule
|
||||
{ name = "<temp> Celsius"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "ceinteagr(\x00e1|a)d|c(el[cs]?(ius)?)?\\.?"
|
||||
, regex "ceinteagr(á|a)d|c(el[cs]?(ius)?)?\\.?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -65,7 +65,7 @@ ruleLatentTempFaoiBhunNid = Rule
|
||||
{ name = "<latent temp> faoi bhun náid"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "faoi bhun (0|n(a|\x00e1)id)"
|
||||
, regex "faoi bhun (0|n(a|á)id)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td@(TemperatureData {TTemperature.value = v}):_) ->
|
||||
|
@ -25,7 +25,7 @@ ruleLatentTempStupnjevi = Rule
|
||||
{ name = "<latent temp> stupnjevi"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "deg\\.?|stupa?nj((ev)?a)?|\x00b0"
|
||||
, regex "deg\\.?|stupa?nj((ev)?a)?|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
|
@ -25,7 +25,7 @@ ruleLatentTempDegrees = Rule
|
||||
{ name = "<latent temp> degrees"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(grad[io]?\\.?)|\x00b0"
|
||||
, regex "(grad[io]?\\.?)|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
|
@ -25,7 +25,7 @@ ruleLatentTempDegrees = Rule
|
||||
{ name = "<latent temp> degrees"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "\x5ea6|\x00b0"
|
||||
, regex "度|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -38,7 +38,7 @@ ruleTempCelcius = Rule
|
||||
{ name = "<temp> Celcius"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "\x6442\x6c0f(\x00b0|\x5ea6)|(\x00b0)C"
|
||||
, regex "摂氏(°|度)|(°)C"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -50,9 +50,9 @@ ruleCelciusTemp :: Rule
|
||||
ruleCelciusTemp = Rule
|
||||
{ name = "Celcius <temp>"
|
||||
, pattern =
|
||||
[ regex "\x6442\x6c0f"
|
||||
[ regex "摂氏"
|
||||
, dimension Temperature
|
||||
, regex "\x5ea6|\x00b0"
|
||||
, regex "度|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -65,7 +65,7 @@ ruleTempFahrenheit = Rule
|
||||
{ name = "<temp> Fahrenheit"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "\x83ef\x6c0f(\x00b0|\x5ea6)|(\x00b0)F"
|
||||
, regex "華氏(°|度)|(°)F"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -77,9 +77,9 @@ ruleFahrenheitTemp :: Rule
|
||||
ruleFahrenheitTemp = Rule
|
||||
{ name = "Fahrenheit <temp>"
|
||||
, pattern =
|
||||
[ regex "\x83ef\x6c0f"
|
||||
[ regex "華氏"
|
||||
, dimension Temperature
|
||||
, regex "\x5ea6|\x00b0"
|
||||
, regex "度|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Temperature td:_) -> Just . Token Temperature $
|
||||
|
@ -25,7 +25,7 @@ ruleLatentTempDegrees = Rule
|
||||
{ name = "<latent temp> degrees"
|
||||
, pattern =
|
||||
[ Predicate isLatent
|
||||
, regex "\xb3c4|\x00b0"
|
||||
, regex "도|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -37,7 +37,7 @@ ruleTemp :: Rule
|
||||
ruleTemp = Rule
|
||||
{ name = "섭씨 <temp>"
|
||||
, pattern =
|
||||
[ regex "\xc12d\xc528"
|
||||
[ regex "섭씨"
|
||||
, dimension Temperature
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -63,7 +63,7 @@ ruleTemp2 :: Rule
|
||||
ruleTemp2 = Rule
|
||||
{ name = "화씨 <temp>"
|
||||
, pattern =
|
||||
[ regex "\xd654\xc528"
|
||||
[ regex "화씨"
|
||||
, dimension Temperature
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -26,7 +26,7 @@ ruleLatentTempTemp = Rule
|
||||
{ name = "<latent temp> temp"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(graus?)|\x00b0"
|
||||
, regex "(graus?)|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -39,7 +39,7 @@ ruleTempCelsius = Rule
|
||||
{ name = "<temp> Celsius"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(cent(i|\x00ed)grados?|c(el[cs]?(ius)?)?\\.?)"
|
||||
, regex "(cent(i|í)grados?|c(el[cs]?(ius)?)?\\.?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -65,7 +65,7 @@ ruleLatentTempTempAbaixoDeZero = Rule
|
||||
{ name = "<latent temp> temp abaixo de zero"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "((graus?)|\x00b0)?( abaixo (de)? zero)"
|
||||
, regex "((graus?)|°)?( abaixo (de)? zero)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td@(TemperatureData {TTemperature.value = v}):_) ->
|
||||
|
@ -25,7 +25,7 @@ ruleLatentTempGrade = Rule
|
||||
{ name = "<latent temp> grade"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(grade)|\x00b0"
|
||||
, regex "(grade)|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
|
@ -25,7 +25,7 @@ ruleLatentTempDegrees = Rule
|
||||
{ name = "<latent temp> degrees"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "\x5ea6|\x00b0"
|
||||
, regex "度|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -38,7 +38,7 @@ ruleTempCelcius = Rule
|
||||
{ name = "<temp> Celcius"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(\x6444|\x651d)\x6c0f(\x00b0|\x5ea6)|(\x00b0)C"
|
||||
, regex "(摄|攝)氏(°|度)|(°)C"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -50,9 +50,9 @@ ruleCelciusTemp :: Rule
|
||||
ruleCelciusTemp = Rule
|
||||
{ name = "Celcius <temp>"
|
||||
, pattern =
|
||||
[ regex "(\x6444|\x651d)\x6c0f"
|
||||
[ regex "(摄|攝)氏"
|
||||
, dimension Temperature
|
||||
, regex "\x5ea6|\x00b0"
|
||||
, regex "度|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -65,7 +65,7 @@ ruleTempFahrenheit = Rule
|
||||
{ name = "<temp> Fahrenheit"
|
||||
, pattern =
|
||||
[ dimension Temperature
|
||||
, regex "(\x534e|\x83ef)\x6c0f(\x00b0|\x5ea6)|(\x00b0)F"
|
||||
, regex "(华|華)氏(°|度)|(°)F"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Temperature td:_) -> Just . Token Temperature $
|
||||
@ -77,9 +77,9 @@ ruleFahrenheitTemp :: Rule
|
||||
ruleFahrenheitTemp = Rule
|
||||
{ name = "Fahrenheit <temp>"
|
||||
, pattern =
|
||||
[ regex "(\x534e|\x83ef)\x6c0f"
|
||||
[ regex "(华|華)氏"
|
||||
, dimension Temperature
|
||||
, regex "\x5ea6|\x00b0"
|
||||
, regex "度|°"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Temperature td:_) -> Just . Token Temperature $
|
||||
|
@ -36,8 +36,8 @@ daysOfWeek =
|
||||
, ( "Wednesday", "onsdag|ons\\.?" )
|
||||
, ( "Thursday" , "torsdag|tors?\\.?" )
|
||||
, ( "Friday" , "fredag|fre\\.?" )
|
||||
, ( "Saturday" , "l\x00f8rdag|l\x00f8r\\.?" )
|
||||
, ( "Sunday" , "s\x00f8ndag|s\x00f8n\\.?" )
|
||||
, ( "Saturday" , "lørdag|lør\\.?" )
|
||||
, ( "Sunday" , "søndag|søn\\.?" )
|
||||
]
|
||||
|
||||
ruleDaysOfWeek :: [Rule]
|
||||
@ -103,7 +103,7 @@ ruleQuarterTotillbeforeIntegerHourofday :: Rule
|
||||
ruleQuarterTotillbeforeIntegerHourofday = Rule
|
||||
{ name = "quarter to|till|before <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "(et|\x00e9t)? ?kvart(er)? i"
|
||||
[ regex "(et|ét)? ?kvart(er)? i"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -185,7 +185,7 @@ ruleNewYearsDay :: Rule
|
||||
ruleNewYearsDay = Rule
|
||||
{ name = "new year's day"
|
||||
, pattern =
|
||||
[ regex "nyt\x00e5rsdag"
|
||||
[ regex "nytårsdag"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 1 1
|
||||
}
|
||||
@ -275,7 +275,7 @@ ruleNow :: Rule
|
||||
ruleNow = Rule
|
||||
{ name = "now"
|
||||
, pattern =
|
||||
[ regex "lige nu|nu|(i )?dette \x00f8jeblik"
|
||||
[ regex "lige nu|nu|(i )?dette øjeblik"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Second 0
|
||||
}
|
||||
@ -332,7 +332,7 @@ ruleQuarterAfterpastIntegerHourofday :: Rule
|
||||
ruleQuarterAfterpastIntegerHourofday = Rule
|
||||
{ name = "quarter after|past <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "(et|\x00e9t)? ?kvart(er)? over"
|
||||
[ regex "(et|ét)? ?kvart(er)? over"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -398,7 +398,7 @@ ruleTheCycleBeforeTime = Rule
|
||||
{ name = "the <cycle> before <time>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "(en|tet|et)? f\x00f8r"
|
||||
, regex "(en|tet|et)? før"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -411,7 +411,7 @@ ruleSeason4 :: Rule
|
||||
ruleSeason4 = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "for\x00e5r"
|
||||
[ regex "forår"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (monthDay 3 20) (monthDay 6 21)
|
||||
@ -434,7 +434,7 @@ ruleTimeAfterNext :: Rule
|
||||
ruleTimeAfterNext = Rule
|
||||
{ name = "<time> after next"
|
||||
, pattern =
|
||||
[ regex "n(\x00e6)ste"
|
||||
[ regex "n(æ)ste"
|
||||
, dimension Time
|
||||
, regex "igen"
|
||||
]
|
||||
@ -480,7 +480,7 @@ ruleThisnextDayofweek :: Rule
|
||||
ruleThisnextDayofweek = Rule
|
||||
{ name = "this|next <day-of-week>"
|
||||
, pattern =
|
||||
[ regex "(kommende|n(\x00e6)ste)"
|
||||
[ regex "(kommende|n(æ)ste)"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -493,7 +493,7 @@ ruleTheDayBeforeYesterday :: Rule
|
||||
ruleTheDayBeforeYesterday = Rule
|
||||
{ name = "the day before yesterday"
|
||||
, pattern =
|
||||
[ regex "i forg\x00e5rs"
|
||||
[ regex "i forgårs"
|
||||
]
|
||||
, prod = \_ -> tt . cycleNth TG.Day $ - 2
|
||||
}
|
||||
@ -517,7 +517,7 @@ ruleNextCycle :: Rule
|
||||
ruleNextCycle = Rule
|
||||
{ name = "next <cycle>"
|
||||
, pattern =
|
||||
[ regex "n(\x00e6)ste|kommende"
|
||||
[ regex "n(æ)ste|kommende"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -556,7 +556,7 @@ ruleOnDate :: Rule
|
||||
ruleOnDate = Rule
|
||||
{ name = "on <date>"
|
||||
, pattern =
|
||||
[ regex "den|p\x00e5"
|
||||
[ regex "den|på"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -697,7 +697,7 @@ ruleHourofdayQuart = Rule
|
||||
{ name = "<hour-of-day> quarter (as relative minutes)"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "(et|\x00e9t)? ?kvart(er)?"
|
||||
, regex "(et|ét)? ?kvart(er)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:
|
||||
@ -807,7 +807,7 @@ ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
, pattern =
|
||||
[ regex "(efter|fra)"
|
||||
, Predicate isATimeOfDay
|
||||
, regex "((men )?f\x00f8r)|\\-|til|indtil"
|
||||
, regex "((men )?før)|\\-|til|indtil"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -821,7 +821,7 @@ ruleExactlyTimeofday :: Rule
|
||||
ruleExactlyTimeofday = Rule
|
||||
{ name = "exactly <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "pr(\x00e6)cis( kl\\.| klokken)?"
|
||||
[ regex "pr(æ)cis( kl\\.| klokken)?"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -886,7 +886,7 @@ ruleNewYearsEve :: Rule
|
||||
ruleNewYearsEve = Rule
|
||||
{ name = "new year's eve"
|
||||
, pattern =
|
||||
[ regex "nyt\x00e5rsaften(sdag)?"
|
||||
[ regex "nytårsaften(sdag)?"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 12 31
|
||||
}
|
||||
@ -949,7 +949,7 @@ ruleTimeofdaySharp = Rule
|
||||
{ name = "<time-of-day> sharp"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "(sharp|pr(\x00e6)cis)"
|
||||
, regex "(sharp|pr(æ)cis)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> tt $ notLatent td
|
||||
@ -1019,7 +1019,7 @@ ruleUntilTimeofday :: Rule
|
||||
ruleUntilTimeofday = Rule
|
||||
{ name = "until <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "(engang )?inden|indtil|f\x00f8r|op til"
|
||||
[ regex "(engang )?inden|indtil|før|op til"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1124,7 +1124,7 @@ ruleNextTime :: Rule
|
||||
ruleNextTime = Rule
|
||||
{ name = "next <time>"
|
||||
, pattern =
|
||||
[ regex "n(\x00e6)ste|kommende"
|
||||
[ regex "n(æ)ste|kommende"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1196,7 +1196,7 @@ ruleNextNCycle :: Rule
|
||||
ruleNextNCycle = Rule
|
||||
{ name = "next n <cycle>"
|
||||
, pattern =
|
||||
[ regex "n(\x00e6)ste"
|
||||
[ regex "n(æ)ste"
|
||||
, Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
]
|
||||
@ -1211,7 +1211,7 @@ ruleADuration :: Rule
|
||||
ruleADuration = Rule
|
||||
{ name = "a <duration>"
|
||||
, pattern =
|
||||
[ regex "(om )?en|et|\x00e9n|\x00e9t"
|
||||
[ regex "(om )?en|et|én|ét"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1250,7 +1250,7 @@ ruleThisCycle :: Rule
|
||||
ruleThisCycle = Rule
|
||||
{ name = "this <cycle>"
|
||||
, pattern =
|
||||
[ regex "denne|dette|i|nuv(\x00e6)rende|indev(\x00e6)rende"
|
||||
[ regex "denne|dette|i|nuv(æ)rende|indev(æ)rende"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1314,7 +1314,7 @@ ruleOnANamedday :: Rule
|
||||
ruleOnANamedday = Rule
|
||||
{ name = "on a named-day"
|
||||
, pattern =
|
||||
[ regex "p\x00e5 en"
|
||||
[ regex "på en"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1339,7 +1339,7 @@ ruleYesterday :: Rule
|
||||
ruleYesterday = Rule
|
||||
{ name = "yesterday"
|
||||
, pattern =
|
||||
[ regex "i g\x00e5r|ig\x00e5r"
|
||||
[ regex "i går|igår"
|
||||
]
|
||||
, prod = \_ -> tt . cycleNth TG.Day $ - 1
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ ruleSeason2 :: Rule
|
||||
ruleSeason2 = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "efter\x00e5r"
|
||||
[ regex "efterår"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
@ -1373,7 +1373,7 @@ ruleChristmas :: Rule
|
||||
ruleChristmas = Rule
|
||||
{ name = "christmas"
|
||||
, pattern =
|
||||
[ regex "((1\\.?)|f\x00f8rste)? ?juledag"
|
||||
[ regex "((1\\.?)|første)? ?juledag"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 12 25
|
||||
}
|
||||
@ -1534,7 +1534,7 @@ ruleCycleBeforeTime = Rule
|
||||
{ name = "<cycle> before <time>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "f\x00f8r"
|
||||
, regex "før"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1619,7 +1619,7 @@ ruleDurationBeforeTime = Rule
|
||||
{ name = "<duration> before <time>"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "f\x00f8r"
|
||||
, regex "før"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -37,7 +37,7 @@ instants =
|
||||
"heute|(um diese zeit|zu dieser zeit|um diesen zeitpunkt|zu diesem zeitpunkt)" )
|
||||
, ( "tomorrow" , TG.Day , 1, "morgen" )
|
||||
, ( "yesterday" , TG.Day , -1, "gestern" )
|
||||
, ( "after tomorrow" , TG.Day , 2, "(\x00fc)bermorgen" )
|
||||
, ( "after tomorrow" , TG.Day , 2, "(ü)bermorgen" )
|
||||
, ( "before yesterday", TG.Day , -2, "vorgestern" )
|
||||
, ( "EOM|End of month", TG.Month , 1, "(das )?ende des monats?" )
|
||||
, ( "EOY|End of year" , TG.Year , 1,
|
||||
@ -77,7 +77,7 @@ months :: [(Text, String)]
|
||||
months =
|
||||
[ ( "Januar" , "januar|jan\\.?" )
|
||||
, ( "Februar" , "februar|feb\\.?" )
|
||||
, ( "Marz" , "m(\x00e4)rz|m(\x00e4)r\\.?" )
|
||||
, ( "Marz" , "m(ä)rz|m(ä)r\\.?" )
|
||||
, ( "April" , "april|apr\\.?" )
|
||||
, ( "Mai" , "mai\\.?" )
|
||||
, ( "Juni" , "juni|jun\\.?" )
|
||||
@ -103,7 +103,7 @@ seasons =
|
||||
[ ( "sommer" , "sommer" , monthDay 6 21, monthDay 9 23 )
|
||||
, ( "herbst" , "herbst" , monthDay 9 23, monthDay 12 21 )
|
||||
, ( "winter" , "winter" , monthDay 12 21, monthDay 3 20 )
|
||||
, ( "fruhling", "fr(\x00fc)h(ling|jahr)", monthDay 3 20, monthDay 6 21 )
|
||||
, ( "fruhling", "fr(ü)h(ling|jahr)", monthDay 3 20, monthDay 6 21 )
|
||||
]
|
||||
|
||||
ruleSeasons :: [Rule]
|
||||
@ -124,7 +124,7 @@ holidays =
|
||||
, ( "Tag der Deutschen Einheit" , monthDay 10 3,
|
||||
"tag (der)? deutsc?hen? einheit" )
|
||||
, ( "Oesterreichischer Nationalfeiertag", monthDay 10 26,
|
||||
"((\x00f6)sterreichischer?)? nationalfeiertag|national feiertag" )
|
||||
"((ö)sterreichischer?)? nationalfeiertag|national feiertag" )
|
||||
, ( "halloween day" , monthDay 10 31, "hall?owe?en?" )
|
||||
, ( "Allerheiligen" , monthDay 11 1,
|
||||
"allerheiligen?|aller heiligen?" )
|
||||
@ -493,7 +493,7 @@ ruleTimeAfterNext = Rule
|
||||
{ name = "<time> after next"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "nach dem n(\x00e4)chsten"
|
||||
, regex "nach dem n(ä)chsten"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -519,7 +519,7 @@ ruleNoon :: Rule
|
||||
ruleNoon = Rule
|
||||
{ name = "noon"
|
||||
, pattern =
|
||||
[ regex "mittags?|zw(\x00f6)lf (uhr)?"
|
||||
[ regex "mittags?|zw(ö)lf (uhr)?"
|
||||
]
|
||||
, prod = \_ -> tt $ hour False 12
|
||||
}
|
||||
@ -528,7 +528,7 @@ ruleThisnextDayofweek :: Rule
|
||||
ruleThisnextDayofweek = Rule
|
||||
{ name = "this|next <day-of-week>"
|
||||
, pattern =
|
||||
[ regex "diese(n|r)|kommenden|n(\x00e4)chsten"
|
||||
[ regex "diese(n|r)|kommenden|n(ä)chsten"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -556,7 +556,7 @@ ruleNextCycle :: Rule
|
||||
ruleNextCycle = Rule
|
||||
{ name = "next <cycle>"
|
||||
, pattern =
|
||||
[ regex "n(\x00e4)chste(r|n|s)?|kommende(r|n|s)?"
|
||||
[ regex "n(ä)chste(r|n|s)?|kommende(r|n|s)?"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -570,7 +570,7 @@ ruleTimeofdayApproximately = Rule
|
||||
{ name = "<time-of-day> approximately"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "(um )?zirka|ungef(\x00e4)hr|etwa"
|
||||
, regex "(um )?zirka|ungef(ä)hr|etwa"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> tt $ notLatent td
|
||||
@ -670,7 +670,7 @@ ruleInduringThePartofday :: Rule
|
||||
ruleInduringThePartofday = Rule
|
||||
{ name = "in|during the <part-of-day>"
|
||||
, pattern =
|
||||
[ regex "(in|an|am|w(\x00e4)h?rend)( der| dem| des)?"
|
||||
[ regex "(in|an|am|w(ä)h?rend)( der| dem| des)?"
|
||||
, Predicate isAPartOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -809,7 +809,7 @@ ruleFromTimeofdayTimeofdayInterval :: Rule
|
||||
ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
{ name = "from <time-of-day> - <time-of-day> (interval)"
|
||||
, pattern =
|
||||
[ regex "(von|nach|ab|fr(\x00fc)hestens (um)?)"
|
||||
[ regex "(von|nach|ab|fr(ü)hestens (um)?)"
|
||||
, Predicate isATimeOfDay
|
||||
, regex "((noch|aber|jedoch)? vor)|\\-|bis"
|
||||
, Predicate isATimeOfDay
|
||||
@ -824,7 +824,7 @@ ruleExactlyTimeofday :: Rule
|
||||
ruleExactlyTimeofday = Rule
|
||||
{ name = "exactly <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "genau|exakt|p(\x00fc)nktlich|punkt( um)?"
|
||||
[ regex "genau|exakt|p(ü)nktlich|punkt( um)?"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -905,7 +905,7 @@ ruleTimeofdaySharp = Rule
|
||||
{ name = "<time-of-day> sharp"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "genau|exakt|p(\x00fc)nktlich|punkt( um)?"
|
||||
, regex "genau|exakt|p(ü)nktlich|punkt( um)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> tt $ notLatent td
|
||||
@ -963,7 +963,7 @@ ruleAboutTimeofday :: Rule
|
||||
ruleAboutTimeofday = Rule
|
||||
{ name = "about <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "(um )?zirka|ca\\.?|ungef(\x00e4)hr|etwa|gegen"
|
||||
[ regex "(um )?zirka|ca\\.?|ungef(ä)hr|etwa|gegen"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -975,7 +975,7 @@ ruleUntilTimeofday :: Rule
|
||||
ruleUntilTimeofday = Rule
|
||||
{ name = "until <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "vor|bis( zu[rm]?)?|sp(\x00e4)testens?"
|
||||
[ regex "vor|bis( zu[rm]?)?|sp(ä)testens?"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -988,7 +988,7 @@ ruleUntilTimeofdayPostfix = Rule
|
||||
{ name = "<time-of-day> until"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "sp(\x00e4)testens"
|
||||
, regex "sp(ä)testens"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_:_) -> tt $ withDirection TTime.Before td
|
||||
@ -1071,7 +1071,7 @@ ruleNextTime :: Rule
|
||||
ruleNextTime = Rule
|
||||
{ name = "next <time>"
|
||||
, pattern =
|
||||
[ regex "(n(\x00e4)chste|kommende)[ns]?"
|
||||
[ regex "(n(ä)chste|kommende)[ns]?"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1143,7 +1143,7 @@ ruleNextNCycle :: Rule
|
||||
ruleNextNCycle = Rule
|
||||
{ name = "next n <cycle>"
|
||||
, pattern =
|
||||
[ regex "n(\x00e4)chsten?|kommenden?"
|
||||
[ regex "n(ä)chsten?|kommenden?"
|
||||
, Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
]
|
||||
@ -1171,7 +1171,7 @@ ruleMorning :: Rule
|
||||
ruleMorning = Rule
|
||||
{ name = "morning"
|
||||
, pattern =
|
||||
[ regex "morgens|(in der )?fr(\x00fc)h|vor ?mittags?|am morgen"
|
||||
[ regex "morgens|(in der )?fr(ü)h|vor ?mittags?|am morgen"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = hour False 3
|
||||
@ -1287,7 +1287,7 @@ ruleAfterTimeofday :: Rule
|
||||
ruleAfterTimeofday = Rule
|
||||
{ name = "after <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "nach|ab|fr(\x00fc)he?stens"
|
||||
[ regex "nach|ab|fr(ü)he?stens"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1300,7 +1300,7 @@ ruleAfterTimeofdayPostfix = Rule
|
||||
{ name = "<time-of-day> after"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "fr(\x00fc)he?stens"
|
||||
, regex "fr(ü)he?stens"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_:_) -> tt $ withDirection TTime.After td
|
||||
@ -1393,7 +1393,7 @@ ruleAfterNextTime :: Rule
|
||||
ruleAfterNextTime = Rule
|
||||
{ name = "after next <time>"
|
||||
, pattern =
|
||||
[ regex "(\x00fc)ber ?n(\x00e4)chste[ns]?"
|
||||
[ regex "(ü)ber ?n(ä)chste[ns]?"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -32,7 +32,7 @@ ruleTheDayAfterTomorrow :: Rule
|
||||
ruleTheDayAfterTomorrow = Rule
|
||||
{ name = "the day after tomorrow"
|
||||
, pattern =
|
||||
[ regex "pasado\\s?ma(n|\x00f1)ana"
|
||||
[ regex "pasado\\s?ma(n|ñ)ana"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 2
|
||||
}
|
||||
@ -67,10 +67,10 @@ daysOfWeek :: [(Text.Text, String)]
|
||||
daysOfWeek =
|
||||
[ ( "Lunes" , "lunes|lun?\\.?" )
|
||||
, ( "Martes" , "martes|mar?\\.?" )
|
||||
, ( "Miercoles" , "mi(e|\x00e9)\\.?(rcoles)?|mx|mier?\\." )
|
||||
, ( "Miercoles" , "mi(e|é)\\.?(rcoles)?|mx|mier?\\." )
|
||||
, ( "Jueves" , "jueves|jue|jue\\." )
|
||||
, ( "Viernes" , "viernes|vie|vie\\." )
|
||||
, ( "Sabado" , "s(\x00e1|a)bado|s(\x00e1|a)b\\.?" )
|
||||
, ( "Sabado" , "s(á|a)bado|s(á|a)b\\.?" )
|
||||
, ( "Domingo" , "domingo|dom\\.?" )
|
||||
]
|
||||
|
||||
@ -183,7 +183,7 @@ ruleUltimoDayofweekDeTime :: Rule
|
||||
ruleUltimoDayofweekDeTime = Rule
|
||||
{ name = "ultimo <day-of-week> de <time>"
|
||||
, pattern =
|
||||
[ regex "(\x00fa|u)ltimo"
|
||||
[ regex "(ú|u)ltimo"
|
||||
, Predicate isADayOfWeek
|
||||
, regex "de|en"
|
||||
, dimension Time
|
||||
@ -257,7 +257,7 @@ ruleElProximoCycle = Rule
|
||||
{ name = "el proximo <cycle> "
|
||||
, pattern =
|
||||
[ regex "(el|los|la|las) ?"
|
||||
, regex "pr(\x00f3|o)xim(o|a)s?|siguientes?"
|
||||
, regex "pr(ó|o)xim(o|a)s?|siguientes?"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -324,7 +324,7 @@ ruleNoon :: Rule
|
||||
ruleNoon = Rule
|
||||
{ name = "noon"
|
||||
, pattern =
|
||||
[ regex "mediod(\x00ed|i)a"
|
||||
[ regex "mediod(í|i)a"
|
||||
]
|
||||
, prod = \_ -> tt $ hour False 12
|
||||
}
|
||||
@ -333,7 +333,7 @@ ruleProximasNCycle :: Rule
|
||||
ruleProximasNCycle = Rule
|
||||
{ name = "proximas n <cycle>"
|
||||
, pattern =
|
||||
[ regex "pr(\x00f3|o)xim(o|a)s?"
|
||||
[ regex "pr(ó|o)xim(o|a)s?"
|
||||
, Predicate $ isIntegerBetween 2 9999
|
||||
, dimension TimeGrain
|
||||
]
|
||||
@ -602,7 +602,7 @@ ruleDelYear :: Rule
|
||||
ruleDelYear = Rule
|
||||
{ name = "del <year>"
|
||||
, pattern =
|
||||
[ regex "del( a(\x00f1|n)o)?"
|
||||
[ regex "del( a(ñ|n)o)?"
|
||||
, Predicate $ isIntegerBetween 1000 2100
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -652,7 +652,7 @@ ruleAnoNuevo :: Rule
|
||||
ruleAnoNuevo = Rule
|
||||
{ name = "ano nuevo"
|
||||
, pattern =
|
||||
[ regex "a(n|\x00f1)o nuevo"
|
||||
[ regex "a(n|ñ)o nuevo"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 1 1
|
||||
}
|
||||
@ -775,7 +775,7 @@ ruleNCycleProximoqueViene = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, dimension TimeGrain
|
||||
, regex "(pr(\x00f3|o)xim(o|a)s?|que vienen?|siguientes?)"
|
||||
, regex "(pr(ó|o)xim(o|a)s?|que vienen?|siguientes?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -828,7 +828,7 @@ ruleDimTimeDeLaManana = Rule
|
||||
{ name = "<dim time> de la manana"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "(a|en|de) la ma(\x00f1|n)ana"
|
||||
, regex "(a|en|de) la ma(ñ|n)ana"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> do
|
||||
@ -980,7 +980,7 @@ ruleMorning :: Rule
|
||||
ruleMorning = Rule
|
||||
{ name = "morning"
|
||||
, pattern =
|
||||
[ regex "ma(\x00f1|n)ana"
|
||||
[ regex "ma(ñ|n)ana"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
@ -1021,7 +1021,7 @@ ruleLaCyclePasado = Rule
|
||||
, pattern =
|
||||
[ regex "(el|los|la|las) ?"
|
||||
, dimension TimeGrain
|
||||
, regex "pasad(a|o)s?|(u|\x00fa)ltim[ao]s?"
|
||||
, regex "pasad(a|o)s?|(u|ú)ltim[ao]s?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token TimeGrain grain:_) ->
|
||||
@ -1055,7 +1055,7 @@ ruleSeason2 :: Rule
|
||||
ruleSeason2 = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "oto(\x00f1|n)o"
|
||||
[ regex "oto(ñ|n)o"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
@ -1183,7 +1183,7 @@ ruleNProximasCycle = Rule
|
||||
{ name = "n proximas <cycle>"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, regex "pr(\x00f3|o)xim(o|a)s?"
|
||||
, regex "pr(ó|o)xim(o|a)s?"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1198,7 +1198,7 @@ ruleLaPasadoCycle = Rule
|
||||
{ name = "la pasado <cycle>"
|
||||
, pattern =
|
||||
[ regex "(el|los|la|las) ?"
|
||||
, regex "pasad(a|o)s?|(u|\x00fa)ltim[ao]s?"
|
||||
, regex "pasad(a|o)s?|(u|ú)ltim[ao]s?"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1255,7 +1255,7 @@ ruleElCycleProximoqueViene = Rule
|
||||
, pattern =
|
||||
[ regex "(el|los|la|las) ?"
|
||||
, dimension TimeGrain
|
||||
, regex "(pr(\x00f3|o)xim(o|a)s?|que vienen?|siguientes?)"
|
||||
, regex "(pr(ó|o)xim(o|a)s?|que vienen?|siguientes?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token TimeGrain grain:_) ->
|
||||
@ -1269,7 +1269,7 @@ ruleElCycleProximoqueVieneTime = Rule
|
||||
, pattern =
|
||||
[ regex "(el|los|la|las)"
|
||||
, dimension TimeGrain
|
||||
, regex "(pr(\x00f3|o)xim(o|a)s?|que vienen?|siguientes?)"
|
||||
, regex "(pr(ó|o)xim(o|a)s?|que vienen?|siguientes?)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1282,7 +1282,7 @@ ruleDelMedioda :: Rule
|
||||
ruleDelMedioda = Rule
|
||||
{ name = "del mediodía"
|
||||
, pattern =
|
||||
[ regex "del mediod(i|\x00ed)a"
|
||||
[ regex "del mediod(i|í)a"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
@ -1309,7 +1309,7 @@ ruleTomorrow :: Rule
|
||||
ruleTomorrow = Rule
|
||||
{ name = "tomorrow"
|
||||
, pattern =
|
||||
[ regex "ma(n|\x00f1)ana"
|
||||
[ regex "ma(n|ñ)ana"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 1
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ ruleAujourdhui :: Rule
|
||||
ruleAujourdhui = Rule
|
||||
{ name = "aujourd'hui"
|
||||
, pattern =
|
||||
[ regex "(aujourd'? ?hui)|(ce jour)|(dans la journ(\x00e9|e)e?)|(en ce moment)"
|
||||
[ regex "(aujourd'? ?hui)|(ce jour)|(dans la journ(é|e)e?)|(en ce moment)"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 0
|
||||
}
|
||||
@ -62,7 +62,7 @@ ruleDbutDeSoire :: Rule
|
||||
ruleDbutDeSoire = Rule
|
||||
{ name = "début de soirée"
|
||||
, pattern =
|
||||
[ regex "(en |au )?d(\x00e9|e)but de (la )?soir(\x00e9|e)e"
|
||||
[ regex "(en |au )?d(é|e)but de (la )?soir(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 18) (hour False 21)
|
||||
@ -72,7 +72,7 @@ ruleFinDeSoire :: Rule
|
||||
ruleFinDeSoire = Rule
|
||||
{ name = "fin de soirée"
|
||||
, pattern =
|
||||
[ regex "(en |(\x00e0|a) la )?fin de (la )?soir(\x00e9|e)e"
|
||||
[ regex "(en |(à|a) la )?fin de (la )?soir(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 21) (hour False 0)
|
||||
@ -82,7 +82,7 @@ ruleDbutDeMatine :: Rule
|
||||
ruleDbutDeMatine = Rule
|
||||
{ name = "début de matinée"
|
||||
, pattern =
|
||||
[ regex "le matin (tr(e|\x00e8)s )?t(\x00f4|o)t|(tr(e|\x00e8)s )?t(\x00f4|o)t le matin|(en |au )?d(\x00e9|e)but de (la )?matin(\x00e9|e)e"
|
||||
[ regex "le matin (tr(e|è)s )?t(ô|o)t|(tr(e|è)s )?t(ô|o)t le matin|(en |au )?d(é|e)but de (la )?matin(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 7) (hour False 9)
|
||||
@ -92,7 +92,7 @@ ruleMilieuDeMatine :: Rule
|
||||
ruleMilieuDeMatine = Rule
|
||||
{ name = "milieu de matinée"
|
||||
, pattern =
|
||||
[ regex "(en |au )?milieu de (la )?matin(\x00e9|e)e"
|
||||
[ regex "(en |au )?milieu de (la )?matin(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 9) (hour False 11)
|
||||
@ -102,7 +102,7 @@ ruleFinDeMatine :: Rule
|
||||
ruleFinDeMatine = Rule
|
||||
{ name = "fin de matinée"
|
||||
, pattern =
|
||||
[ regex "(en |(\x00e0|a) la )?fin de (la )?matin(\x00e9|e)e"
|
||||
[ regex "(en |(à|a) la )?fin de (la )?matin(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 10) (hour False 12)
|
||||
@ -112,7 +112,7 @@ ruleDbutDaprsmidi :: Rule
|
||||
ruleDbutDaprsmidi = Rule
|
||||
{ name = "début d'après-midi"
|
||||
, pattern =
|
||||
[ regex "(au |en )?d(\x00e9|e)but (d'|de l')apr(e|\x00e9|\x00e8)s( |\\-)midi"
|
||||
[ regex "(au |en )?d(é|e)but (d'|de l')apr(e|é|è)s( |\\-)midi"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 12) (hour False 14)
|
||||
@ -122,7 +122,7 @@ ruleMilieuDaprsmidi :: Rule
|
||||
ruleMilieuDaprsmidi = Rule
|
||||
{ name = "milieu d'après-midi"
|
||||
, pattern =
|
||||
[ regex "(au |en )?milieu (d'|de l')apr(e|\x00e9|\x00e8)s( |\\-)midi"
|
||||
[ regex "(au |en )?milieu (d'|de l')apr(e|é|è)s( |\\-)midi"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 14) (hour False 17)
|
||||
@ -132,7 +132,7 @@ ruleFinDaprsmidi :: Rule
|
||||
ruleFinDaprsmidi = Rule
|
||||
{ name = "fin d'après-midi"
|
||||
, pattern =
|
||||
[ regex "((\x00e0|a) la |en )?fin (d'|de l')apr(e|\x00e9|\x00e8)s( |\\-)midi"
|
||||
[ regex "((à|a) la |en )?fin (d'|de l')apr(e|é|è)s( |\\-)midi"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 17) (hour False 19)
|
||||
@ -142,7 +142,7 @@ ruleDbutDeJourne :: Rule
|
||||
ruleDbutDeJourne = Rule
|
||||
{ name = "début de journée"
|
||||
, pattern =
|
||||
[ regex "(en |au )?d(\x00e9|e)but de (la )?journ(\x00e9|e)e"
|
||||
[ regex "(en |au )?d(é|e)but de (la )?journ(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 6) (hour False 10)
|
||||
@ -152,7 +152,7 @@ ruleMilieuDeJourne :: Rule
|
||||
ruleMilieuDeJourne = Rule
|
||||
{ name = "milieu de journée"
|
||||
, pattern =
|
||||
[ regex "(en |au )?milieu de (la )?journ(\x00e9|e)e"
|
||||
[ regex "(en |au )?milieu de (la )?journ(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 11) (hour False 16)
|
||||
@ -162,7 +162,7 @@ ruleFinDeJourne :: Rule
|
||||
ruleFinDeJourne = Rule
|
||||
{ name = "fin de journée"
|
||||
, pattern =
|
||||
[ regex "(en |(\x00e0|a) la )?fin de (la )?journ(\x00e9|e)e"
|
||||
[ regex "(en |(à|a) la )?fin de (la )?journ(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 17) (hour False 21)
|
||||
@ -172,7 +172,7 @@ ruleDbutDeSemaine :: Rule
|
||||
ruleDbutDeSemaine = Rule
|
||||
{ name = "début de semaine"
|
||||
, pattern =
|
||||
[ regex "(en |au )?d(\x00e9|e)but de (cette |la )?semaine"
|
||||
[ regex "(en |au )?d(é|e)but de (cette |la )?semaine"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (dayOfWeek 1) (dayOfWeek 2)
|
||||
@ -192,7 +192,7 @@ ruleFinDeSemaine :: Rule
|
||||
ruleFinDeSemaine = Rule
|
||||
{ name = "fin de semaine"
|
||||
, pattern =
|
||||
[ regex "(en |(\x00e0|a) la )?fin de (cette |la )?semaine"
|
||||
[ regex "(en |(à|a) la )?fin de (cette |la )?semaine"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (dayOfWeek 4) (dayOfWeek 7)
|
||||
@ -265,7 +265,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
{ name = "<datetime> - <datetime> (interval)"
|
||||
, pattern =
|
||||
[ Predicate isNotLatent
|
||||
, regex "\\-|au|jusqu'(au?|\x00e0)"
|
||||
, regex "\\-|au|jusqu'(au?|à)"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -298,7 +298,7 @@ ruleDeTimeofdayTimeofdayInterval = Rule
|
||||
, pattern =
|
||||
[ regex "(midi )?de"
|
||||
, Predicate isATimeOfDay
|
||||
, regex "\\-|(jusqu')?(\x00e0|au?)"
|
||||
, regex "\\-|(jusqu')?(à|au?)"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -312,7 +312,7 @@ ruleNProchainsCycle = Rule
|
||||
{ name = "n prochains <cycle>"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, regex "prochaine?s?|suivante?s?|apr(e|\x00e8|\x00e9)s"
|
||||
, regex "prochaine?s?|suivante?s?|apr(e|è|é)s"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -327,7 +327,7 @@ ruleNDerniersCycle = Rule
|
||||
{ name = "n derniers <cycle>"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, regex "derni(e|\x00e8|\x00e9)re?s?"
|
||||
, regex "derni(e|è|é)re?s?"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -341,7 +341,7 @@ ruleAvantTimeofday :: Rule
|
||||
ruleAvantTimeofday = Rule
|
||||
{ name = "avant <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "(n[ ']importe quand )?(avant|jusqu'(a|\x00e0))"
|
||||
[ regex "(n[ ']importe quand )?(avant|jusqu'(a|à))"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -458,7 +458,7 @@ ruleToussaint :: Rule
|
||||
ruleToussaint = Rule
|
||||
{ name = "toussaint"
|
||||
, pattern =
|
||||
[ regex "((la |la journ(\x00e9|e)e de la |jour de la )?toussaint|jour des morts)"
|
||||
[ regex "((la |la journ(é|e)e de la |jour de la )?toussaint|jour des morts)"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 11 1
|
||||
}
|
||||
@ -467,7 +467,7 @@ ruleDernierCycleDeTimeLatent :: Rule
|
||||
ruleDernierCycleDeTimeLatent = Rule
|
||||
{ name = "dernier <cycle> de <time> (latent)"
|
||||
, pattern =
|
||||
[ regex "derni(e|\x00e9|\x00e8)re?"
|
||||
[ regex "derni(e|é|è)re?"
|
||||
, dimension TimeGrain
|
||||
, regex "d['e]"
|
||||
, dimension Time
|
||||
@ -483,7 +483,7 @@ ruleDurationApresTime = Rule
|
||||
{ name = "<duration> apres <time>"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "apr(e|\x00e8)s"
|
||||
, regex "apr(e|è)s"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -498,7 +498,7 @@ ruleNCycleAprs = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, dimension TimeGrain
|
||||
, regex "(d')? ?apr(e|\x00e8|\x00e9)s|qui sui(t|ves?)|plus tard"
|
||||
, regex "(d')? ?apr(e|è|é)s|qui sui(t|ves?)|plus tard"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -536,7 +536,7 @@ ruleNCycleAvant = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, dimension TimeGrain
|
||||
, regex "(d')? ?avant|plus t(o|\x00f4)t"
|
||||
, regex "(d')? ?avant|plus t(o|ô)t"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -550,7 +550,7 @@ ruleDimTimeDuMatin = Rule
|
||||
{ name = "<dim time> du matin"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "((du|dans|de) )?((au|le|la) )?mat(in(\x00e9|e)?e?)?"
|
||||
, regex "((du|dans|de) )?((au|le|la) )?mat(in(é|e)?e?)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> do
|
||||
@ -620,7 +620,7 @@ ruleHourofdayEtpassDeNumeral = Rule
|
||||
{ name = "<hour-of-day> et|passé de <number>"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "et|(pass(\x00e9|e)e? de)"
|
||||
, regex "et|(pass(é|e)e? de)"
|
||||
, Predicate $ isIntegerBetween 1 59
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -638,7 +638,7 @@ ruleHourofdayEtpassDeNumeralMinutes = Rule
|
||||
{ name = "<hour-of-day> et|passé de <number> minutes"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "et|(pass(\x00e9|e)e? de)"
|
||||
, regex "et|(pass(é|e)e? de)"
|
||||
, Predicate $ isIntegerBetween 1 59
|
||||
, regex "min\\.?(ute)?s?"
|
||||
]
|
||||
@ -719,7 +719,7 @@ ruleAprsLeDayofmonth :: Rule
|
||||
ruleAprsLeDayofmonth = Rule
|
||||
{ name = "après le <day-of-month>"
|
||||
, pattern =
|
||||
[ regex "(apr(e|\x00e8)s le|(a|\x00e0) partir du)"
|
||||
[ regex "(apr(e|è)s le|(a|à) partir du)"
|
||||
, Predicate isDOMInteger
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -734,7 +734,7 @@ ruleCycleDernier = Rule
|
||||
{ name = "<cycle> dernier"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "derni(\x00e8|e)re?|pass(\x00e9|e)e?|pr(e|\x00e9)c(e|\x00e9)dente?|(d')? ?avant"
|
||||
, regex "derni(è|e)re?|pass(é|e)e?|pr(e|é)c(e|é)dente?|(d')? ?avant"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token TimeGrain grain:_) ->
|
||||
@ -788,7 +788,7 @@ ruleNamedmonthnameddayDernierpass = Rule
|
||||
{ name = "<named-month|named-day> dernier|passé"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "derni(e|\x00e9|\x00e8)re?|pass(\x00e9|e)e?"
|
||||
, regex "derni(e|é|è)re?|pass(é|e)e?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -802,7 +802,7 @@ ruleLeCycleDernier = Rule
|
||||
, pattern =
|
||||
[ regex "l[ae']? ?"
|
||||
, dimension TimeGrain
|
||||
, regex "derni(\x00e8|e)re?|pass(\x00e9|e)e?"
|
||||
, regex "derni(è|e)re?|pass(é|e)e?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token TimeGrain grain:_) ->
|
||||
@ -816,7 +816,7 @@ ruleNCyclePassesprecedents = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, dimension TimeGrain
|
||||
, regex "pass(e|\x00e8|\x00e9)(e|\x00e8|\x00e9)?s?|pr(e|\x00e9)c(e|\x00e9)dente?s?|(d')? ?avant|plus t(o|\x00f4)t"
|
||||
, regex "pass(e|è|é)(e|è|é)?s?|pr(e|é)c(e|é)dente?s?|(d')? ?avant|plus t(o|ô)t"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -829,7 +829,7 @@ ruleSoir :: Rule
|
||||
ruleSoir = Rule
|
||||
{ name = "soir"
|
||||
, pattern =
|
||||
[ regex "soir(\x00e9|e)?e?"
|
||||
[ regex "soir(é|e)?e?"
|
||||
]
|
||||
, prod = \_ -> Token Time . mkLatent . partOfDay <$>
|
||||
interval TTime.Open (hour False 18) (hour False 0)
|
||||
@ -892,7 +892,7 @@ ruleDbutNamedmonthinterval :: Rule
|
||||
ruleDbutNamedmonthinterval = Rule
|
||||
{ name = "début <named-month>(interval)"
|
||||
, pattern =
|
||||
[ regex "d(\x00e9|e)but( du mois d[e'] ?)?"
|
||||
[ regex "d(é|e)but( du mois d[e'] ?)?"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -932,7 +932,7 @@ ruleSeason :: Rule
|
||||
ruleSeason = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "(cet )?(\x00e9|e)t(\x00e9|e)"
|
||||
[ regex "(cet )?(é|e)t(é|e)"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (monthDay 6 21) (monthDay 9 23)
|
||||
@ -942,7 +942,7 @@ ruleAprsmidi :: Rule
|
||||
ruleAprsmidi = Rule
|
||||
{ name = "après-midi"
|
||||
, pattern =
|
||||
[ regex "apr(e|\x00e9|\x00e8)s( |\\-)midi"
|
||||
[ regex "apr(e|é|è)s( |\\-)midi"
|
||||
]
|
||||
, prod = \_ -> Token Time . mkLatent . partOfDay <$>
|
||||
interval TTime.Open (hour False 12) (hour False 19)
|
||||
@ -952,7 +952,7 @@ ruleNoel :: Rule
|
||||
ruleNoel = Rule
|
||||
{ name = "noel"
|
||||
, pattern =
|
||||
[ regex "(jour de )?no(e|\x00eb)l"
|
||||
[ regex "(jour de )?no(e|ë)l"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 12 25
|
||||
}
|
||||
@ -984,7 +984,7 @@ ruleNamedmonthnameddaySuivantdaprs = Rule
|
||||
{ name = "<named-month|named-day> suivant|d'après"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "suivante?s?|d'apr(e|\x00e9|\x00e8)s"
|
||||
, regex "suivante?s?|d'apr(e|é|è)s"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -1024,7 +1024,7 @@ ruleDimTimeDuSoir = Rule
|
||||
{ name = "<dim time> du soir"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "((du|dans|de) )?((au|le|la) )?soir(\x00e9|e)?e?"
|
||||
, regex "((du|dans|de) )?((au|le|la) )?soir(é|e)?e?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> do
|
||||
@ -1038,7 +1038,7 @@ ruleAprsTimeofday :: Rule
|
||||
ruleAprsTimeofday = Rule
|
||||
{ name = "après <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "(apr(e|\x00e8)s|(a|\x00e0) partir de|(un peu )?plus tard que)"
|
||||
[ regex "(apr(e|è)s|(a|à) partir de|(un peu )?plus tard que)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1051,7 +1051,7 @@ ruleAprsLeDjeuner :: Rule
|
||||
ruleAprsLeDjeuner = Rule
|
||||
{ name = "après le déjeuner"
|
||||
, pattern =
|
||||
[ regex "apr(e|\x00e8)s (le )?d(e|\x00e9|\x00e8)jeuner"
|
||||
[ regex "apr(e|è)s (le )?d(e|é|è)jeuner"
|
||||
]
|
||||
, prod = \_ -> do
|
||||
let td1 = cycleNth TG.Day 0
|
||||
@ -1076,7 +1076,7 @@ ruleErMai :: Rule
|
||||
ruleErMai = Rule
|
||||
{ name = "1er mai"
|
||||
, pattern =
|
||||
[ regex "f(e|\x00ea)te du travail"
|
||||
[ regex "f(e|ê)te du travail"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 5 1
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ rulePremireQuinzaineDeNamedmonthinterval :: Rule
|
||||
rulePremireQuinzaineDeNamedmonthinterval = Rule
|
||||
{ name = "première quinzaine de <named-month>(interval)"
|
||||
, pattern =
|
||||
[ regex "(premi(\x00e8|e)re|1 ?(\x00e8|e)re) (quinzaine|15 ?aine) d[e']"
|
||||
[ regex "(premi(è|e)re|1 ?(è|e)re) (quinzaine|15 ?aine) d[e']"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1102,7 +1102,7 @@ ruleDeDatetimeDatetimeInterval = Rule
|
||||
, pattern =
|
||||
[ regex "de|depuis|du"
|
||||
, dimension Time
|
||||
, regex "\\-|au|jusqu'(au?|\x00e0)"
|
||||
, regex "\\-|au|jusqu'(au?|à)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1125,7 +1125,7 @@ ruleCycleProchainsuivantdaprs = Rule
|
||||
{ name = "<cycle> prochain|suivant|d'après"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "prochaine?|suivante?|qui suit|(d')? ?apr(e|\x00e8|\x00e9)s"
|
||||
, regex "prochaine?|suivante?|qui suit|(d')? ?apr(e|è|é)s"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token TimeGrain grain:_) ->
|
||||
@ -1137,7 +1137,7 @@ ruleAprsLeTravail :: Rule
|
||||
ruleAprsLeTravail = Rule
|
||||
{ name = "après le travail"
|
||||
, pattern =
|
||||
[ regex "apr(e|\x00e8)s (le )?travail"
|
||||
[ regex "apr(e|è)s (le )?travail"
|
||||
]
|
||||
, prod = \_ -> do
|
||||
let td1 = cycleNth TG.Day 0
|
||||
@ -1151,7 +1151,7 @@ ruleLeDayofmonthDatetime = Rule
|
||||
, pattern =
|
||||
[ regex "le"
|
||||
, Predicate isDOMInteger
|
||||
, regex "(a|\x00e0)"
|
||||
, regex "(a|à)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1216,7 +1216,7 @@ ruleAvantLeDjeuner :: Rule
|
||||
ruleAvantLeDjeuner = Rule
|
||||
{ name = "avant le déjeuner"
|
||||
, pattern =
|
||||
[ regex "avant (le )?d(e|\x00e9|\x00e8)jeuner"
|
||||
[ regex "avant (le )?d(e|é|è)jeuner"
|
||||
]
|
||||
, prod = \_ -> do
|
||||
let td1 = cycleNth TG.Day 0
|
||||
@ -1243,7 +1243,7 @@ ruleLeCycleProchainsuivantdaprs = Rule
|
||||
, pattern =
|
||||
[ regex "l[ae']? ?|une? ?"
|
||||
, dimension TimeGrain
|
||||
, regex "prochaine?|suivante?|qui suit|(d'? ?)?apr(e|\x00e8|\x00e9)s"
|
||||
, regex "prochaine?|suivante?|qui suit|(d'? ?)?apr(e|è|é)s"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token TimeGrain grain:_) ->
|
||||
@ -1309,7 +1309,7 @@ ruleDeuximeQuinzaineDeNamedmonthinterval :: Rule
|
||||
ruleDeuximeQuinzaineDeNamedmonthinterval = Rule
|
||||
{ name = "deuxième quinzaine de <named-month>(interval)"
|
||||
, pattern =
|
||||
[ regex "(deuxi(\x00e8|e)me|2 ?(\x00e8|e)me) (quinzaine|15 ?aine) d[e']"
|
||||
[ regex "(deuxi(è|e)me|2 ?(è|e)me) (quinzaine|15 ?aine) d[e']"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1366,7 +1366,7 @@ ruleDernierDayofweekDeTimeLatent :: Rule
|
||||
ruleDernierDayofweekDeTimeLatent = Rule
|
||||
{ name = "dernier <day-of-week> de <time> (latent)"
|
||||
, pattern =
|
||||
[ regex "derni(e|\x00e9|\x00e8)re?"
|
||||
[ regex "derni(e|é|è)re?"
|
||||
, Predicate isADayOfWeek
|
||||
, regex "d['e]"
|
||||
, dimension Time
|
||||
@ -1431,7 +1431,7 @@ ruleMatin :: Rule
|
||||
ruleMatin = Rule
|
||||
{ name = "matin"
|
||||
, pattern =
|
||||
[ regex "mat(in(\x00e9|e)?e?)?"
|
||||
[ regex "mat(in(é|e)?e?)?"
|
||||
]
|
||||
, prod = \_ -> Token Time . mkLatent . partOfDay <$>
|
||||
interval TTime.Open (hour False 4) (hour False 12)
|
||||
@ -1464,7 +1464,7 @@ ruleVersTimeofday :: Rule
|
||||
ruleVersTimeofday = Rule
|
||||
{ name = "à|vers <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "(vers|autour de|(a|\x00e0) environ|aux alentours de|(a|\x00e0))"
|
||||
[ regex "(vers|autour de|(a|à) environ|aux alentours de|(a|à))"
|
||||
, Predicate $ liftM2 (&&) isATimeOfDay isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1531,7 +1531,7 @@ ruleIntersectByMaisparExempleplutt = Rule
|
||||
{ name = "intersect by 'mais/par exemple/plutôt'"
|
||||
, pattern =
|
||||
[ Predicate isNotLatent
|
||||
, regex "mais|par exemple|plut(\x00f4|o)t"
|
||||
, regex "mais|par exemple|plut(ô|o)t"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1546,7 +1546,7 @@ ruleLeCycleAprssuivantTime = Rule
|
||||
, pattern =
|
||||
[ regex "l[ea']?"
|
||||
, dimension TimeGrain
|
||||
, regex "suivante?|apr(e|\x00e8|\x00e9)s"
|
||||
, regex "suivante?|apr(e|è|é)s"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1584,7 +1584,7 @@ ruleAprsdemain :: Rule
|
||||
ruleAprsdemain = Rule
|
||||
{ name = "après-demain"
|
||||
, pattern =
|
||||
[ regex "apr(e|\x00e8)s[- ]?demain"
|
||||
[ regex "apr(e|è)s[- ]?demain"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 2
|
||||
}
|
||||
@ -1606,7 +1606,7 @@ ruleDudansLePartofday :: Rule
|
||||
ruleDudansLePartofday = Rule
|
||||
{ name = "du|dans le <part-of-day>"
|
||||
, pattern =
|
||||
[ regex "du|dans l[ae']? ?|au|en|l[ae' ]|d(\x00e8|e)s l?[ae']?"
|
||||
[ regex "du|dans l[ae']? ?|au|en|l[ae' ]|d(è|e)s l?[ae']?"
|
||||
, Predicate isAPartOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1619,7 +1619,7 @@ ruleAuDjeuner :: Rule
|
||||
ruleAuDjeuner = Rule
|
||||
{ name = "au déjeuner"
|
||||
, pattern =
|
||||
[ regex "((\x00e0|a) l'heure du|au moment de|pendant( le)?|au)? d(e|\x00e9|\x00e8)jeuner"
|
||||
[ regex "((à|a) l'heure du|au moment de|pendant( le)?|au)? d(e|é|è)jeuner"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay <$>
|
||||
interval TTime.Open (hour False 12) (hour False 14)
|
||||
@ -1668,7 +1668,7 @@ ruleLeCycleAvantprcdentTime = Rule
|
||||
, pattern =
|
||||
[ regex "l[ea']?"
|
||||
, dimension TimeGrain
|
||||
, regex "avant|pr(\x00e9|e)c(\x00e9|e)dent"
|
||||
, regex "avant|pr(é|e)c(é|e)dent"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1691,7 +1691,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
{ name = "<time-of-day> - <time-of-day> (interval)"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "\\-|(jusqu')?(au?|\x00e0)"
|
||||
, regex "\\-|(jusqu')?(au?|à)"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1729,7 +1729,7 @@ ruleSoirDeNol :: Rule
|
||||
ruleSoirDeNol = Rule
|
||||
{ name = "soir de noël"
|
||||
, pattern =
|
||||
[ regex "soir(\x00e9e)? de no(e|\x00eb)l"
|
||||
[ regex "soir(ée)? de no(e|ë)l"
|
||||
]
|
||||
, prod = \_ -> do
|
||||
from <- intersect (monthDay 12 24) (hour False 18)
|
||||
@ -1776,7 +1776,7 @@ ruleNCycleSuivants = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 2 9999
|
||||
, dimension TimeGrain
|
||||
, regex "prochaine?s?|suivante?s?|apr(e|\x00e8|\x00e9)s|qui sui(t|ves?)|plus tard"
|
||||
, regex "prochaine?s?|suivante?s?|apr(e|è|é)s|qui sui(t|ves?)|plus tard"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -1824,7 +1824,7 @@ ruleFinDuMois :: Rule
|
||||
ruleFinDuMois = Rule
|
||||
{ name = "fin du mois"
|
||||
, pattern =
|
||||
[ regex "(en |((\x00e0|a) la ))?fin (du|de) (ce )?mois"
|
||||
[ regex "(en |((à|a) la ))?fin (du|de) (ce )?mois"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (dayOfMonth 21) (dayOfMonth 0)
|
||||
@ -1834,7 +1834,7 @@ ruleDbutDuMois :: Rule
|
||||
ruleDbutDuMois = Rule
|
||||
{ name = "début du mois"
|
||||
, pattern =
|
||||
[ regex "(en |au )?d(\x00e9|e)but (du|de) (ce )?mois"
|
||||
[ regex "(en |au )?d(é|e)but (du|de) (ce )?mois"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (dayOfMonth 1) (dayOfMonth 10)
|
||||
@ -1844,7 +1844,7 @@ ruleFinDAnnee :: Rule
|
||||
ruleFinDAnnee = Rule
|
||||
{ name = "fin d'année"
|
||||
, pattern =
|
||||
[ regex "(en |(\x00e0|a) la )?fin (d'|de l'|de cette )ann(\x00e9|e)e"
|
||||
[ regex "(en |(à|a) la )?fin (d'|de l'|de cette )ann(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (month 11) (month 1)
|
||||
@ -1854,7 +1854,7 @@ ruleDbutDAnnee :: Rule
|
||||
ruleDbutDAnnee = Rule
|
||||
{ name = "début d'année"
|
||||
, pattern =
|
||||
[ regex "(en |au )?d(\x00e9|e)but (d'|de l'|de cette )ann(\x00e9|e)e"
|
||||
[ regex "(en |au )?d(é|e)but (d'|de l'|de cette )ann(é|e)e"
|
||||
]
|
||||
, prod = \_ -> Token Time <$>
|
||||
interval TTime.Open (month 1) (month 3)
|
||||
@ -1899,17 +1899,17 @@ ruleTimezone = Rule
|
||||
months :: [(Text, String)]
|
||||
months =
|
||||
[ ( "Janvier" , "janvier|janv\\.?" )
|
||||
, ( "Fevrier" , "f(\x00e9|e)vrier|f(\x00e9|e)v\\.?" )
|
||||
, ( "Fevrier" , "f(é|e)vrier|f(é|e)v\\.?" )
|
||||
, ( "Mars" , "mars|mar\\.?" )
|
||||
, ( "Avril" , "avril|avr\\.?" )
|
||||
, ( "Mai" , "mai" )
|
||||
, ( "Juin" , "juin|jun\\.?" )
|
||||
, ( "Juillet" , "juillet|juil?\\." )
|
||||
, ( "Aout" , "ao(\x00fb|u)t|aou\\.?" )
|
||||
, ( "Aout" , "ao(û|u)t|aou\\.?" )
|
||||
, ( "Septembre" , "septembre|sept?\\.?" )
|
||||
, ( "Octobre" , "octobre|oct\\.?" )
|
||||
, ( "Novembre" , "novembre|nov\\.?" )
|
||||
, ( "Decembre" , "d(\x00e9|e)cembre|d(\x00e9|e)c\\.?" )
|
||||
, ( "Decembre" , "d(é|e)cembre|d(é|e)c\\.?" )
|
||||
]
|
||||
|
||||
ruleMonths :: [Rule]
|
||||
|
@ -28,7 +28,7 @@ ruleArInn :: Rule
|
||||
ruleArInn = Rule
|
||||
{ name = "arú inné"
|
||||
, pattern =
|
||||
[ regex "ar(\x00fa|u) inn(\x00e9|e)"
|
||||
[ regex "ar(ú|u) inn(é|e)"
|
||||
]
|
||||
, prod = \_ -> tt . cycleNth TG.Day $ - 2
|
||||
}
|
||||
@ -37,7 +37,7 @@ ruleNollaigNaMban :: Rule
|
||||
ruleNollaigNaMban = Rule
|
||||
{ name = "Nollaig na mBan"
|
||||
, pattern =
|
||||
[ regex "(l(\x00e1|a) |an )?nollaig (bheag|na mban)"
|
||||
[ regex "(l(á|a) |an )?nollaig (bheag|na mban)"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 1 6
|
||||
}
|
||||
@ -58,7 +58,7 @@ ruleAnOrdinalCycleINdiaidhTime = Rule
|
||||
[ regex "an"
|
||||
, dimension Ordinal
|
||||
, dimension TimeGrain
|
||||
, regex "(i ndiaidh|tar (\x00e9|e)is)"
|
||||
, regex "(i ndiaidh|tar (é|e)is)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -71,7 +71,7 @@ ruleInn :: Rule
|
||||
ruleInn = Rule
|
||||
{ name = "inné"
|
||||
, pattern =
|
||||
[ regex "inn(\x00e9|e)"
|
||||
[ regex "inn(é|e)"
|
||||
]
|
||||
, prod = \_ -> tt . cycleNth TG.Day $ - 1
|
||||
}
|
||||
@ -80,7 +80,7 @@ ruleLFhileBrde :: Rule
|
||||
ruleLFhileBrde = Rule
|
||||
{ name = "Lá Fhéile Bríde"
|
||||
, pattern =
|
||||
[ regex "(l(\x00e1|a) )?(fh(e|\x00e9)ile|'?le) bh?r(\x00ed|i)de"
|
||||
[ regex "(l(á|a) )?(fh(e|é)ile|'?le) bh?r(í|i)de"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 2 1
|
||||
}
|
||||
@ -89,7 +89,7 @@ ruleLFhileVailintn :: Rule
|
||||
ruleLFhileVailintn = Rule
|
||||
{ name = "Lá Fhéile Vailintín"
|
||||
, pattern =
|
||||
[ regex "(l(\x00e1|a) )?(fh(e|\x00e9)ile|'?le) vailint(\x00ed|i)n"
|
||||
[ regex "(l(á|a) )?(fh(e|é)ile|'?le) vailint(í|i)n"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 2 14
|
||||
}
|
||||
@ -125,7 +125,7 @@ ruleTimeSeoChugainn = Rule
|
||||
{ name = "<time> seo chugainn"
|
||||
, pattern =
|
||||
[ Predicate isNotLatent
|
||||
, regex "seo (chugainn|at(a|\x00e1) ag teacht)"
|
||||
, regex "seo (chugainn|at(a|á) ag teacht)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -137,7 +137,7 @@ ruleAmrach :: Rule
|
||||
ruleAmrach = Rule
|
||||
{ name = "amárach"
|
||||
, pattern =
|
||||
[ regex "am(\x00e1|a)rach"
|
||||
[ regex "am(á|a)rach"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 1
|
||||
}
|
||||
@ -190,7 +190,7 @@ ruleCycleShin = Rule
|
||||
{ name = "<cycle> ó shin"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "(\x00f3|o) shin"
|
||||
, regex "(ó|o) shin"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token TimeGrain grain:_) ->
|
||||
@ -287,7 +287,7 @@ ruleCycleInniu = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
, regex "(\x00f3|o)(n l(\x00e1|a) (at(\x00e1|a) )?)?inniu"
|
||||
, regex "(ó|o)(n l(á|a) (at(á|a) )?)?inniu"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -302,7 +302,7 @@ ruleOrdinalCycleINdiaidhTime = Rule
|
||||
, pattern =
|
||||
[ dimension Ordinal
|
||||
, dimension TimeGrain
|
||||
, regex "(i ndiaidh|tar (\x00e9|e)is)"
|
||||
, regex "(i ndiaidh|tar (é|e)is)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -358,7 +358,7 @@ ruleLNaNaithreacha :: Rule
|
||||
ruleLNaNaithreacha = Rule
|
||||
{ name = "Lá na nAithreacha"
|
||||
, pattern =
|
||||
[ regex "l(\x00e1|a) na naithreacha"
|
||||
[ regex "l(á|a) na naithreacha"
|
||||
]
|
||||
, prod = \_ -> tt $ nthDOWOfMonth 2 7 6
|
||||
}
|
||||
@ -367,7 +367,7 @@ ruleArAmrach :: Rule
|
||||
ruleArAmrach = Rule
|
||||
{ name = "arú amárach"
|
||||
, pattern =
|
||||
[ regex "ar(\x00fa|u) am(\x00e1|a)rach"
|
||||
[ regex "ar(ú|u) am(á|a)rach"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 2
|
||||
}
|
||||
@ -418,7 +418,7 @@ ruleAnNollaig :: Rule
|
||||
ruleAnNollaig = Rule
|
||||
{ name = "An Nollaig"
|
||||
, pattern =
|
||||
[ regex "(l(\x00e1|a) |an )?(nollai?g)"
|
||||
[ regex "(l(á|a) |an )?(nollai?g)"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 12 25
|
||||
}
|
||||
@ -461,7 +461,7 @@ ruleLFhilePdraig :: Rule
|
||||
ruleLFhilePdraig = Rule
|
||||
{ name = "Lá Fhéile Pádraig"
|
||||
, pattern =
|
||||
[ regex "(l(\x00e1|a) )?(fh(e|\x00e9)ile|'?le) ph?(\x00e1|a)draig"
|
||||
[ regex "(l(á|a) )?(fh(e|é)ile|'?le) ph?(á|a)draig"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 3 17
|
||||
}
|
||||
@ -472,7 +472,7 @@ ruleAnCycleINdiaidhTime = Rule
|
||||
, pattern =
|
||||
[ regex "the"
|
||||
, dimension TimeGrain
|
||||
, regex "(i ndiaidh|tar (\x00e9|e)is)"
|
||||
, regex "(i ndiaidh|tar (é|e)is)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -526,7 +526,7 @@ ruleDNamedday :: Rule
|
||||
ruleDNamedday = Rule
|
||||
{ name = "dé named-day"
|
||||
, pattern =
|
||||
[ regex "d(\x00e9|e)"
|
||||
[ regex "d(é|e)"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -603,9 +603,9 @@ ruleAnNamedday = Rule
|
||||
daysOfWeek :: [(Text, String)]
|
||||
daysOfWeek =
|
||||
[ ( "Monday" , "luai?n|lu\\.?" )
|
||||
, ( "Tuesday" , "mh?(\x00e1|a)irt|m(\x00e1|a)?\\.?" )
|
||||
, ( "Wednesday", "ch?(\x00e9|e)adaoin|c(\x00e9|e)\\.?" )
|
||||
, ( "Thursday" , "d(\x00e9|e)ardaoin|d(\x00e9|e)?\\.?" )
|
||||
, ( "Tuesday" , "mh?(á|a)irt|m(á|a)?\\.?" )
|
||||
, ( "Wednesday", "ch?(é|e)adaoin|c(é|e)\\.?" )
|
||||
, ( "Thursday" , "d(é|e)ardaoin|d(é|e)?\\.?" )
|
||||
, ( "Friday" , "h?aoine|ao\\.?" )
|
||||
, ( "Saturday" , "sathai?rn|sa\\.?" )
|
||||
, ( "Sunday" , "domhnai?[cg]h|do\\.?" )
|
||||
@ -622,18 +622,18 @@ ruleDaysOfWeek = zipWith go daysOfWeek [1..7]
|
||||
|
||||
months :: [(Text, String)]
|
||||
months =
|
||||
[ ( "January" , "(mh?(\x00ed|i) )?(an )?t?ean(\x00e1|a)ir|ean\\.?" )
|
||||
, ( "February" , "(mh?(\x00ed|i) )?(na )?feabhra|fea\\.?" )
|
||||
, ( "March" , "(mh?(\x00ed|i) )?(an )?mh?(\x00e1|a)rta|m(\x00e1|a)r\\.?" )
|
||||
, ( "April" , "(mh?(\x00ed|i) )?(an )?t?aibre(\x00e1|a)i?n|abr\\.?" )
|
||||
, ( "May" , "(mh?(\x00ed|i) )?(na )?bh?ealtaine|bea\\.?" )
|
||||
, ( "June" , "(mh?(\x00ed|i) )?(an )?mh?eith(ea|i)mh|mei\\.?" )
|
||||
, ( "July" , "(mh?(\x00ed|i) )?i(\x00fa|u)il|i(\x00fa|u)i\\.?" )
|
||||
, ( "August" , "(mh?(\x00ed|i) )?(na )?l(\x00fa|u)nasa|l(\x00fa|u)n\\.?" )
|
||||
, ( "September", "(mh?(\x00ed|i) )?mh?e(\x00e1|a)n f(\x00f3|o)mhair|mef?\\.?")
|
||||
, ( "October" , "(mh?(\x00ed|i) )?(na )?nollai?g|nol\\.?" )
|
||||
, ( "November" , "(mh?(\x00ed|i) )?(na )?samh(ain|na)|sam\\.?" )
|
||||
, ( "December" , "(mh?(\x00ed|i) )?(na )?nollai?g|nol\\.?" )
|
||||
[ ( "January" , "(mh?(í|i) )?(an )?t?ean(á|a)ir|ean\\.?" )
|
||||
, ( "February" , "(mh?(í|i) )?(na )?feabhra|fea\\.?" )
|
||||
, ( "March" , "(mh?(í|i) )?(an )?mh?(á|a)rta|m(á|a)r\\.?" )
|
||||
, ( "April" , "(mh?(í|i) )?(an )?t?aibre(á|a)i?n|abr\\.?" )
|
||||
, ( "May" , "(mh?(í|i) )?(na )?bh?ealtaine|bea\\.?" )
|
||||
, ( "June" , "(mh?(í|i) )?(an )?mh?eith(ea|i)mh|mei\\.?" )
|
||||
, ( "July" , "(mh?(í|i) )?i(ú|u)il|i(ú|u)i\\.?" )
|
||||
, ( "August" , "(mh?(í|i) )?(na )?l(ú|u)nasa|l(ú|u)n\\.?" )
|
||||
, ( "September", "(mh?(í|i) )?mh?e(á|a)n f(ó|o)mhair|mef?\\.?")
|
||||
, ( "October" , "(mh?(í|i) )?(na )?nollai?g|nol\\.?" )
|
||||
, ( "November" , "(mh?(í|i) )?(na )?samh(ain|na)|sam\\.?" )
|
||||
, ( "December" , "(mh?(í|i) )?(na )?nollai?g|nol\\.?" )
|
||||
]
|
||||
|
||||
ruleMonths :: [Rule]
|
||||
@ -650,7 +650,7 @@ ruleCycleINdiaidhTime = Rule
|
||||
{ name = "<cycle> i ndiaidh <time>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "(i ndiaidh|tar (\x00e9|e)is)"
|
||||
, regex "(i ndiaidh|tar (é|e)is)"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
|
@ -36,7 +36,7 @@ ruleNextDayofweek = Rule
|
||||
{ name = "next <day-of-week>"
|
||||
, pattern =
|
||||
[ Predicate isADayOfWeek
|
||||
, regex "(\x05d4\x05d1\x05d0(\x05d4)?)"
|
||||
, regex "(הבא(ה)?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -48,7 +48,7 @@ ruleNamedday :: Rule
|
||||
ruleNamedday = Rule
|
||||
{ name = "ב <named-day>"
|
||||
, pattern =
|
||||
[ regex "\x05d1"
|
||||
[ regex "ב"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -60,7 +60,7 @@ ruleAtHourTimeofday :: Rule
|
||||
ruleAtHourTimeofday = Rule
|
||||
{ name = "at hour <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "\x05d1\x05e9\x05e2\x05d4"
|
||||
[ regex "בשעה"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -73,7 +73,7 @@ ruleNamedmonth12 :: Rule
|
||||
ruleNamedmonth12 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05d3\x05e6\x05de\x05d1\x05e8"
|
||||
[ regex "דצמבר"
|
||||
]
|
||||
, prod = \_ -> tt $ month 12
|
||||
}
|
||||
@ -83,7 +83,7 @@ ruleHourofdayAndInteger = Rule
|
||||
{ name = "<hour-of-day> and <integer>"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "\x05d5"
|
||||
, regex "ו"
|
||||
, Predicate $ isIntegerBetween 1 59
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -101,8 +101,8 @@ ruleHourofdayAndQuarter = Rule
|
||||
{ name = "<hour-of-day> and quarter"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "\x05d5"
|
||||
, regex "\x05e8\x05d1\x05e2(\x05d9)?"
|
||||
, regex "ו"
|
||||
, regex "רבע(י)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
|
||||
@ -115,8 +115,8 @@ ruleHourofdayAndHalf = Rule
|
||||
{ name = "<hour-of-day> and half"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "\x05d5"
|
||||
, regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
|
||||
, regex "ו"
|
||||
, regex "חצי|מחצית"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
|
||||
@ -145,7 +145,7 @@ ruleHourofdayQuarter = Rule
|
||||
{ name = "<hour-of-day> quarter"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "\x05e8\x05d1\x05e2(\x05d9)?"
|
||||
, regex "רבע(י)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
|
||||
@ -158,7 +158,7 @@ ruleHourofdayHalf = Rule
|
||||
{ name = "<hour-of-day> half"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
|
||||
, regex "חצי|מחצית"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
|
||||
@ -171,7 +171,7 @@ ruleIntegerTotillbeforeIntegerHourofday = Rule
|
||||
{ name = "<integer> to|till|before <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 1 59
|
||||
, regex "\x05dc\x05e4\x05e0\x05d9|\x05dc"
|
||||
, regex "לפני|ל"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -186,8 +186,8 @@ ruleQuarterTotillbeforeIntegerHourofday :: Rule
|
||||
ruleQuarterTotillbeforeIntegerHourofday = Rule
|
||||
{ name = "quarter to|till|before <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "\x05e8\x05d1\x05e2(\x05d9)?"
|
||||
, regex "\x05dc\x05e4\x05e0\x05d9|\x05dc"
|
||||
[ regex "רבע(י)?"
|
||||
, regex "לפני|ל"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -199,8 +199,8 @@ ruleHalfTotillbeforeIntegerHourofday :: Rule
|
||||
ruleHalfTotillbeforeIntegerHourofday = Rule
|
||||
{ name = "half to|till|before <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
|
||||
, regex "\x05dc\x05e4\x05e0\x05d9|\x05dc"
|
||||
[ regex "חצי|מחצית"
|
||||
, regex "לפני|ל"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -213,7 +213,7 @@ ruleIntegerAfterpastIntegerHourofday = Rule
|
||||
{ name = "integer after|past <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 1 59
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
, regex "אחרי"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -228,8 +228,8 @@ ruleQuarterAfterpastIntegerHourofday :: Rule
|
||||
ruleQuarterAfterpastIntegerHourofday = Rule
|
||||
{ name = "quarter after|past <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "\x05e8\x05d1\x05e2(\x05d9)?"
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
[ regex "רבע(י)?"
|
||||
, regex "אחרי"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -241,8 +241,8 @@ ruleHalfAfterpastIntegerHourofday :: Rule
|
||||
ruleHalfAfterpastIntegerHourofday = Rule
|
||||
{ name = "half after|past <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
[ regex "חצי|מחצית"
|
||||
, regex "אחרי"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -254,7 +254,7 @@ ruleNamedday2 :: Rule
|
||||
ruleNamedday2 = Rule
|
||||
{ name = "named-day"
|
||||
, pattern =
|
||||
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05e0\x05d9"
|
||||
[ regex "(יום )?שני"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfWeek 1
|
||||
}
|
||||
@ -263,7 +263,7 @@ ruleSinceTimeofday :: Rule
|
||||
ruleSinceTimeofday = Rule
|
||||
{ name = "since <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "\x05de"
|
||||
[ regex "מ"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -276,7 +276,7 @@ ruleLastTime = Rule
|
||||
{ name = "last <time>"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\x05e9\x05e2\x05d1\x05e8|(\x05d4)?\x05e7\x05d5\x05d3\x05dd|(\x05d4)?\x05d0\x05d7\x05e8\x05d5\x05df"
|
||||
, regex "שעבר|(ה)?קודם|(ה)?אחרון"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -288,7 +288,7 @@ ruleNamedday6 :: Rule
|
||||
ruleNamedday6 = Rule
|
||||
{ name = "named-day"
|
||||
, pattern =
|
||||
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05d9\x05e9\x05d9"
|
||||
[ regex "(יום )?שישי"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfWeek 5
|
||||
}
|
||||
@ -298,7 +298,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
{ name = "<datetime> - <datetime> (interval)"
|
||||
, pattern =
|
||||
[ Predicate isNotLatent
|
||||
, regex "\\-|\x05e2(\x05d3)?"
|
||||
, regex "\\-|ע(ד)?"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -311,7 +311,7 @@ ruleNamedmonth7 :: Rule
|
||||
ruleNamedmonth7 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05d9\x05d5\x05dc\x05d9"
|
||||
[ regex "יולי"
|
||||
]
|
||||
, prod = \_ -> tt $ month 7
|
||||
}
|
||||
@ -320,7 +320,7 @@ ruleTheDayofmonthNonOrdinal :: Rule
|
||||
ruleTheDayofmonthNonOrdinal = Rule
|
||||
{ name = "the <day-of-month> (non ordinal)"
|
||||
, pattern =
|
||||
[ regex "\x05d4/S"
|
||||
[ regex "ה/S"
|
||||
, Predicate isDOMInteger
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -335,7 +335,7 @@ ruleCycleAfterTime = Rule
|
||||
{ name = "<cycle> after <time>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
, regex "אחרי"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -348,7 +348,7 @@ ruleInDuration :: Rule
|
||||
ruleInDuration = Rule
|
||||
{ name = "in <duration>"
|
||||
, pattern =
|
||||
[ regex "\x05d1\x05e2\x05d5\x05d3"
|
||||
[ regex "בעוד"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -360,7 +360,7 @@ ruleInNamedmonth :: Rule
|
||||
ruleInNamedmonth = Rule
|
||||
{ name = "in <named-month>"
|
||||
, pattern =
|
||||
[ regex "\x05d1"
|
||||
[ regex "ב"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -372,7 +372,7 @@ ruleNow :: Rule
|
||||
ruleNow = Rule
|
||||
{ name = "now"
|
||||
, pattern =
|
||||
[ regex "\x05e2\x05db\x05e9\x05d9\x05d5|\x05de\x05d9\x05d9\x05d3"
|
||||
[ regex "עכשיו|מייד"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Second 0
|
||||
}
|
||||
@ -382,7 +382,7 @@ ruleCurrentDayofweek = Rule
|
||||
{ name = "current <day-of-week>"
|
||||
, pattern =
|
||||
[ Predicate isADayOfWeek
|
||||
, regex "(\x05d4\x05d6\x05d4|\x05d4\x05d6\x05d0\x05ea|\x05d4\x05e7\x05e8\x05d5\x05d1(\x05d4)?)"
|
||||
, regex "(הזה|הזאת|הקרוב(ה)?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -394,9 +394,9 @@ ruleFromDatetimeDatetimeInterval :: Rule
|
||||
ruleFromDatetimeDatetimeInterval = Rule
|
||||
{ name = "from <datetime> - <datetime> (interval)"
|
||||
, pattern =
|
||||
[ regex "\x05de|\x05de\x05e9\x05e2\x05d4"
|
||||
[ regex "מ|משעה"
|
||||
, dimension Time
|
||||
, regex "\\-|\x05e2\x05d3"
|
||||
, regex "\\-|עד"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -409,7 +409,7 @@ ruleNamedday4 :: Rule
|
||||
ruleNamedday4 = Rule
|
||||
{ name = "named-day"
|
||||
, pattern =
|
||||
[ regex "(\x05d9\x05d5\x05dd )?\x05e8\x05d1\x05d9\x05e2\x05d9"
|
||||
[ regex "(יום )?רביעי"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfWeek 3
|
||||
}
|
||||
@ -418,9 +418,9 @@ ruleTheCycleAfterTime :: Rule
|
||||
ruleTheCycleAfterTime = Rule
|
||||
{ name = "the <cycle> after <time>"
|
||||
, pattern =
|
||||
[ regex "\x05d4"
|
||||
[ regex "ה"
|
||||
, dimension TimeGrain
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
, regex "אחרי"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -433,9 +433,9 @@ ruleTheCycleBeforeTime :: Rule
|
||||
ruleTheCycleBeforeTime = Rule
|
||||
{ name = "the <cycle> before <time>"
|
||||
, pattern =
|
||||
[ regex "\x05d4"
|
||||
[ regex "ה"
|
||||
, dimension TimeGrain
|
||||
, regex "\x05dc\x05e4\x05e0\x05d9"
|
||||
, regex "לפני"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -449,7 +449,7 @@ ruleLastDayofweek = Rule
|
||||
{ name = "last <day-of-week>"
|
||||
, pattern =
|
||||
[ Predicate isADayOfWeek
|
||||
, regex "(\x05e9\x05e2\x05d1\x05e8(\x05d4)?|\x05d4\x05e7\x05d5\x05d3\x05de\x05ea|\x05d4\x05e7\x05d5\x05d3\x05dd)"
|
||||
, regex "(שעבר(ה)?|הקודמת|הקודם)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -461,7 +461,7 @@ ruleTheIdesOfNamedmonth :: Rule
|
||||
ruleTheIdesOfNamedmonth = Rule
|
||||
{ name = "the ides of <named-month>"
|
||||
, pattern =
|
||||
[ regex "\x05d1\x05d0\x05de\x05e6\x05e2"
|
||||
[ regex "באמצע"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -475,7 +475,7 @@ ruleNoon :: Rule
|
||||
ruleNoon = Rule
|
||||
{ name = "noon"
|
||||
, pattern =
|
||||
[ regex "(\x05d1)?\x05e6\x05d4\x05e8\x05d9\x05d9\x05dd"
|
||||
[ regex "(ב)?צהריים"
|
||||
]
|
||||
, prod = \_ -> tt $ hour False 12
|
||||
}
|
||||
@ -484,7 +484,7 @@ ruleToday :: Rule
|
||||
ruleToday = Rule
|
||||
{ name = "today"
|
||||
, pattern =
|
||||
[ regex "\x05d4\x05d9\x05d5\x05dd"
|
||||
[ regex "היום"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 0
|
||||
}
|
||||
@ -493,9 +493,9 @@ ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
|
||||
ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
{ name = "between <time-of-day> and <time-of-day> (interval)"
|
||||
, pattern =
|
||||
[ regex "\x05d1\x05d9\x05df"
|
||||
[ regex "בין"
|
||||
, Predicate isATimeOfDay
|
||||
, regex "\x05dc"
|
||||
, regex "ל"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -509,7 +509,7 @@ ruleNextCycle = Rule
|
||||
{ name = "next <cycle>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "\x05d4\x05d1\x05d0(\x05d4)?"
|
||||
, regex "הבא(ה)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token TimeGrain grain:_) -> tt $ cycleNth grain 1
|
||||
@ -520,7 +520,7 @@ ruleNamedmonth :: Rule
|
||||
ruleNamedmonth = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05d9\x05e0\x05d5\x05d0\x05e8"
|
||||
[ regex "ינואר"
|
||||
]
|
||||
, prod = \_ -> tt $ month 1
|
||||
}
|
||||
@ -529,7 +529,7 @@ ruleNamedmonth3 :: Rule
|
||||
ruleNamedmonth3 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05de\x05e8\x05e5"
|
||||
[ regex "מרץ"
|
||||
]
|
||||
, prod = \_ -> tt $ month 3
|
||||
}
|
||||
@ -538,7 +538,7 @@ ruleForDuration :: Rule
|
||||
ruleForDuration = Rule
|
||||
{ name = "for <duration>"
|
||||
, pattern =
|
||||
[ regex "\x05ea\x05d5\x05da"
|
||||
[ regex "תוך"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -552,7 +552,7 @@ ruleDurationFromNow = Rule
|
||||
{ name = "<duration> from now"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "\x05de\x05e2\x05db\x05e9\x05d9\x05d5"
|
||||
, regex "מעכשיו"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Duration dd:_) ->
|
||||
@ -564,7 +564,7 @@ ruleLunch :: Rule
|
||||
ruleLunch = Rule
|
||||
{ name = "lunch"
|
||||
, pattern =
|
||||
[ regex "(\x05d1)?\x05e6\x05d4\x05e8\x05d9\x05d9\x05dd"
|
||||
[ regex "(ב)?צהריים"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay . mkLatent <$>
|
||||
interval TTime.Open (hour False 12) (hour False 14)
|
||||
@ -575,7 +575,7 @@ ruleLastCycle = Rule
|
||||
{ name = "last <cycle>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "\x05d4\x05d0\x05d7\x05e8\x05d5\x05df|\x05d4\x05d0\x05d7\x05e8\x05d5\x05e0\x05d4|\x05e9\x05e2\x05d1\x05e8|\x05e9\x05e2\x05d1\x05e8\x05d4"
|
||||
, regex "האחרון|האחרונה|שעבר|שעברה"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token TimeGrain grain:_) ->
|
||||
@ -587,7 +587,7 @@ ruleAfternoon :: Rule
|
||||
ruleAfternoon = Rule
|
||||
{ name = "afternoon"
|
||||
, pattern =
|
||||
[ regex "\x05d0\x05d7\x05d4(\x05f4)?\x05e6|\x05d0\x05d7\x05e8 \x05d4\x05e6\x05d4\x05e8\x05d9\x05d9\x05dd"
|
||||
[ regex "אחה(״)?צ|אחר הצהריים"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay . mkLatent <$>
|
||||
interval TTime.Open (hour False 12) (hour False 19)
|
||||
@ -597,7 +597,7 @@ ruleNamedmonth4 :: Rule
|
||||
ruleNamedmonth4 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05d0\x05e4\x05e8\x05d9\x05dc"
|
||||
[ regex "אפריל"
|
||||
]
|
||||
, prod = \_ -> tt $ month 4
|
||||
}
|
||||
@ -618,7 +618,7 @@ ruleNamedday5 :: Rule
|
||||
ruleNamedday5 = Rule
|
||||
{ name = "named-day"
|
||||
, pattern =
|
||||
[ regex "(\x05d9\x05d5\x05dd )?\x05d7\x05de\x05d9\x05e9\x05d9"
|
||||
[ regex "(יום )?חמישי"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfWeek 4
|
||||
}
|
||||
@ -654,7 +654,7 @@ ruleNthTimeAfterTime = Rule
|
||||
, pattern =
|
||||
[ dimension Ordinal
|
||||
, dimension Time
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
, regex "אחרי"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -681,7 +681,7 @@ ruleAfterDuration :: Rule
|
||||
ruleAfterDuration = Rule
|
||||
{ name = "after <duration>"
|
||||
, pattern =
|
||||
[ regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
[ regex "אחרי"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -707,7 +707,7 @@ ruleDayofmonthOrdinalOfNamedmonth = Rule
|
||||
{ name = "<day-of-month> (ordinal) of <named-month>"
|
||||
, pattern =
|
||||
[ Predicate isDOMOrdinal
|
||||
, regex "\x05e9\x05dc|\x05d1|\x05dc"
|
||||
, regex "של|ב|ל"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -719,7 +719,7 @@ ruleNamedmonth2 :: Rule
|
||||
ruleNamedmonth2 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05e4\x05d1\x05e8\x05d5\x05d0\x05e8"
|
||||
[ regex "פברואר"
|
||||
]
|
||||
, prod = \_ -> tt $ month 2
|
||||
}
|
||||
@ -728,7 +728,7 @@ ruleThisEvening :: Rule
|
||||
ruleThisEvening = Rule
|
||||
{ name = "this evening"
|
||||
, pattern =
|
||||
[ regex "\x05d4\x05e2\x05e8\x05d1"
|
||||
[ regex "הערב"
|
||||
]
|
||||
, prod = \_ -> do
|
||||
td <- interval TTime.Open (hour False 18) (hour False 0)
|
||||
@ -739,9 +739,9 @@ ruleBetweenDatetimeAndDatetimeInterval :: Rule
|
||||
ruleBetweenDatetimeAndDatetimeInterval = Rule
|
||||
{ name = "between <datetime> and <datetime> (interval)"
|
||||
, pattern =
|
||||
[ regex "\x05d1\x05d9\x05df"
|
||||
[ regex "בין"
|
||||
, dimension Time
|
||||
, regex "\x05dc"
|
||||
, regex "ל"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -754,7 +754,7 @@ ruleEndOfYear :: Rule
|
||||
ruleEndOfYear = Rule
|
||||
{ name = "End of year"
|
||||
, pattern =
|
||||
[ regex "\x05e1\x05d5\x05e3 (\x05d4)?\x05e9\x05e0\x05d4"
|
||||
[ regex "סוף (ה)?שנה"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Year 1
|
||||
}
|
||||
@ -763,7 +763,7 @@ ruleDurationAgo :: Rule
|
||||
ruleDurationAgo = Rule
|
||||
{ name = "<duration> ago"
|
||||
, pattern =
|
||||
[ regex "\x05dc\x05e4\x05e0\x05d9"
|
||||
[ regex "לפני"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -778,7 +778,7 @@ ruleLastNCycle = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
, regex "\x05d0\x05d7\x05e8\x05d5\x05df|\x05d0\x05d7\x05e8\x05d5\x05e0\x05d5\x05ea|\x05d0\x05d7\x05e8\x05d5\x05e0\x05d4|\x05d0\x05d7\x05e8\x05d5\x05e0\x05d9\x05dd"
|
||||
, regex "אחרון|אחרונות|אחרונה|אחרונים"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -791,7 +791,7 @@ ruleMidnighteodendOfDay :: Rule
|
||||
ruleMidnighteodendOfDay = Rule
|
||||
{ name = "midnight|EOD|end of day"
|
||||
, pattern =
|
||||
[ regex "(\x05d1)?\x05d7\x05e6\x05d5\x05ea"
|
||||
[ regex "(ב)?חצות"
|
||||
]
|
||||
, prod = \_ -> tt $ hour False 0
|
||||
}
|
||||
@ -824,7 +824,7 @@ ruleUntilTimeofday :: Rule
|
||||
ruleUntilTimeofday = Rule
|
||||
{ name = "until <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "\x05e2\x05d3"
|
||||
[ regex "עד"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -837,7 +837,7 @@ ruleAtTimeofday :: Rule
|
||||
ruleAtTimeofday = Rule
|
||||
{ name = "at <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "\x05d1"
|
||||
[ regex "ב"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -849,7 +849,7 @@ ruleNamedmonth6 :: Rule
|
||||
ruleNamedmonth6 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05d9\x05d5\x05e0\x05d9"
|
||||
[ regex "יוני"
|
||||
]
|
||||
, prod = \_ -> tt $ month 6
|
||||
}
|
||||
@ -860,7 +860,7 @@ ruleNthTimeOfTime = Rule
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, dimension Ordinal
|
||||
, regex "\x05e9\x05dc|\x05d1"
|
||||
, regex "של|ב"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -873,7 +873,7 @@ ruleNamedmonth8 :: Rule
|
||||
ruleNamedmonth8 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05d0\x05d5\x05d2\x05d5\x05e1\x05d8"
|
||||
[ regex "אוגוסט"
|
||||
]
|
||||
, prod = \_ -> tt $ month 8
|
||||
}
|
||||
@ -894,7 +894,7 @@ ruleWeekend :: Rule
|
||||
ruleWeekend = Rule
|
||||
{ name = "week-end"
|
||||
, pattern =
|
||||
[ regex "(\x05e1\x05d5\x05e4\x05f4\x05e9|\x05e1\x05d5\x05e3 \x05d4\x05e9\x05d1\x05d5\x05e2)"
|
||||
[ regex "(סופ״ש|סוף השבוע)"
|
||||
]
|
||||
, prod = \_ -> tt weekend
|
||||
}
|
||||
@ -915,7 +915,7 @@ ruleDate :: Rule
|
||||
ruleDate = Rule
|
||||
{ name = "ב <date>"
|
||||
, pattern =
|
||||
[ regex "\x05d1"
|
||||
[ regex "ב"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -928,7 +928,7 @@ ruleNextTime = Rule
|
||||
{ name = "next <time>"
|
||||
, pattern =
|
||||
[ Predicate isNotLatent
|
||||
, regex "\x05d4\x05d1\x05d0(\x05d4)?"
|
||||
, regex "הבא(ה)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> tt $ predNth 0 True td
|
||||
@ -968,10 +968,10 @@ ruleTheOrdinalCycleAfterTime :: Rule
|
||||
ruleTheOrdinalCycleAfterTime = Rule
|
||||
{ name = "the <ordinal> <cycle> after <time>"
|
||||
, pattern =
|
||||
[ regex "\x05d4"
|
||||
[ regex "ה"
|
||||
, dimension Ordinal
|
||||
, dimension TimeGrain
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9|\x05dc\x05d0\x05d7\x05e8"
|
||||
, regex "אחרי|לאחר"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -986,7 +986,7 @@ ruleNextNCycle = Rule
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
, regex "\x05d4\x05d1\x05d0|\x05d4\x05d1\x05d0\x05d4|\x05d4\x05d1\x05d0\x05d9\x05dd|\x05d4\x05d1\x05d0\x05d5\x05ea"
|
||||
, regex "הבא|הבאה|הבאים|הבאות"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:Token TimeGrain grain:_) -> do
|
||||
@ -999,7 +999,7 @@ ruleMorning :: Rule
|
||||
ruleMorning = Rule
|
||||
{ name = "morning"
|
||||
, pattern =
|
||||
[ regex "(\x05d1)?\x05d1\x05d5\x05e7\x05e8"
|
||||
[ regex "(ב)?בוקר"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay . mkLatent <$>
|
||||
interval TTime.Open (hour False 4) (hour False 12)
|
||||
@ -1010,7 +1010,7 @@ ruleThisCycle = Rule
|
||||
{ name = "this <cycle>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "\x05d4\x05e7\x05e8\x05d5(\x05d1)?\x05d4|\x05d4\x05d6\x05d4|\x05d4\x05d6\x05d0\x05ea"
|
||||
, regex "הקרו(ב)?ה|הזה|הזאת"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token TimeGrain grain:_) ->
|
||||
@ -1023,7 +1023,7 @@ ruleThisTime = Rule
|
||||
{ name = "this <time>"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\x05d4\x05e7\x05e8\x05d5\x05d1|\x05d4\x05d6\x05d4"
|
||||
, regex "הקרוב|הזה"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -1036,7 +1036,7 @@ ruleDayofmonthNonOrdinalOfNamedmonth = Rule
|
||||
{ name = "<day-of-month> (non ordinal) of <named-month>"
|
||||
, pattern =
|
||||
[ Predicate isDOMInteger
|
||||
, regex "\x05e9\x05dc|\x05d1|\x05dc"
|
||||
, regex "של|ב|ל"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1048,7 +1048,7 @@ ruleEndOfMonth :: Rule
|
||||
ruleEndOfMonth = Rule
|
||||
{ name = "End of month"
|
||||
, pattern =
|
||||
[ regex "\x05e1\x05d5\x05e3 (\x05d4)?\x05d7\x05d5\x05d3\x05e9"
|
||||
[ regex "סוף (ה)?חודש"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Month 1
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ ruleYesterday :: Rule
|
||||
ruleYesterday = Rule
|
||||
{ name = "yesterday"
|
||||
, pattern =
|
||||
[ regex "(\x05d0\x05ea\x05de\x05d5\x05dc|\x05d0\x05de\x05e9)"
|
||||
[ regex "(אתמול|אמש)"
|
||||
]
|
||||
, prod = \_ -> tt . cycleNth TG.Day $ - 1
|
||||
}
|
||||
@ -1066,7 +1066,7 @@ ruleAfterTimeofday :: Rule
|
||||
ruleAfterTimeofday = Rule
|
||||
{ name = "after <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "\x05d0\x05d7\x05e8\x05d9"
|
||||
[ regex "אחרי"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1106,7 +1106,7 @@ ruleOrdinalCycleAfterTime = Rule
|
||||
, pattern =
|
||||
[ dimension Ordinal
|
||||
, dimension TimeGrain
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9|\x05dc\x05d0\x05d7\x05e8"
|
||||
, regex "אחרי|לאחר"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1119,7 +1119,7 @@ ruleNamedmonth5 :: Rule
|
||||
ruleNamedmonth5 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05de\x05d0\x05d9"
|
||||
[ regex "מאי"
|
||||
]
|
||||
, prod = \_ -> tt $ month 5
|
||||
}
|
||||
@ -1128,7 +1128,7 @@ ruleNamedday7 :: Rule
|
||||
ruleNamedday7 = Rule
|
||||
{ name = "named-day"
|
||||
, pattern =
|
||||
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05d1\x05ea"
|
||||
[ regex "(יום )?שבת"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfWeek 6
|
||||
}
|
||||
@ -1152,7 +1152,7 @@ ruleTimeOfPartofday = Rule
|
||||
{ name = "<time> of <part-of-day>"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\x05d1"
|
||||
, regex "ב"
|
||||
, Predicate isAPartOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1177,7 +1177,7 @@ ruleNamedmonth10 :: Rule
|
||||
ruleNamedmonth10 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05d0\x05d5\x05e7\x05d8\x05d5\x05d1\x05e8"
|
||||
[ regex "אוקטובר"
|
||||
]
|
||||
, prod = \_ -> tt $ month 10
|
||||
}
|
||||
@ -1198,7 +1198,7 @@ ruleNamedday8 :: Rule
|
||||
ruleNamedday8 = Rule
|
||||
{ name = "named-day"
|
||||
, pattern =
|
||||
[ regex "(\x05d9\x05d5\x05dd )?\x05e8\x05d0\x05e9\x05d5\x05df"
|
||||
[ regex "(יום )?ראשון"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfWeek 7
|
||||
}
|
||||
@ -1220,7 +1220,7 @@ ruleLastDayofweekOfTime = Rule
|
||||
{ name = "last <day-of-week> of <time>"
|
||||
, pattern =
|
||||
[ Predicate isADayOfWeek
|
||||
, regex "\x05d4\x05d0\x05d7\x05e8\x05d5\x05df \x05e9\x05dc"
|
||||
, regex "האחרון של"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1250,7 +1250,7 @@ ruleCycleBeforeTime = Rule
|
||||
{ name = "<cycle> before <time>"
|
||||
, pattern =
|
||||
[ dimension TimeGrain
|
||||
, regex "\x05dc\x05e4\x05e0\x05d9"
|
||||
, regex "לפני"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1263,7 +1263,7 @@ ruleNamedmonth11 :: Rule
|
||||
ruleNamedmonth11 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05e0\x05d5\x05d1\x05de\x05d1\x05e8"
|
||||
[ regex "נובמבר"
|
||||
]
|
||||
, prod = \_ -> tt $ month 11
|
||||
}
|
||||
@ -1273,7 +1273,7 @@ ruleDurationAfterTime = Rule
|
||||
{ name = "<duration> after <time>"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "\x05d0\x05d7\x05e8\x05d9|\x05dc\x05d0\x05d7\x05e8"
|
||||
, regex "אחרי|לאחר"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1286,7 +1286,7 @@ ruleEveningnight :: Rule
|
||||
ruleEveningnight = Rule
|
||||
{ name = "evening|night"
|
||||
, pattern =
|
||||
[ regex "(\x05d1)?\x05e2\x05e8\x05d1"
|
||||
[ regex "(ב)?ערב"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay . mkLatent <$>
|
||||
interval TTime.Open (hour False 18) (hour False 0)
|
||||
@ -1311,7 +1311,7 @@ ruleNamedday3 :: Rule
|
||||
ruleNamedday3 = Rule
|
||||
{ name = "named-day"
|
||||
, pattern =
|
||||
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05dc\x05d9\x05e9\x05d9"
|
||||
[ regex "(יום )?שלישי"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfWeek 2
|
||||
}
|
||||
@ -1320,7 +1320,7 @@ ruleTheDayofmonthOrdinal :: Rule
|
||||
ruleTheDayofmonthOrdinal = Rule
|
||||
{ name = "the <day-of-month> (ordinal)"
|
||||
, pattern =
|
||||
[ regex "\x05d4"
|
||||
[ regex "ה"
|
||||
, Predicate isDOMOrdinal
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1335,7 +1335,7 @@ ruleDurationBeforeTime = Rule
|
||||
{ name = "<duration> before <time>"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "\x05dc\x05e4\x05e0\x05d9"
|
||||
, regex "לפני"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1348,9 +1348,9 @@ rulePartofdayOfTime :: Rule
|
||||
rulePartofdayOfTime = Rule
|
||||
{ name = "<part-of-day> of <time>"
|
||||
, pattern =
|
||||
[ regex "\x05d1"
|
||||
[ regex "ב"
|
||||
, Predicate isAPartOfDay
|
||||
, regex "\x05e9\x05dc"
|
||||
, regex "של"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1377,7 +1377,7 @@ ruleTomorrow :: Rule
|
||||
ruleTomorrow = Rule
|
||||
{ name = "tomorrow"
|
||||
, pattern =
|
||||
[ regex "(\x05de\x05d7\x05e8|\x05dc\x05de\x05d7\x05e8\x05ea)"
|
||||
[ regex "(מחר|למחרת)"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 1
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ ruleNamedmonth9 :: Rule
|
||||
ruleNamedmonth9 = Rule
|
||||
{ name = "named-month"
|
||||
, pattern =
|
||||
[ regex "\x05e1\x05e4\x05d8\x05de\x05d1\x05e8"
|
||||
[ regex "ספטמבר"
|
||||
]
|
||||
, prod = \_ -> tt $ month 9
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ daysOfWeek =
|
||||
[ ( "Monday" , "ponedjelja?ka?|pon\\.?" )
|
||||
, ( "Tuesday" , "utora?ka?|uto?\\.?" )
|
||||
, ( "Wednesday", "srijed(a|e|u)|sri\\.?" )
|
||||
, ( "Thursday" , "(\x010d|c)etvrta?ka?|(\x010d|c)et\\.?" )
|
||||
, ( "Thursday" , "(č|c)etvrta?ka?|(č|c)et\\.?" )
|
||||
, ( "Friday" , "peta?ka?|pet\\.?" )
|
||||
, ( "Saturday" , "subot(a|e|u)|sub?\\.?" )
|
||||
, ( "Sunday" , "nedjelj(a|e|u)|ned\\.?" )
|
||||
@ -53,12 +53,12 @@ ruleDaysOfWeek = zipWith go daysOfWeek [1..7]
|
||||
|
||||
months :: [(Text, String)]
|
||||
months =
|
||||
[ ( "January" , "sije(c|\x010d)a?nj(a|u)?|januar(a|u)?|jan\\.?|sij?\\.?|prv(i|a|o(ga?)?)" )
|
||||
, ( "February" , "(ve)?lja(c|\x010d)(a|e|i)|februar(a|u)?|feb\\.?|ve(lj)?\\.?|drug(i|a|o(ga?)?)" )
|
||||
, ( "March" , "o(z|\x017e)uja?k(a|u)?|mart(a|u)?|mar\\.?|o(z|\x017e)u?\\.?|tre(c|\x0107)(i|a|e(ga?)?)" )
|
||||
, ( "April" , "trava?nj(a|u)?|april(a|u)?|apr\\.?|tra\\.?|(\x010d|c)etvrt(i|a|o(ga?)?)" )
|
||||
[ ( "January" , "sije(c|č)a?nj(a|u)?|januar(a|u)?|jan\\.?|sij?\\.?|prv(i|a|o(ga?)?)" )
|
||||
, ( "February" , "(ve)?lja(c|č)(a|e|i)|februar(a|u)?|feb\\.?|ve(lj)?\\.?|drug(i|a|o(ga?)?)" )
|
||||
, ( "March" , "o(z|ž)uja?k(a|u)?|mart(a|u)?|mar\\.?|o(z|ž)u?\\.?|tre(c|ć)(i|a|e(ga?)?)" )
|
||||
, ( "April" , "trava?nj(a|u)?|april(a|u)?|apr\\.?|tra\\.?|(č|c)etvrt(i|a|o(ga?)?)" )
|
||||
, ( "May" , "sviba?nj(a|u)?|maj|svi\\.?|pet(i|a|o(ga?)?)" )
|
||||
, ( "June" , "lipa?nj(a|u)?|jun(i|u|a)?|jun\\.?|lip?\\.?|(\x0161|s)est(i|a|o(ga?)?)" )
|
||||
, ( "June" , "lipa?nj(a|u)?|jun(i|u|a)?|jun\\.?|lip?\\.?|(š|s)est(i|a|o(ga?)?)" )
|
||||
, ( "July" , "srpa?nj(a|u)?|jul(i|u|a)?|jul\\.?|srp\\.?|sedm(i|a|o(ga?)?)" )
|
||||
, ( "August" , "kolovoz(a|u)?|august(a|u)?|aug\\.?|kol\\.?|osm(i|a|o(ga?)?)" )
|
||||
, ( "September", "ruja?n(a|u)?|septemba?r(a|u)?|sept?\\.?|ruj\\.?|devet(i|a|o(ga?)?)" )
|
||||
@ -108,7 +108,7 @@ ruleQuarterTotillbeforeIntegerHourofday :: Rule
|
||||
ruleQuarterTotillbeforeIntegerHourofday = Rule
|
||||
{ name = "quarter to|till|before <integer> (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "(kvarata?|(c|\x010d)etvrt|frtalj)\\s+do"
|
||||
[ regex "(kvarata?|(c|č)etvrt|frtalj)\\s+do"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -148,7 +148,7 @@ ruleQuarterAfterpastHourofday :: Rule
|
||||
ruleQuarterAfterpastHourofday = Rule
|
||||
{ name = "quarter after|past (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "(kvarata?|(c|\x010d)etvrt|frtalj)\\s+(poslije|nakon)"
|
||||
[ regex "(kvarata?|(c|č)etvrt|frtalj)\\s+(poslije|nakon)"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -189,7 +189,7 @@ ruleHourofdayQuarter = Rule
|
||||
{ name = "<hour-of-day> quarter"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "kvarata?|(c|\x010d)etvrt|frtalj"
|
||||
, regex "kvarata?|(c|č)etvrt|frtalj"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
|
||||
@ -232,7 +232,7 @@ ruleZaQuarterHourofday :: Rule
|
||||
ruleZaQuarterHourofday = Rule
|
||||
{ name = "za quarter (hour-of-day)"
|
||||
, pattern =
|
||||
[ regex "za\\s+(kvarata?|(c|\x010d)etvrt|frtalj)"
|
||||
[ regex "za\\s+(kvarata?|(c|č)etvrt|frtalj)"
|
||||
, Predicate isAnHourOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -290,7 +290,7 @@ ruleLastTime :: Rule
|
||||
ruleLastTime = Rule
|
||||
{ name = "last <time>"
|
||||
, pattern =
|
||||
[ regex "(prethodn(i|u|a|e|o(ga?)?)|pro(s|\x0161)l(ih?|u|a|e|o(ga?)?))"
|
||||
[ regex "(prethodn(i|u|a|e|o(ga?)?)|pro(s|š)l(ih?|u|a|e|o(ga?)?))"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -367,7 +367,7 @@ ruleFromDatetimeDatetimeInterval :: Rule
|
||||
ruleFromDatetimeDatetimeInterval = Rule
|
||||
{ name = "from <datetime> - <datetime> (interval)"
|
||||
, pattern =
|
||||
[ regex "od|izme(dj|\x0111)u"
|
||||
[ regex "od|izme(dj|đ)u"
|
||||
, dimension Time
|
||||
, regex "\\-"
|
||||
, dimension Time
|
||||
@ -405,7 +405,7 @@ ruleSeason4 :: Rule
|
||||
ruleSeason4 = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "prolje(c|\x0107)(e|a)"
|
||||
[ regex "prolje(c|ć)(e|a)"
|
||||
]
|
||||
, prod = \_ ->
|
||||
Token Time <$> interval TTime.Open (monthDay 3 20) (monthDay 6 21)
|
||||
@ -429,7 +429,7 @@ ruleTimeAfterNext = Rule
|
||||
{ name = "<time> after next"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "nakon sljede(\x0107|c)(i|e|a)(ga?)?"
|
||||
, regex "nakon sljede(ć|c)(i|e|a)(ga?)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> Just . Token Time $ predNth 1 True td
|
||||
@ -459,7 +459,7 @@ ruleToday :: Rule
|
||||
ruleToday = Rule
|
||||
{ name = "today"
|
||||
, pattern =
|
||||
[ regex "danas?|(dana(s|\x0161)nj(i|eg) dana?) "
|
||||
[ regex "danas?|(dana(s|š)nj(i|eg) dana?) "
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ cycleNth TG.Day 0
|
||||
}
|
||||
@ -468,7 +468,7 @@ ruleThisnextDayofweek :: Rule
|
||||
ruleThisnextDayofweek = Rule
|
||||
{ name = "this|next <day-of-week>"
|
||||
, pattern =
|
||||
[ regex "ov(aj?|og?|e)|sljede(c|\x0107)(i|u|a|e(ga?)?)"
|
||||
[ regex "ov(aj?|og?|e)|sljede(c|ć)(i|u|a|e(ga?)?)"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -480,7 +480,7 @@ ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
|
||||
ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
{ name = "between <time-of-day> and <time-of-day> (interval)"
|
||||
, pattern =
|
||||
[ regex "od|izme(dj|\x0111)u"
|
||||
[ regex "od|izme(dj|đ)u"
|
||||
, Predicate isATimeOfDay
|
||||
, regex "do|i"
|
||||
, Predicate isATimeOfDay
|
||||
@ -495,7 +495,7 @@ ruleNextCycle :: Rule
|
||||
ruleNextCycle = Rule
|
||||
{ name = "next <cycle>"
|
||||
, pattern =
|
||||
[ regex "sljede(c|\x0107)(i|a|u|e(ga?)?)"
|
||||
[ regex "sljede(c|ć)(i|a|u|e(ga?)?)"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -519,7 +519,7 @@ ruleForDuration :: Rule
|
||||
ruleForDuration = Rule
|
||||
{ name = "for <duration>"
|
||||
, pattern =
|
||||
[ regex "za( jo(s|\x0161))?|u"
|
||||
[ regex "za( jo(s|š))?|u"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -547,7 +547,7 @@ ruleDurationFromNow = Rule
|
||||
{ name = "<duration> from now"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "od (sada?|ovog trenutka|dana(s|\x0161)nj(i|eg) dana?)"
|
||||
, regex "od (sada?|ovog trenutka|dana(s|š)nj(i|eg) dana?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Duration dd:_) -> Just . Token Time $ inDuration dd
|
||||
@ -558,7 +558,7 @@ ruleLunch :: Rule
|
||||
ruleLunch = Rule
|
||||
{ name = "lunch"
|
||||
, pattern =
|
||||
[ regex "(((za )|(u vrijeme )) )?ru(c|\x010d)a?k(a|om)?"
|
||||
[ regex "(((za )|(u vrijeme )) )?ru(c|č)a?k(a|om)?"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay . mkLatent <$>
|
||||
interval TTime.Open (hour False 12) (hour False 14)
|
||||
@ -568,7 +568,7 @@ ruleLastCycle :: Rule
|
||||
ruleLastCycle = Rule
|
||||
{ name = "last <cycle>"
|
||||
, pattern =
|
||||
[ regex "prethodn(i|a|e|u)|pro(s|\x0161)l(i|a|e|u|o(ga?)?)"
|
||||
[ regex "prethodn(i|a|e|u)|pro(s|š)l(i|a|e|u|o(ga?)?)"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -605,7 +605,7 @@ ruleTimeBeforeLast = Rule
|
||||
{ name = "<time> before last"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "prije (prethodn(e|o(ga?)?)|pro(s|\x0161)l(ih?|u|a|e|o(ga?)?))"
|
||||
, regex "prije (prethodn(e|o(ga?)?)|pro(s|š)l(ih?|u|a|e|o(ga?)?))"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -617,7 +617,7 @@ ruleLateNight :: Rule
|
||||
ruleLateNight = Rule
|
||||
{ name = "late night"
|
||||
, pattern =
|
||||
[ regex "(((u|po)\\s)?no(c|\x0107)(i|as|u)?|u?jutros?)"
|
||||
[ regex "(((u|po)\\s)?no(c|ć)(i|as|u)?|u?jutros?)"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay . mkLatent <$>
|
||||
interval TTime.Open (hour False 0) (hour False 4)
|
||||
@ -700,7 +700,7 @@ ruleAfterDuration :: Rule
|
||||
ruleAfterDuration = Rule
|
||||
{ name = "after <duration>"
|
||||
, pattern =
|
||||
[ regex "(nakon|poslije)( jo(s|\x0161))?"
|
||||
[ regex "(nakon|poslije)( jo(s|š))?"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -753,7 +753,7 @@ ruleExactlyTimeofday :: Rule
|
||||
ruleExactlyTimeofday = Rule
|
||||
{ name = "exactly <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "to(c|\x010d)no( u)?"
|
||||
[ regex "to(c|č)no( u)?"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -797,7 +797,7 @@ ruleBetweenDatetimeAndDatetimeInterval :: Rule
|
||||
ruleBetweenDatetimeAndDatetimeInterval = Rule
|
||||
{ name = "between <datetime> and <datetime> (interval)"
|
||||
, pattern =
|
||||
[ regex "od|izme(dj|\x0111)u"
|
||||
[ regex "od|izme(dj|đ)u"
|
||||
, dimension Time
|
||||
, regex "do|i"
|
||||
, dimension Time
|
||||
@ -860,7 +860,7 @@ ruleLastNCycle :: Rule
|
||||
ruleLastNCycle = Rule
|
||||
{ name = "last n <cycle>"
|
||||
, pattern =
|
||||
[ regex "prethodn(ih?|a|e)|pro(s|\x0161)l(a|e|ih?)"
|
||||
[ regex "prethodn(ih?|a|e)|pro(s|š)l(a|e|ih?)"
|
||||
, Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
]
|
||||
@ -888,7 +888,7 @@ ruleMidnighteodendOfDay :: Rule
|
||||
ruleMidnighteodendOfDay = Rule
|
||||
{ name = "midnight|EOD|end of day"
|
||||
, pattern =
|
||||
[ regex "(u )?pono(c|\x0107)i?|(the )?(EOD|((do )? kraja? dana))"
|
||||
[ regex "(u )?pono(c|ć)i?|(the )?(EOD|((do )? kraja? dana))"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ hour False 0
|
||||
}
|
||||
@ -1038,7 +1038,7 @@ ruleNextTime :: Rule
|
||||
ruleNextTime = Rule
|
||||
{ name = "next <time>"
|
||||
, pattern =
|
||||
[ regex "sljede(c|\x0107)(i|u|a|e(ga?)?)"
|
||||
[ regex "sljede(c|ć)(i|u|a|e(ga?)?)"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1080,7 +1080,7 @@ ruleNextNCycle :: Rule
|
||||
ruleNextNCycle = Rule
|
||||
{ name = "next n <cycle>"
|
||||
, pattern =
|
||||
[ regex "(u )?(sljede(c|\x0107)(ih?|a|eg?))"
|
||||
[ regex "(u )?(sljede(c|ć)(ih?|a|eg?))"
|
||||
, Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
]
|
||||
@ -1181,7 +1181,7 @@ ruleDayBeforeYesterday :: Rule
|
||||
ruleDayBeforeYesterday = Rule
|
||||
{ name = "day before yesterday"
|
||||
, pattern =
|
||||
[ regex "(prekju(c|\x010d)er)"
|
||||
[ regex "(prekju(c|č)er)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . cycleNth TG.Day $ - 2
|
||||
}
|
||||
@ -1190,7 +1190,7 @@ ruleAfterLunch :: Rule
|
||||
ruleAfterLunch = Rule
|
||||
{ name = "after lunch"
|
||||
, pattern =
|
||||
[ regex "poslije ru(c|\x010d)ka"
|
||||
[ regex "poslije ru(c|č)ka"
|
||||
]
|
||||
, prod = \_ -> do
|
||||
td <- interval TTime.Open (hour False 13) (hour False 17)
|
||||
@ -1216,7 +1216,7 @@ ruleYesterday :: Rule
|
||||
ruleYesterday = Rule
|
||||
{ name = "yesterday"
|
||||
, pattern =
|
||||
[ regex "(ju(c|\x010d)er)"
|
||||
[ regex "(ju(c|č)er)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . cycleNth TG.Day $ - 1
|
||||
}
|
||||
@ -1247,7 +1247,7 @@ ruleChristmas :: Rule
|
||||
ruleChristmas = Rule
|
||||
{ name = "christmas"
|
||||
, pattern =
|
||||
[ regex "(zi(c|\x0107)bo|bo(z|\x017e)i(c|\x0107))(a|u|ni|na)?"
|
||||
[ regex "(zi(c|ć)bo|bo(z|ž)i(c|ć))(a|u|ni|na)?"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ monthDay 12 25
|
||||
}
|
||||
@ -1300,7 +1300,7 @@ ruleAfterNextTime :: Rule
|
||||
ruleAfterNextTime = Rule
|
||||
{ name = "after next <time>"
|
||||
, pattern =
|
||||
[ regex "nakon sljede(\x0107|c)(i|e|a)(ga?)?"
|
||||
[ regex "nakon sljede(ć|c)(i|e|a)(ga?)?"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1335,7 +1335,7 @@ ruleTonight :: Rule
|
||||
ruleTonight = Rule
|
||||
{ name = "tonight"
|
||||
, pattern =
|
||||
[ regex "(na)?ve(c|\x010d)er(as)?"
|
||||
[ regex "(na)?ve(c|č)er(as)?"
|
||||
]
|
||||
, prod = \_ -> do
|
||||
let today = cycleNth TG.Day 0
|
||||
@ -1347,7 +1347,7 @@ ruleBeforeLasttime :: Rule
|
||||
ruleBeforeLasttime = Rule
|
||||
{ name = "before last<time>"
|
||||
, pattern =
|
||||
[ regex "prije (prethodn(i|u|a|e|o(ga?)?)|pro(s|\x0161)l(ih?|a|e|o(ga?)?))"
|
||||
[ regex "prije (prethodn(i|u|a|e|o(ga?)?)|pro(s|š)l(ih?|a|e|o(ga?)?))"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1386,7 +1386,7 @@ ruleHalloweenDay :: Rule
|
||||
ruleHalloweenDay = Rule
|
||||
{ name = "halloween day"
|
||||
, pattern =
|
||||
[ regex "no(c|\x0107) vje(s|\x0161)tica"
|
||||
[ regex "no(c|ć) vje(s|š)tica"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ monthDay 10 31
|
||||
}
|
||||
@ -1419,7 +1419,7 @@ ruleFathersDay :: Rule
|
||||
ruleFathersDay = Rule
|
||||
{ name = "Father's Day"
|
||||
, pattern =
|
||||
[ regex "dan (o(c|\x010d)eva|tata)"
|
||||
[ regex "dan (o(c|č)eva|tata)"
|
||||
]
|
||||
, prod = \_ -> tt $ nthDOWOfMonth 3 7 6
|
||||
}
|
||||
@ -1498,7 +1498,7 @@ ruleEveningnight :: Rule
|
||||
ruleEveningnight = Rule
|
||||
{ name = "evening|night"
|
||||
, pattern =
|
||||
[ regex "(na)?ve(c|\x010d)er(i|as)?"
|
||||
[ regex "(na)?ve(c|č)er(i|as)?"
|
||||
]
|
||||
, prod = \_ -> Token Time . partOfDay . mkLatent <$>
|
||||
interval TTime.Open (hour False 18) (hour False 0)
|
||||
@ -1523,7 +1523,7 @@ ruleDayBeforeDayBeforeYesterday :: Rule
|
||||
ruleDayBeforeDayBeforeYesterday = Rule
|
||||
{ name = "day before day before yesterday"
|
||||
, pattern =
|
||||
[ regex "(prek\\s?prekju(c|\x010d)er)"
|
||||
[ regex "(prek\\s?prekju(c|č)er)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . cycleNth TG.Day $ - 3
|
||||
}
|
||||
@ -1564,7 +1564,7 @@ ruleMothersDay :: Rule
|
||||
ruleMothersDay = Rule
|
||||
{ name = "Mother's Day"
|
||||
, pattern =
|
||||
[ regex "maj(c|\x010d)in dan"
|
||||
[ regex "maj(c|č)in dan"
|
||||
]
|
||||
, prod = \_ -> tt $ nthDOWOfMonth 2 7 5
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ ruleDayOfMonthSt :: Rule
|
||||
ruleDayOfMonthSt = Rule
|
||||
{ name = "day of month (1st)"
|
||||
, pattern =
|
||||
[ regex "(primo|1o|1\x00ba|1\x00b0)"
|
||||
[ regex "(primo|1o|1º|1°)"
|
||||
]
|
||||
, prod = \_ -> tt $ dayOfMonth 1
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ ruleFestaDelPap :: Rule
|
||||
ruleFestaDelPap = Rule
|
||||
{ name = "festa del papà"
|
||||
, pattern =
|
||||
[ regex "festa del pap(a|\x00e0)|(festa di )?s(an|\\.) giuseppe"
|
||||
[ regex "festa del pap(a|à)|(festa di )?s(an|\\.) giuseppe"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 3 19
|
||||
}
|
||||
@ -1112,11 +1112,11 @@ ruleNextCycle = Rule
|
||||
|
||||
daysOfWeek :: [(Text, String)]
|
||||
daysOfWeek =
|
||||
[ ( "Lunedi" , "luned(i|\x00ec)|lun?\\.?" )
|
||||
, ( "Martedi" , "marted(i|\x00ec)|mar\\.?" )
|
||||
, ( "Mercoledi", "mercoled(i|\x00ec)|mer\\.?" )
|
||||
, ( "Giovedi" , "gioved(i|\x00ec)|gio\\.?" )
|
||||
, ( "Venerdi" , "venerd(i|\x00ec)|ven\\.?" )
|
||||
[ ( "Lunedi" , "luned(i|ì)|lun?\\.?" )
|
||||
, ( "Martedi" , "marted(i|ì)|mar\\.?" )
|
||||
, ( "Mercoledi", "mercoled(i|ì)|mer\\.?" )
|
||||
, ( "Giovedi" , "gioved(i|ì)|gio\\.?" )
|
||||
, ( "Venerdi" , "venerd(i|ì)|ven\\.?" )
|
||||
, ( "Sabato" , "sabato|sab\\.?" )
|
||||
, ( "Domenica" , "domenica|dom\\.?" )
|
||||
]
|
||||
|
@ -33,7 +33,7 @@ ruleNamedday = Rule
|
||||
{ name = "<named-day>에"
|
||||
, pattern =
|
||||
[ Predicate isADayOfWeek
|
||||
, regex "\xc5d0"
|
||||
, regex "에"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(x:_) -> Just x
|
||||
@ -44,7 +44,7 @@ ruleLiberationDay :: Rule
|
||||
ruleLiberationDay = Rule
|
||||
{ name = "Liberation Day"
|
||||
, pattern =
|
||||
[ regex "\xad11\xbcf5\xc808"
|
||||
[ regex "광복절"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 8 15
|
||||
}
|
||||
@ -53,7 +53,7 @@ ruleTheDayAfterTomorrow :: Rule
|
||||
ruleTheDayAfterTomorrow = Rule
|
||||
{ name = "the day after tomorrow - 내일모레"
|
||||
, pattern =
|
||||
[ regex "(\xb0b4\xc77c)?\xbaa8\xb808"
|
||||
[ regex "(내일)?모\xb808"
|
||||
]
|
||||
, prod = \_ ->
|
||||
tt . cycleNthAfter False TG.Day 1 $ cycleNth TG.Day 1
|
||||
@ -63,7 +63,7 @@ ruleConstitutionDay :: Rule
|
||||
ruleConstitutionDay = Rule
|
||||
{ name = "Constitution Day"
|
||||
, pattern =
|
||||
[ regex "\xc81c\xd5cc\xc808"
|
||||
[ regex "제헌절"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 6 17
|
||||
}
|
||||
@ -73,7 +73,7 @@ ruleTimeofday4 = Rule
|
||||
{ name = "<time-of-day>이전"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "(\xc774)?\xc804"
|
||||
, regex "(이)?전"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -86,7 +86,7 @@ ruleDay = Rule
|
||||
{ name = "day"
|
||||
, pattern =
|
||||
[ Predicate isDOMInteger
|
||||
, regex "\xc77c"
|
||||
, regex "일"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> do
|
||||
@ -100,7 +100,7 @@ ruleSinceTimeofday = Rule
|
||||
{ name = "since <time-of-day>"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "\xc774\xb798\xb85c"
|
||||
, regex "이래로"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -112,7 +112,7 @@ ruleThisDayofweek :: Rule
|
||||
ruleThisDayofweek = Rule
|
||||
{ name = "this <day-of-week>"
|
||||
, pattern =
|
||||
[ regex "\xc774\xbc88(\xc8fc)?|\xae08\xc8fc"
|
||||
[ regex "이번(주)?|금주"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -125,7 +125,7 @@ ruleNewYearsDay :: Rule
|
||||
ruleNewYearsDay = Rule
|
||||
{ name = "New Year's Day"
|
||||
, pattern =
|
||||
[ regex "\xc2e0\xc815|\xc124\xb0a0"
|
||||
[ regex "신정|설날"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 1 1
|
||||
}
|
||||
@ -134,7 +134,7 @@ ruleLastTime :: Rule
|
||||
ruleLastTime = Rule
|
||||
{ name = "last <time>"
|
||||
, pattern =
|
||||
[ regex "\xc804|\xc800\xbc88|\xc9c0\xb09c"
|
||||
[ regex "전|저번|지난"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -148,7 +148,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
{ name = "<datetime> - <datetime> (interval)"
|
||||
, pattern =
|
||||
[ Predicate isNotLatent
|
||||
, regex "\\-|\\~|\xbd80\xd130"
|
||||
, regex "\\-|\\~|부터"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -162,7 +162,7 @@ ruleInDuration = Rule
|
||||
{ name = "in <duration>"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "(\xc548|\xb0b4)(\xc5d0)?"
|
||||
, regex "(안|내)(에)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Duration dd:_) ->
|
||||
@ -174,7 +174,7 @@ ruleNow :: Rule
|
||||
ruleNow = Rule
|
||||
{ name = "now"
|
||||
, pattern =
|
||||
[ regex "\xbc29\xae08|\xc9c0\xae08|\xbc29\xae08|\xb9c9"
|
||||
[ regex "방금|지금|방금|막"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Second 0
|
||||
}
|
||||
@ -184,7 +184,7 @@ ruleMonth = Rule
|
||||
{ name = "month"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 1 12
|
||||
, regex "\xc6d4"
|
||||
, regex "월"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> do
|
||||
@ -197,7 +197,7 @@ ruleSeason4 :: Rule
|
||||
ruleSeason4 = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "\xbd04"
|
||||
[ regex "봄"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = monthDay 3 20
|
||||
@ -235,7 +235,7 @@ ruleNoon :: Rule
|
||||
ruleNoon = Rule
|
||||
{ name = "noon"
|
||||
, pattern =
|
||||
[ regex "\xc815\xc624"
|
||||
[ regex "정오"
|
||||
]
|
||||
, prod = \_ -> tt $ hour False 12
|
||||
}
|
||||
@ -244,7 +244,7 @@ ruleToday :: Rule
|
||||
ruleToday = Rule
|
||||
{ name = "today"
|
||||
, pattern =
|
||||
[ regex "\xc624\xb298|\xb2f9\xc77c|\xae08\xc77c"
|
||||
[ regex "오늘|당일|금일"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 0
|
||||
}
|
||||
@ -255,7 +255,7 @@ ruleIntegerHourofdayRelativeMinutes = Rule
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, Predicate $ isIntegerBetween 1 59
|
||||
, regex "\xbd84\xc804"
|
||||
, regex "분전"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:token:_) -> do
|
||||
@ -271,7 +271,7 @@ ruleHourofdayIntegerAsRelativeMinutes = Rule
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, Predicate $ isIntegerBetween 1 59
|
||||
, regex "\xbd84"
|
||||
, regex "분"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
|
||||
@ -287,7 +287,7 @@ ruleHalfHourofdayRelativeMinutes = Rule
|
||||
{ name = "half (hour-of-day) relative minutes 전"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "\xbc18\xc804"
|
||||
, regex "반전"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> Token Time <$> minutesBefore 30 td
|
||||
@ -299,7 +299,7 @@ ruleHourofdayHalfAsRelativeMinutes = Rule
|
||||
{ name = "<hour-of-day> half (as relative minutes)"
|
||||
, pattern =
|
||||
[ Predicate isAnHourOfDay
|
||||
, regex "\xbc18"
|
||||
, regex "반"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
|
||||
@ -312,7 +312,7 @@ ruleSeconds = Rule
|
||||
{ name = "seconds"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 0 59
|
||||
, regex "\xcd08"
|
||||
, regex "초"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> do
|
||||
@ -339,7 +339,7 @@ ruleTheDayBeforeYesterday :: Rule
|
||||
ruleTheDayBeforeYesterday = Rule
|
||||
{ name = "the day before yesterday - 엊그제"
|
||||
, pattern =
|
||||
[ regex "(\xc5ca)?\xadf8(\xc81c|\xc7ac)"
|
||||
[ regex "(엊)?그(제|재)"
|
||||
]
|
||||
, prod = \_ ->
|
||||
tt . cycleNthAfter False TG.Day (-1) $ cycleNth TG.Day (-1)
|
||||
@ -349,17 +349,17 @@ ruleDayofweek :: Rule
|
||||
ruleDayofweek = Rule
|
||||
{ name = "day-of-week"
|
||||
, pattern =
|
||||
[ regex "(\xc6d4|\xd654|\xc218|\xbaa9|\xae08|\xd1a0|\xc77c)(\xc694\xc77c|\xc69c)"
|
||||
[ regex "(월|화|수|목|금|토|일)(요일|욜)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\xc6d4" -> tt $ dayOfWeek 1
|
||||
"\xd654" -> tt $ dayOfWeek 2
|
||||
"\xc218" -> tt $ dayOfWeek 3
|
||||
"\xbaa9" -> tt $ dayOfWeek 4
|
||||
"\xae08" -> tt $ dayOfWeek 5
|
||||
"\xd1a0" -> tt $ dayOfWeek 6
|
||||
"\xc77c" -> tt $ dayOfWeek 7
|
||||
"월" -> tt $ dayOfWeek 1
|
||||
"화" -> tt $ dayOfWeek 2
|
||||
"수" -> tt $ dayOfWeek 3
|
||||
"목" -> tt $ dayOfWeek 4
|
||||
"금" -> tt $ dayOfWeek 5
|
||||
"토" -> tt $ dayOfWeek 6
|
||||
"일" -> tt $ dayOfWeek 7
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -368,7 +368,7 @@ ruleNextCycle :: Rule
|
||||
ruleNextCycle = Rule
|
||||
{ name = "next <cycle>"
|
||||
, pattern =
|
||||
[ regex "\xb2e4\xc74c|\xc624\xb294|\xcc28|\xb0b4"
|
||||
[ regex "다음|오는|차|내"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -382,7 +382,7 @@ ruleNamedmonth = Rule
|
||||
{ name = "<named-month>에"
|
||||
, pattern =
|
||||
[ Predicate isAMonth
|
||||
, regex "\xc5d0"
|
||||
, regex "에"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(x:_) -> Just x
|
||||
@ -394,7 +394,7 @@ ruleTimeofdayApproximately = Rule
|
||||
{ name = "<time-of-day> approximately"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "\xc815\xb3c4|\xcbe4"
|
||||
, regex "정도|쯤"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> tt $ notLatent td
|
||||
@ -405,7 +405,7 @@ ruleDurationFromNow :: Rule
|
||||
ruleDurationFromNow = Rule
|
||||
{ name = "<duration> from now"
|
||||
, pattern =
|
||||
[ regex "\xc9c0\xae08\xbd80\xd130"
|
||||
[ regex "지금부터"
|
||||
, dimension Duration
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -418,7 +418,7 @@ ruleLunch :: Rule
|
||||
ruleLunch = Rule
|
||||
{ name = "lunch"
|
||||
, pattern =
|
||||
[ regex "\xc810\xc2ec"
|
||||
[ regex "점심"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
@ -431,7 +431,7 @@ ruleLastCycle :: Rule
|
||||
ruleLastCycle = Rule
|
||||
{ name = "last <cycle>"
|
||||
, pattern =
|
||||
[ regex "\xc9c0\xb09c|\xc791|\xc804|\xc800\xbc88"
|
||||
[ regex "지난|작|전|저번"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -444,7 +444,7 @@ ruleAfternoon :: Rule
|
||||
ruleAfternoon = Rule
|
||||
{ name = "afternoon"
|
||||
, pattern =
|
||||
[ regex "\xc624\xd6c4"
|
||||
[ regex "오후"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
@ -457,7 +457,7 @@ ruleChristmasEve :: Rule
|
||||
ruleChristmasEve = Rule
|
||||
{ name = "christmas eve"
|
||||
, pattern =
|
||||
[ regex "(\xd06c\xb9ac\xc2a4\xb9c8\xc2a4)?\xc774\xbe0c"
|
||||
[ regex "(크리스마스)?이브"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 12 24
|
||||
}
|
||||
@ -467,7 +467,7 @@ ruleInduringThePartofday = Rule
|
||||
{ name = "in|during the <part-of-day>"
|
||||
, pattern =
|
||||
[ Predicate isAPartOfDay
|
||||
, regex "\xc5d0|\xb3d9\xc548"
|
||||
, regex "에|동안"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -508,7 +508,7 @@ ruleAfterDuration = Rule
|
||||
{ name = "after <duration>"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "(\xc774)?\xd6c4"
|
||||
, regex "(이)?후"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Duration dd:_) ->
|
||||
@ -534,7 +534,7 @@ ruleExactlyTimeofday = Rule
|
||||
{ name = "exactly <time-of-day>"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "\xc815\xac01"
|
||||
, regex "정각"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> tt $ notLatent td
|
||||
@ -545,7 +545,7 @@ ruleSeason3 :: Rule
|
||||
ruleSeason3 = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "\xaca8\xc6b8"
|
||||
[ regex "겨울"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
@ -557,7 +557,7 @@ ruleSeason :: Rule
|
||||
ruleSeason = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "\xc5ec\xb984"
|
||||
[ regex "여름"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
@ -569,24 +569,24 @@ ruleDayWithKoreanNumeral :: Rule
|
||||
ruleDayWithKoreanNumeral = Rule
|
||||
{ name = "day with korean number - 십일..삼십일일"
|
||||
, pattern =
|
||||
[ regex "((\xc774|\xc0bc)?\xc2ed(\xc77c|\xc774|\xc0bc|\xc0ac|\xc624|\xc721|\xce60|\xd314|\xad6c)?)\xc77c"
|
||||
[ regex "((이|삼)?십(일|이|삼|사|오|육|칠|팔|구)?)일"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (_:m1:m2:_)):_) ->
|
||||
let dozens = case m1 of
|
||||
"\xc774" -> 2
|
||||
"\xc0bc" -> 3
|
||||
"이" -> 2
|
||||
"삼" -> 3
|
||||
_ -> 1
|
||||
units = case m2 of
|
||||
"\xc77c" -> 1
|
||||
"\xc774" -> 2
|
||||
"\xc0bc" -> 3
|
||||
"\xc0ac" -> 4
|
||||
"\xc624" -> 5
|
||||
"\xc721" -> 6
|
||||
"\xce60" -> 7
|
||||
"\xd314" -> 8
|
||||
"\xad6c" -> 9
|
||||
"일" -> 1
|
||||
"이" -> 2
|
||||
"삼" -> 3
|
||||
"사" -> 4
|
||||
"오" -> 5
|
||||
"육" -> 6
|
||||
"칠" -> 7
|
||||
"팔" -> 8
|
||||
"구" -> 9
|
||||
_ -> 1
|
||||
in tt . dayOfMonth $ 10 * dozens + units
|
||||
_ -> Nothing
|
||||
@ -596,19 +596,19 @@ ruleDayWithKoreanNumeral2 :: Rule
|
||||
ruleDayWithKoreanNumeral2 = Rule
|
||||
{ name = "day with korean number - 일일..구일"
|
||||
, pattern =
|
||||
[ regex "(\xc77c|\xc774|\xc0bc|\xc0ac|\xc624|\xc721|\xce60|\xd314|\xad6c)\xc77c"
|
||||
[ regex "(일|이|삼|사|오|육|칠|팔|구)일"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case match of
|
||||
"\xc77c" -> tt $ dayOfMonth 1
|
||||
"\xc774" -> tt $ dayOfMonth 2
|
||||
"\xc0bc" -> tt $ dayOfMonth 3
|
||||
"\xc0ac" -> tt $ dayOfMonth 4
|
||||
"\xc624" -> tt $ dayOfMonth 5
|
||||
"\xc721" -> tt $ dayOfMonth 6
|
||||
"\xce60" -> tt $ dayOfMonth 7
|
||||
"\xd314" -> tt $ dayOfMonth 8
|
||||
"\xad6c" -> tt $ dayOfMonth 9
|
||||
"일" -> tt $ dayOfMonth 1
|
||||
"이" -> tt $ dayOfMonth 2
|
||||
"삼" -> tt $ dayOfMonth 3
|
||||
"사" -> tt $ dayOfMonth 4
|
||||
"오" -> tt $ dayOfMonth 5
|
||||
"육" -> tt $ dayOfMonth 6
|
||||
"칠" -> tt $ dayOfMonth 7
|
||||
"팔" -> tt $ dayOfMonth 8
|
||||
"구" -> tt $ dayOfMonth 9
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -618,7 +618,7 @@ ruleTimeofday2 = Rule
|
||||
{ name = "<time-of-day>에"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "\xc5d0"
|
||||
, regex "에"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
@ -631,7 +631,7 @@ ruleDurationAgo = Rule
|
||||
{ name = "<duration> ago"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "(\xc774)?\xc804"
|
||||
, regex "(이)?전"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Duration dd:_) ->
|
||||
@ -643,7 +643,7 @@ ruleLastNCycle :: Rule
|
||||
ruleLastNCycle = Rule
|
||||
{ name = "last n <cycle>"
|
||||
, pattern =
|
||||
[ regex "\xc9c0\xb09c"
|
||||
[ regex "지난"
|
||||
, Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
]
|
||||
@ -675,7 +675,7 @@ ruleWithinDuration = Rule
|
||||
{ name = "within <duration>"
|
||||
, pattern =
|
||||
[ dimension Duration
|
||||
, regex "\xc774\xb0b4(\xc5d0)?"
|
||||
, regex "이내(에)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Duration dd:_) ->
|
||||
@ -689,7 +689,7 @@ ruleMidnighteodendOfDay :: Rule
|
||||
ruleMidnighteodendOfDay = Rule
|
||||
{ name = "midnight|EOD|end of day"
|
||||
, pattern =
|
||||
[ regex "\xc790\xc815"
|
||||
[ regex "자정"
|
||||
]
|
||||
, prod = \_ -> tt $ hour False 0
|
||||
}
|
||||
@ -711,7 +711,7 @@ ruleAboutTimeofday :: Rule
|
||||
ruleAboutTimeofday = Rule
|
||||
{ name = "about <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "\xb300\xcda9|\xc57d"
|
||||
[ regex "대충|약"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -724,7 +724,7 @@ ruleEndOfTime = Rule
|
||||
{ name = "end of <time>"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\xb9d0"
|
||||
, regex "말"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -749,7 +749,7 @@ ruleWeekend :: Rule
|
||||
ruleWeekend = Rule
|
||||
{ name = "week-end"
|
||||
, pattern =
|
||||
[ regex "\xc8fc\xb9d0"
|
||||
[ regex "주말"
|
||||
]
|
||||
, prod = \_ -> tt weekend
|
||||
}
|
||||
@ -759,7 +759,7 @@ ruleTimeDayofweek = Rule
|
||||
{ name = "<time> 마지막 <day-of-week>"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\xb9c8\xc9c0\xb9c9"
|
||||
, regex "마지막"
|
||||
, Predicate isADayOfWeek
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -773,7 +773,7 @@ ruleDate = Rule
|
||||
{ name = "<date>에"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\xc5d0"
|
||||
, regex "에"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(x:_) -> Just x
|
||||
@ -784,7 +784,7 @@ ruleNextTime :: Rule
|
||||
ruleNextTime = Rule
|
||||
{ name = "next <time>"
|
||||
, pattern =
|
||||
[ regex "\xb2e4\xc74c|\xc624\xb294"
|
||||
[ regex "다음|오는"
|
||||
, Predicate isNotLatent
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -798,7 +798,7 @@ ruleTimeCycle2 = Rule
|
||||
{ name = "<time> 마지막 <cycle>"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\xb9c8\xc9c0\xb9c9"
|
||||
, regex "마지막"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -826,7 +826,7 @@ ruleNextNCycle :: Rule
|
||||
ruleNextNCycle = Rule
|
||||
{ name = "next n <cycle>"
|
||||
, pattern =
|
||||
[ regex "\xb2e4\xc74c"
|
||||
[ regex "다음"
|
||||
, Predicate $ isIntegerBetween 1 9999
|
||||
, dimension TimeGrain
|
||||
]
|
||||
@ -841,7 +841,7 @@ ruleMorning :: Rule
|
||||
ruleMorning = Rule
|
||||
{ name = "morning"
|
||||
, pattern =
|
||||
[ regex "\xc544\xce68"
|
||||
[ regex "아침"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
@ -854,7 +854,7 @@ ruleThisCycle :: Rule
|
||||
ruleThisCycle = Rule
|
||||
{ name = "this <cycle>"
|
||||
, pattern =
|
||||
[ regex "\xc774\xbc88|\xae08|\xc62c"
|
||||
[ regex "이번|금|올"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -867,7 +867,7 @@ ruleThisTime :: Rule
|
||||
ruleThisTime = Rule
|
||||
{ name = "this <time>"
|
||||
, pattern =
|
||||
[ regex "\xc774\xbc88"
|
||||
[ regex "이번"
|
||||
, dimension Time
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -881,7 +881,7 @@ ruleTimeofday3 = Rule
|
||||
{ name = "<time-of-day> 정각"
|
||||
, pattern =
|
||||
[ Predicate isATimeOfDay
|
||||
, regex "\xc815\xac01"
|
||||
, regex "정각"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -893,7 +893,7 @@ ruleMemorialDay :: Rule
|
||||
ruleMemorialDay = Rule
|
||||
{ name = "Memorial Day"
|
||||
, pattern =
|
||||
[ regex "\xd604\xcda9\xc77c"
|
||||
[ regex "현충일"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 6 6
|
||||
}
|
||||
@ -915,7 +915,7 @@ ruleYesterday :: Rule
|
||||
ruleYesterday = Rule
|
||||
{ name = "yesterday"
|
||||
, pattern =
|
||||
[ regex "\xc5b4\xc81c"
|
||||
[ regex "어제"
|
||||
]
|
||||
, prod = \_ -> tt . cycleNth TG.Day $ - 1
|
||||
}
|
||||
@ -924,7 +924,7 @@ ruleSeason2 :: Rule
|
||||
ruleSeason2 = Rule
|
||||
{ name = "season"
|
||||
, pattern =
|
||||
[ regex "\xac00\xc744"
|
||||
[ regex "가을"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
@ -937,7 +937,7 @@ ruleAfterTimeofday = Rule
|
||||
{ name = "after <time-of-day>"
|
||||
, pattern =
|
||||
[ Predicate $ liftM2 (||) isATimeOfDay isAPartOfDay
|
||||
, regex "\xc9c0\xb098\xc11c|(\xc774)?\xd6c4(\xc5d0)?"
|
||||
, regex "지나서|(이)?후(에)?"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -949,7 +949,7 @@ ruleChristmas :: Rule
|
||||
ruleChristmas = Rule
|
||||
{ name = "christmas"
|
||||
, pattern =
|
||||
[ regex "\xd06c\xb9ac\xc2a4\xb9c8\xc2a4"
|
||||
[ regex "크리스마스"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 12 25
|
||||
}
|
||||
@ -972,7 +972,7 @@ ruleTimeCycle = Rule
|
||||
{ name = "<time> 마지막 <cycle> "
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\xb9c8\xc9c0\xb9c9"
|
||||
, regex "마지막"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -990,7 +990,7 @@ ruleAfterPartofday = Rule
|
||||
{ name = "after <part-of-day>"
|
||||
, pattern =
|
||||
[ Predicate isAPartOfDay
|
||||
, regex "\xc9c0\xb098\xc11c|\xd6c4\xc5d0"
|
||||
, regex "지나서|후에"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
@ -1003,7 +1003,7 @@ ruleTimeofday = Rule
|
||||
{ name = "time-of-day"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 0 24
|
||||
, regex "\xc2dc"
|
||||
, regex "시"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> do
|
||||
@ -1016,7 +1016,7 @@ ruleHangulDay :: Rule
|
||||
ruleHangulDay = Rule
|
||||
{ name = "Hangul Day"
|
||||
, pattern =
|
||||
[ regex "\xd55c\xae00\xb0a0"
|
||||
[ regex "한글날"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 10 9
|
||||
}
|
||||
@ -1067,7 +1067,7 @@ ruleChildrensDay :: Rule
|
||||
ruleChildrensDay = Rule
|
||||
{ name = "Children's Day"
|
||||
, pattern =
|
||||
[ regex "\xc5b4\xb9b0\xc774\xb0a0"
|
||||
[ regex "어린이날"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 5 5
|
||||
}
|
||||
@ -1089,7 +1089,7 @@ ruleByTime = Rule
|
||||
{ name = "by <time> - 까지"
|
||||
, pattern =
|
||||
[ dimension Time
|
||||
, regex "\xae4c\xc9c0"
|
||||
, regex "까지"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> Token Time <$>
|
||||
@ -1133,7 +1133,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
{ name = "<time-of-day> - <time-of-day> (interval)"
|
||||
, pattern =
|
||||
[ Predicate $ liftM2 (&&) isATimeOfDay isNotLatent
|
||||
, regex "\\-|\\~|\xbd80\xd130"
|
||||
, regex "\\-|\\~|부터"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1146,7 +1146,7 @@ ruleNationalFoundationDay :: Rule
|
||||
ruleNationalFoundationDay = Rule
|
||||
{ name = "National Foundation Day"
|
||||
, pattern =
|
||||
[ regex "\xac1c\xcc9c\xc808"
|
||||
[ regex "개천절"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 10 3
|
||||
}
|
||||
@ -1155,7 +1155,7 @@ ruleEveningnight :: Rule
|
||||
ruleEveningnight = Rule
|
||||
{ name = "evening|night"
|
||||
, pattern =
|
||||
[ regex "\xc800\xb141|\xbc24"
|
||||
[ regex "저녁|밤"
|
||||
]
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
@ -1168,7 +1168,7 @@ ruleIndependenceMovementDay :: Rule
|
||||
ruleIndependenceMovementDay = Rule
|
||||
{ name = "Independence Movement Day"
|
||||
, pattern =
|
||||
[ regex "\xc0bc\xc77c\xc808"
|
||||
[ regex "삼일절"
|
||||
]
|
||||
, prod = \_ -> tt $ monthDay 3 1
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ ruleTomorrow :: Rule
|
||||
ruleTomorrow = Rule
|
||||
{ name = "tomorrow"
|
||||
, pattern =
|
||||
[ regex "\xb0b4\xc77c|\xba85\xc77c|\xb0bc"
|
||||
[ regex "내일|명일|낼"
|
||||
]
|
||||
, prod = \_ -> tt $ cycleNth TG.Day 1
|
||||
}
|
||||
@ -1201,14 +1201,14 @@ ruleAmpmTimeofday :: Rule
|
||||
ruleAmpmTimeofday = Rule
|
||||
{ name = "am|pm <time-of-day>"
|
||||
, pattern =
|
||||
[ regex "(\xc624\xc804|\xc544\xce68|\xc624\xd6c4|\xc800\xb141)"
|
||||
[ regex "(오전|아침|오후|저녁)"
|
||||
, Predicate isATimeOfDay
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):
|
||||
Token Time td:
|
||||
_) -> tt . timeOfDayAMPM td $
|
||||
elem match ["\xc624\xc804", "\xc544\xce68"]
|
||||
elem match ["오전", "아침"]
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1217,7 +1217,7 @@ ruleYear2 = Rule
|
||||
{ name = "year"
|
||||
, pattern =
|
||||
[ Predicate $ isIntegerBetween 1 2100
|
||||
, regex "\xb144"
|
||||
, regex "년"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_) -> do
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user