Skip to content

Commit

Permalink
[.NET] Dutch NumbersWithUnits Currency enhancements (microsoft#2195)
Browse files Browse the repository at this point in the history
  • Loading branch information
aitelintII authored Jul 2, 2020
1 parent 2c53a57 commit 1805f2c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 26 deletions.
7 changes: 5 additions & 2 deletions .NET/Microsoft.Recognizers.Definitions.Common/BaseCurrency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class BaseCurrency
{ @"__D", @"CENT" },
{ @"RUB", @"KOPEK" },
{ @"AFN", @"PUL" },
{ @"EUR", @"CENT" },
{ @"EUR", @"CENT|KWARTJE|DUBBELTJE|STUIVER" },
{ @"ALL", @"QINDARKE" },
{ @"_ALP", @"PENNY" },
{ @"GBP", @"PENNY" },
Expand Down Expand Up @@ -266,7 +266,10 @@ public static class BaseCurrency
{ @"Kopiyka", 100 },
{ @"Tiyin", 100 },
{ @"Hào", 10 },
{ @"Ngwee", 100 }
{ @"Ngwee", 100 },
{ @"Kwartje", 4 },
{ @"Dubbeltje", 10 },
{ @"Stuiver", 20 }
};
public static readonly Dictionary<string, long> NonStandardFractionalSubunits = new Dictionary<string, long>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ public static class NumbersWithUnitDefinitions
{ @"Pul", @"pul" },
{ @"Euro", @"euros|euro|€|eur" },
{ @"Cent", @"cents|cent|-cents|-cent" },
{ @"Kwartje", @"kwartje" },
{ @"Dubbeltje", @"dubbeltje" },
{ @"Stuiver", @"stuiver" },
{ @"Tientje", @"tientje" },
{ @"Albanian lek", @"albanese lek|leks|lek" },
{ @"Qindarkë", @"qindarkë|qindarkës|qindarke|qindarkes" },
{ @"Angolan kwanza", @"angolese kwanza|kz|aoa|kwanza|kwanzas|angolese kwanzas" },
Expand Down Expand Up @@ -681,7 +685,10 @@ public static class NumbersWithUnitDefinitions
{ @"Kopiyka", @"KOPIYKA" },
{ @"Tiyin", @"TIYIN" },
{ @"Hào", @"HAO" },
{ @"Ngwee", @"NGWEE" }
{ @"Ngwee", @"NGWEE" },
{ @"Kwartje", @"KWARTJE" },
{ @"Dubbeltje", @"DUBBELTJE" },
{ @"Stuiver", @"STUIVER" }
};
public const string CompoundUnitConnectorRegex = @"(?<spacer>en)";
public static readonly Dictionary<string, string> CurrencyPrefixList = new Dictionary<string, string>
Expand Down Expand Up @@ -722,7 +729,7 @@ public static class NumbersWithUnitDefinitions
{ @"Samoan tālā", @"ws$" },
{ @"Chinese yuan", @"¥" },
{ @"Japanese yen", @"¥" },
{ @"Euro", @"€" },
{ @"Euro", @"€|eur" },
{ @"Pound", @"£" },
{ @"Costa Rican colón", @"₡" },
{ @"Turkish lira", @"₺" }
Expand Down
5 changes: 4 additions & 1 deletion Patterns/Base-Currency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CurrencyFractionMapping: !dictionary
__D: CENT
RUB: KOPEK
AFN: PUL
EUR: CENT
EUR: CENT|KWARTJE|DUBBELTJE|STUIVER
ALL: QINDARKE
_ALP: PENNY
GBP: PENNY
Expand Down Expand Up @@ -245,6 +245,9 @@ CurrencyFractionalRatios: !dictionary
Tiyin: 100
Hào: 10
Ngwee: 100
Kwartje: 4
Dubbeltje: 10
Stuiver: 20
NonStandardFractionalSubunits: !dictionary
types: [ string, long ]
entries:
Expand Down
9 changes: 8 additions & 1 deletion Patterns/Dutch/Dutch-NumbersWithUnit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ CurrencySuffixList: !dictionary
#Euro
Euro: euros|euro|€|eur
Cent: cents|cent|-cents|-cent
Kwartje: kwartje
Dubbeltje: dubbeltje
Stuiver: stuiver
Tientje: tientje
#Albanian lek
#No use of "ALL" "L"
Albanian lek: albanese lek|leks|lek
Expand Down Expand Up @@ -770,6 +774,9 @@ FractionalUnitNameToCodeMap: !dictionary
Tiyin: TIYIN
Hào: HAO
Ngwee: NGWEE
Kwartje: KWARTJE
Dubbeltje: DUBBELTJE
Stuiver: STUIVER
CompoundUnitConnectorRegex: !simpleRegex
def: (?<spacer>en)
CurrencyPrefixList: !dictionary
Expand Down Expand Up @@ -812,7 +819,7 @@ CurrencyPrefixList: !dictionary
Samoan tālā: ws$
Chinese yuan:
Japanese yen: ¥
Euro:
Euro: |eur
Pound: £
Costa Rican colón:
Turkish lira:
Expand Down
37 changes: 17 additions & 20 deletions Specs/NumberWithUnit/Dutch/CurrencyModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,17 @@
},
{
"Input": "De internationale symbolen voor munteenheden kunnen voor of achter het bedrag staan (bijvoorbeeld 200 EUR, EUR 500). In Nederland is het gebruikelijk de muntcode voor het bedrag te zetten, in Vlaanderen erachter.",
"NotSupported": "dotNet",
"Results": [
{
"Text": "200 EUR",
"Text": "200 eur",
"TypeName": "currency",
"Resolution": {
"unit": "Euro",
"value": "200"
}
},
{
"Text": "EUR 500",
"Text": "eur 500",
"TypeName": "currency",
"Resolution": {
"unit": "Euro",
Expand Down Expand Up @@ -178,13 +177,14 @@
},
{
"Input": "Hij is me nog een tientje schuldig.",
"Comment": "Fractions are supported, however amounts higher than 1 Euro are not, such as 'tientje', 10 Euro. Also, 'dubbeltje' and 'stuiver' are still in use, but 'tientje' not, ref: https://nl.wikipedia.org/wiki/Nederlandse_gulden",
"Results": [
{
"Text": "tientje",
"TypeName": "currency",
"Resolution": {
"unit": "Euro",
"value": "10"
"unit": "Tientje",
"value": "1"
}
}
],
Expand All @@ -195,69 +195,66 @@
"Input": "Een kwartje is 25 cent.",
"Results": [
{
"Text": "kwartje",
"Text": "een kwartje",
"TypeName": "currency",
"Resolution": {
"unit": "Netherlands guilder",
"value": "0,25"
"unit": "Kwartje",
"value": "1"
}
},
{
"Text": "25 cent",
"TypeName": "currency",
"Resolution": {
"unit": "Cent",
"value": "0,25"
"value": "25"
}
}
],
"NotSupported": "dotnet",
"NotSupportedByDesign": "javascript,python,java"
},
{
"Input": "Een dubbeltje is 10 cent.",
"Results": [
{
"Text": "dubbeltje",
"Text": "een dubbeltje",
"TypeName": "currency",
"Resolution": {
"unit": "Netherlands guilder",
"value": "0,1"
"unit": "Dubbeltje",
"value": "1"
}
},
{
"Text": "10 cent",
"TypeName": "currency",
"Resolution": {
"unit": "Cent",
"value": "0,1"
"value": "10"
}
}
],
"NotSupported": "dotnet",
"NotSupportedByDesign": "javascript,python,java"
},
{
"Input": "Een stuiver is 5 cent.",
"Results": [
{
"Text": "stuiver",
"Text": "een stuiver",
"TypeName": "currency",
"Resolution": {
"unit": "Netherlands guilder",
"value": "0,05"
"unit": "Stuiver",
"value": "1"
}
},
{
"Text": "5 cent",
"TypeName": "currency",
"Resolution": {
"unit": "Cent",
"value": "0,05"
"value": "5"
}
}
],
"NotSupported": "dotnet",
"NotSupportedByDesign": "javascript,python,java"
},
{
Expand Down

0 comments on commit 1805f2c

Please sign in to comment.