Add more variants of egp to EN and AR AmountOfMoney dimension (#590)

Summary:
These are popular variants/abbreviations of Egyptian pounds.
All these forms are documented on wikipedia (https://en.wikipedia.org/wiki/Egyptian_pound)

Pull Request resolved: https://github.com/facebook/duckling/pull/590

Reviewed By: haoxuany

Differential Revision: D27598249

Pulled By: chessai

fbshipit-source-id: 42ae9115b1def48c58e50a6deb624c3407c029f3
This commit is contained in:
Amr Keleg 2021-04-07 12:23:25 -07:00 committed by Facebook GitHub Bot
parent 3157d2e553
commit 8a8f557002
4 changed files with 38 additions and 0 deletions

View File

@ -86,6 +86,8 @@ allExamples = concat
[ "42 EGP"
, "42 جنيه مصري"
, "42 جنيهات مصريه"
, "42 ج.م"
, "42 ج.م."
]
, examples (simple QAR 42)
[ "42 QAR"

View File

@ -51,6 +51,15 @@ rulePounds = Rule
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Pound
}
ruleEgpAbrreviation :: Rule
ruleEgpAbrreviation = Rule
{ name = "EGP abbreviation"
, pattern =
[ regex "ج[.]م[.]?"
]
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly EGP
}
ruleDinars :: Rule
ruleDinars = Rule
{ name = "dinars"
@ -390,6 +399,7 @@ rules =
[ ruleUnitAmount
, ruleCent
, rulePounds
, ruleEgpAbrreviation
, ruleDinars
, ruleDirhams
, ruleRiyals

View File

@ -149,6 +149,12 @@ allExamples = concat
, examples (simple EGP 42)
[ "42 EGP"
, "42 egyptianpound"
, "42 LE"
, "42 L.E"
, "42 l.e."
, "42 le"
, "42 geneh"
, "42 genihat masriya"
]
, examples (simple QAR 42)
[ "42 QAR"

View File

@ -65,6 +65,24 @@ ruleOtherPounds = Rule
_ -> Nothing
}
ruleEgpAbrreviation :: Rule
ruleEgpAbrreviation = Rule
{ name = "livre égyptienne"
, pattern =
[ regex "[lL].?[eE].?"
]
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly EGP
}
ruleEgpArabizi :: Rule
ruleEgpArabizi = Rule
{ name = "geneh"
, pattern =
[ regex "[Gg][eiy]*n[eiy]*h(at)?( m[aiey]?sr[eiy]+a?)?"
]
, prod = \_ -> Just . Token AmountOfMoney $ currencyOnly EGP
}
ruleRiyals :: Rule
ruleRiyals = Rule
{ name = "riyals"
@ -405,6 +423,8 @@ rules =
, ruleIntervalDash
, ruleKopiyka
, ruleOtherPounds
, ruleEgpAbrreviation
, ruleEgpArabizi
, rulePounds
, rulePrecision
, ruleRinggit