mirror of
https://github.com/facebook/duckling.git
synced 2025-01-06 04:53:13 +03:00
Adds UAH currency Type and examples to EN and RU Corpus (#433)
Summary: This PR adds UAH currency Type and examples to EN and RU Corpus Pull Request resolved: https://github.com/facebook/duckling/pull/433 Reviewed By: girifb Differential Revision: D25102990 Pulled By: chessai fbshipit-source-id: ed40e8dfcf145a65c7e6d87158da0efacb32e256
This commit is contained in:
parent
7193caafb9
commit
9993911e3b
@ -231,24 +231,29 @@ allExamples = concat
|
||||
, "no less than $1.42"
|
||||
]
|
||||
, examples (simple INR 5e5)
|
||||
[ "5 lakh rupees"
|
||||
, "five lakhs rupees"
|
||||
]
|
||||
[ "5 lakh rupees"
|
||||
, "five lakhs rupees"
|
||||
]
|
||||
, examples (between INR (7, 9e5))
|
||||
[ "7-9 lakh rupees"
|
||||
]
|
||||
[ "7-9 lakh rupees"
|
||||
]
|
||||
, examples (simple INR 4e7)
|
||||
[ "four crore rupees"
|
||||
, "4 crores rupees"
|
||||
]
|
||||
[ "four crore rupees"
|
||||
, "4 crores rupees"
|
||||
]
|
||||
, examples (simple MNT 10)
|
||||
[ "ten tugriks"
|
||||
, "10 Tugrik"
|
||||
, "10MNT"
|
||||
]
|
||||
[ "ten tugriks"
|
||||
, "10 Tugrik"
|
||||
, "10MNT"
|
||||
]
|
||||
, examples (simple USD 4.7e9)
|
||||
[ "US$4.7 billion"
|
||||
, "a US$4.7 billion"
|
||||
, "a US$ 4.7 billion"
|
||||
]
|
||||
[ "US$4.7 billion"
|
||||
, "a US$4.7 billion"
|
||||
, "a US$ 4.7 billion"
|
||||
]
|
||||
, examples (simple UAH 3.04)
|
||||
[ "UAH3.04"
|
||||
, "UAH 3.04"
|
||||
, "3 UAH 4 kopiykas"
|
||||
]
|
||||
]
|
||||
|
@ -110,6 +110,15 @@ ruleRinggit = Rule
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly MYR
|
||||
}
|
||||
|
||||
ruleHryvnia :: Rule
|
||||
ruleHryvnia = Rule
|
||||
{ name = "hryvnia"
|
||||
, pattern =
|
||||
[ regex "hryvnia" -- TODO: complete
|
||||
]
|
||||
, prod = \_ -> Just $ Token AmountOfMoney $ currencyOnly UAH
|
||||
}
|
||||
|
||||
ruleCent :: Rule
|
||||
ruleCent = Rule
|
||||
{ name = "cent"
|
||||
@ -119,6 +128,15 @@ ruleCent = Rule
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Cent
|
||||
}
|
||||
|
||||
ruleKopiyka :: Rule
|
||||
ruleKopiyka = Rule
|
||||
{ name = "kopiyka"
|
||||
, pattern =
|
||||
[ regex "kopiy(ok|kas?)"
|
||||
]
|
||||
, prod = \_ -> Just $ Token AmountOfMoney $ currencyOnly Cent
|
||||
}
|
||||
|
||||
ruleBucks :: Rule
|
||||
ruleBucks = Rule
|
||||
{ name = "bucks"
|
||||
@ -374,6 +392,7 @@ rules =
|
||||
, ruleNumDollarCoins
|
||||
, ruleDinars
|
||||
, ruleDirham
|
||||
, ruleHryvnia
|
||||
, ruleIntersect
|
||||
, ruleIntersectAndNumeral
|
||||
, ruleIntersectAndXCents
|
||||
@ -384,6 +403,7 @@ rules =
|
||||
, ruleIntervalMin
|
||||
, ruleIntervalNumeralDash
|
||||
, ruleIntervalDash
|
||||
, ruleKopiyka
|
||||
, ruleOtherPounds
|
||||
, rulePounds
|
||||
, rulePrecision
|
||||
|
@ -45,7 +45,6 @@ import Duckling.Dimensions.Types
|
||||
import Duckling.Types hiding (Entity(..))
|
||||
|
||||
import qualified Data.HashMap.Strict as HashMap
|
||||
import qualified Data.Text as Text
|
||||
|
||||
-- -----------------------------------------------------------------
|
||||
-- Dollar coin Types
|
||||
|
@ -140,6 +140,15 @@ allExamples = concat
|
||||
, "RM42"
|
||||
, "MYR42"
|
||||
]
|
||||
, examples (simple UAH 3.04)
|
||||
[ "UAH 3.04"
|
||||
, "UAH3.04"
|
||||
, "3.04 грн"
|
||||
, "грн 3.04"
|
||||
, "₴3.04"
|
||||
, "₴ 3.04"
|
||||
, "3.04₴"
|
||||
]
|
||||
, examples (between Dollar (10, 20))
|
||||
[ "между 10 и 20 долларами"
|
||||
, "от 10 долларов до 20"
|
||||
|
@ -96,6 +96,15 @@ ruleBucks = Rule
|
||||
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Unnamed
|
||||
}
|
||||
|
||||
ruleHryvnia :: Rule
|
||||
ruleHryvnia = Rule
|
||||
{ name = "Hryvnia"
|
||||
, pattern =
|
||||
[ regex "грн"
|
||||
]
|
||||
, prod = \_ -> Just $ Token AmountOfMoney $ currencyOnly UAH
|
||||
}
|
||||
|
||||
ruleIntersectAndXCents :: Rule
|
||||
ruleIntersectAndXCents = Rule
|
||||
{ name = "intersect (and X cents)"
|
||||
@ -303,6 +312,7 @@ rules =
|
||||
, ruleCent
|
||||
, ruleDollar
|
||||
, ruleEUR
|
||||
, ruleHryvnia
|
||||
, ruleIntersect
|
||||
, ruleIntersectAndNumeral
|
||||
, ruleIntersectAndXCents
|
||||
|
@ -116,6 +116,8 @@ currencies = HashMap.fromList
|
||||
, ("shekels", ILS)
|
||||
, ("thb", THB)
|
||||
, ("ttd", TTD)
|
||||
, ("₴", UAH)
|
||||
, ("uah", UAH)
|
||||
, ("usd", USD)
|
||||
, ("us$", USD)
|
||||
, ("vnd", VND)
|
||||
@ -126,7 +128,7 @@ ruleCurrencies :: Rule
|
||||
ruleCurrencies = Rule
|
||||
{ name = "currencies"
|
||||
, pattern =
|
||||
[ regex "(aed|aud|bgn|brl|byn|¢|cad|chf|cny|c|\\$|dinars?|dkk|dollars?|egp|(e|€)uro?s?|€|gbp|gel|\x20BE|hrk|idr|ils|₪|inr|iqd|jmd|jod|¥|jpy|lari|krw|kwd|lbp|mad|₮|mnt|tugriks?|myr|rm|nis|nok|nzd|£|pkr|pln|pta?s?|qar|₽|rs\\.?|riy?als?|ron|rub|rupees?|sar|sek|sgb|shekels?|thb|ttd|us(d|\\$)|vnd|yen|yuan|zar)"
|
||||
[ regex "(aed|aud|bgn|brl|byn|¢|cad|chf|cny|c|\\$|dinars?|dkk|dollars?|egp|(e|€)uro?s?|€|gbp|gel|\x20BE|hrk|idr|ils|₪|inr|iqd|jmd|jod|¥|jpy|lari|krw|kwd|lbp|mad|₮|mnt|tugriks?|myr|rm|nis|nok|nzd|£|pkr|pln|pta?s?|qar|₽|rs\\.?|riy?als?|ron|rub|rupees?|sar|sek|sgb|shekels?|thb|ttd|₴|uah|us(d|\\$)|vnd|yen|yuan|zar)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> do
|
||||
|
@ -80,6 +80,7 @@ data Currency
|
||||
| USD
|
||||
| VND
|
||||
| ZAR
|
||||
| UAH
|
||||
deriving (Eq, Generic, Hashable, Show, Ord, NFData)
|
||||
|
||||
instance ToJSON Currency where
|
||||
@ -136,6 +137,7 @@ instance ToJSON Currency where
|
||||
toJSON USD = "USD"
|
||||
toJSON VND = "VND"
|
||||
toJSON ZAR = "ZAR"
|
||||
toJSON UAH = "UAH"
|
||||
|
||||
data AmountOfMoneyData = AmountOfMoneyData
|
||||
{ value :: Maybe Double
|
||||
|
Loading…
Reference in New Issue
Block a user