From 4db5674c07c25ebfbe1d6e6f97803692bf343f20 Mon Sep 17 00:00:00 2001 From: aitelint <53436544+aitelint@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:40:18 +0700 Subject: [PATCH] [* Currency] Expanded recognition of currency value when using [currencyname]$ (e.g. USD$) (#2711) (#2756) * Expanded recognition of currency value when using [currencyname]$ (e.g. USD$) (#2711) * Propagated to NL, DE, HI, IT, SV, TR. PT, ES, FR to be treated in separate issue. Co-authored-by: LionbridgeCS2 --- .../Dutch/NumbersWithUnitDefinitions.cs | 2 +- .../German/NumbersWithUnitDefinitions.cs | 268 ++++++++--------- .../Hindi/NumbersWithUnitDefinitions.cs | 2 +- .../Turkish/NumbersWithUnitDefinitions.cs | 4 +- .../CurrencyExtractorConfiguration.cs | 24 +- .../CurrencyExtractorConfiguration.cs | 23 +- .../CurrencyExtractorConfiguration.cs | 23 +- .../CurrencyExtractorConfiguration.cs | 24 +- .../CurrencyExtractorConfiguration.cs | 23 +- .../CurrencyExtractorConfiguration.cs | 23 +- .../CurrencyExtractorConfiguration.cs | 23 +- Patterns/Dutch/Dutch-NumbersWithUnit.yaml | 2 +- Patterns/German/German-NumbersWithUnit.yaml | 271 +++++++++--------- Patterns/Hindi/Hindi-NumbersWithUnit.yaml | 2 +- Patterns/Turkish/Turkish-NumbersWithUnit.yaml | 4 +- Specs/NumberWithUnit/Dutch/CurrencyModel.json | 85 ++++++ .../NumberWithUnit/English/CurrencyModel.json | 51 ++++ .../NumberWithUnit/German/CurrencyModel.json | 85 ++++++ Specs/NumberWithUnit/Hindi/CurrencyModel.json | 85 ++++++ .../NumberWithUnit/Italian/CurrencyModel.json | 85 ++++++ .../NumberWithUnit/Swedish/CurrencyModel.json | 85 ++++++ .../NumberWithUnit/Turkish/CurrencyModel.json | 85 ++++++ 22 files changed, 984 insertions(+), 295 deletions(-) diff --git a/.NET/Microsoft.Recognizers.Definitions.Common/Dutch/NumbersWithUnitDefinitions.cs b/.NET/Microsoft.Recognizers.Definitions.Common/Dutch/NumbersWithUnitDefinitions.cs index 31ce5b37e8..2021c34203 100644 --- a/.NET/Microsoft.Recognizers.Definitions.Common/Dutch/NumbersWithUnitDefinitions.cs +++ b/.NET/Microsoft.Recognizers.Definitions.Common/Dutch/NumbersWithUnitDefinitions.cs @@ -530,7 +530,7 @@ public static class NumbersWithUnitDefinitions { @"Rwandan franc", @"RWF" }, { @"Russian ruble", @"RUB" }, { @"Transnistrian ruble", @"PRB" }, - { @"Belarusian ruble", @"BYN" }, + { @"New Belarusian ruble", @"BYN" }, { @"Algerian dinar", @"DZD" }, { @"Bahraini dinar", @"BHD" }, { @"Iraqi dinar", @"IQD" }, diff --git a/.NET/Microsoft.Recognizers.Definitions.Common/German/NumbersWithUnitDefinitions.cs b/.NET/Microsoft.Recognizers.Definitions.Common/German/NumbersWithUnitDefinitions.cs index 137657baee..a2f6b9c47d 100644 --- a/.NET/Microsoft.Recognizers.Definitions.Common/German/NumbersWithUnitDefinitions.cs +++ b/.NET/Microsoft.Recognizers.Definitions.Common/German/NumbersWithUnitDefinitions.cs @@ -312,156 +312,156 @@ public static class NumbersWithUnitDefinitions { @"Afghan afghani", @"AFN" }, { @"Euro", @"EUR" }, { @"Albanian lek", @"ALL" }, - { @"Kwanza angolais", @"AOA" }, + { @"Angolan kwanza", @"AOA" }, { @"Armenian dram", @"AMD" }, - { @"Florins d'Aruba", @"AWG" }, + { @"Aruban florin", @"AWG" }, { @"Bangladeshi taka", @"BDT" }, - { @"Ngultrum bhoutanais", @"BTN" }, - { @"Boliviano bolivien", @"BOB" }, - { @"Bosnie-Herzégovine mark convertible", @"BAM" }, - { @"Pula", @"BWP" }, - { @"Réal brésilien", @"BRL" }, - { @"Lev bulgare", @"BGN" }, - { @"Riel cambodgien", @"KHR" }, - { @"Escudo du cap-vert", @"CVE" }, - { @"Colon du costa rica", @"CRC" }, - { @"Kuna croate", @"HRK" }, - { @"Couronne tchèque", @"CZK" }, - { @"Nakfas érythréens", @"ERN" }, - { @"Birr éthiopien", @"ETB" }, - { @"Dalasi gambienne", @"GMD" }, - { @"Lari géorgien", @"GEL" }, - { @"Cedi", @"GHS" }, - { @"Quetzal guatémaltèque", @"GTQ" }, - { @"Gourdes haïtiennes", @"HTG" }, - { @"Lempira hondurien", @"HNL" }, - { @"Forint hongrois", @"HUF" }, - { @"Rial iranien", @"IRR" }, + { @"Bhutanese ngultrum", @"BTN" }, + { @"Bolivian boliviano", @"BOB" }, + { @"Bosnia and Herzegovina convertible mark", @"BAM" }, + { @"Botswana pula", @"BWP" }, + { @"Brazilian real", @"BRL" }, + { @"Bulgarian lev", @"BGN" }, + { @"Cambodian riel", @"KHR" }, + { @"Cape Verdean escudo", @"CVE" }, + { @"Costa Rican colón", @"CRC" }, + { @"Croatian kuna", @"HRK" }, + { @"Czech koruna", @"CZK" }, + { @"Eritrean nakfa", @"ERN" }, + { @"Ethiopian birr", @"ETB" }, + { @"Gambian dalasi", @"GMD" }, + { @"Georgian lari", @"GEL" }, + { @"Ghanaian cedi", @"GHS" }, + { @"Guatemalan quetzal", @"GTQ" }, + { @"Haitian gourde", @"HTG" }, + { @"Honduran lempira", @"HNL" }, + { @"Hungarian forint", @"HUF" }, + { @"Iranian rial", @"IRR" }, { @"Yemeni rial", @"YER" }, { @"Israeli new shekel", @"ILS" }, - { @"Yen Japonais", @"JPY" }, - { @"Tenge kazakh", @"KZT" }, - { @"Shilling kényan", @"KES" }, - { @"Corée du nord won", @"KPW" }, - { @"Won sud-coréen", @"KRW" }, - { @"Som Kirghizie", @"KGS" }, - { @"Kip laotien", @"LAK" }, - { @"Loti", @"LSL" }, - { @"Rand sud-africain", @"ZAR" }, - { @"Pataca macanais", @"MOP" }, - { @"Dinar macédonien", @"MKD" }, - { @"Ariary malagache", @"MGA" }, - { @"Kwacha malawien", @"MWK" }, - { @"Ringitt malaisien", @"MYR" }, - { @"Ouguiya mauritanienne", @"MRO" }, - { @"Togrogs mongoles", @"MNT" }, - { @"Metical mozambique", @"MZN" }, - { @"Kyat birmanie", @"MMK" }, - { @"Cordoba nicaraguayen", @"NIO" }, + { @"Japanese yen", @"JPY" }, + { @"Kazakhstani tenge", @"KZT" }, + { @"Kenyan shilling", @"KES" }, + { @"North Korean won", @"KPW" }, + { @"South Korean won", @"KRW" }, + { @"Kyrgyzstani som", @"KGS" }, + { @"Lao kip", @"LAK" }, + { @"Lesotho loti", @"LSL" }, + { @"South African rand", @"ZAR" }, + { @"Macanese pataca", @"MOP" }, + { @"Macedonian denar", @"MKD" }, + { @"Malagasy ariary", @"MGA" }, + { @"Malawian kwacha", @"MWK" }, + { @"Malaysian ringgit", @"MYR" }, + { @"Mauritanian ouguiya", @"MRO" }, + { @"Mongolian tögrög", @"MNT" }, + { @"Mozambican metical", @"MZN" }, + { @"Burmese kyat", @"MMK" }, + { @"Nicaraguan córdoba", @"NIO" }, { @"Nigerian naira", @"NGN" }, - { @"Livre turque", @"TRY" }, - { @"Rials omanais", @"OMR" }, - { @"Balboa panaméennes", @"PAB" }, - { @"Kina", @"PGK" }, - { @"Guaraní paraguayen", @"PYG" }, + { @"Turkish lira", @"TRY" }, + { @"Omani rial", @"OMR" }, + { @"Panamanian balboa", @"PAB" }, + { @"Papua New Guinean kina", @"PGK" }, + { @"Paraguayan guaraní", @"PYG" }, { @"Peruvian sol", @"PEN" }, - { @"Złoty polonais", @"PLN" }, - { @"Riyal qatari", @"QAR" }, - { @"Riyal saudi", @"SAR" }, - { @"Tala", @"WST" }, + { @"Polish złoty", @"PLN" }, + { @"Qatari riyal", @"QAR" }, + { @"Saudi riyal", @"SAR" }, + { @"Samoan tālā", @"WST" }, { @"São Tomé and Príncipe dobra", @"STN" }, - { @"Leone", @"SLL" }, - { @"Lilangeni", @"SZL" }, - { @"Somoni tadjikistan", @"TJS" }, - { @"Baht thaïlandais", @"THB" }, - { @"Hryvnia ukrainien", @"UAH" }, + { @"Sierra Leonean leone", @"SLL" }, + { @"Swazi lilangeni", @"SZL" }, + { @"Tajikistani somoni", @"TJS" }, + { @"Thai baht", @"THB" }, + { @"Ukrainian hryvnia", @"UAH" }, { @"Vanuatu vatu", @"VUV" }, - { @"Bolívar vénézuélien", @"VEF" }, - { @"Kwacha de Zambie", @"ZMW" }, - { @"Dirham marocain", @"MAD" }, - { @"Dirham des Émirats arabes unis", @"AED" }, - { @"Manat azerbaïdjanais", @"AZN" }, - { @"Manat turkmène", @"TMT" }, - { @"Shilling somalien", @"SOS" }, - { @"Shilling tanzanien", @"TZS" }, - { @"Shilling ougandais", @"UGX" }, - { @"Leu roumain", @"RON" }, - { @"Leu moldave", @"MDL" }, - { @"Roupie népalaise", @"NPR" }, - { @"Roupie pakistanaise", @"PKR" }, - { @"Roupie indienne", @"INR" }, - { @"Roupie seychelloise", @"SCR" }, - { @"Roupie mauricienne", @"MUR" }, - { @"Rufiyaa maldives", @"MVR" }, + { @"Venezuelan bolívar", @"VEF" }, + { @"Zambian kwacha", @"ZMW" }, + { @"Moroccan dirham", @"MAD" }, + { @"United Arab Emirates dirham", @"AED" }, + { @"Azerbaijani manat", @"AZN" }, + { @"Turkmenistan manat", @"TMT" }, + { @"Somali shilling", @"SOS" }, + { @"Tanzanian shilling", @"TZS" }, + { @"Ugandan shilling", @"UGX" }, + { @"Romanian leu", @"RON" }, + { @"Moldovan leu", @"MDL" }, + { @"Nepalese rupee", @"NPR" }, + { @"Pakistani rupee", @"PKR" }, + { @"Indian rupee", @"INR" }, + { @"Seychellois rupee", @"SCR" }, + { @"Mauritian rupee", @"MUR" }, + { @"Maldivian rufiyaa", @"MVR" }, { @"Sri Lankan rupee", @"LKR" }, - { @"Rupiah Indonésie", @"IDR" }, - { @"Couronne danoise", @"DKK" }, - { @"Couronne norvégienne", @"NOK" }, + { @"Indonesian rupiah", @"IDR" }, + { @"Danish krone", @"DKK" }, + { @"Norwegian krone", @"NOK" }, { @"Icelandic króna", @"ISK" }, - { @"Couronne suédoise", @"SEK" }, - { @"Franc CFA de l'Afrique de l'Ouest", @"XOF" }, - { @"Franc CFA d'Afrique centrale", @"XAF" }, - { @"Franc comorien", @"KMF" }, - { @"Franc congolais", @"CDF" }, - { @"Franc burundais", @"BIF" }, - { @"Franc djiboutienne", @"DJF" }, - { @"Franc CFP", @"XPF" }, - { @"Franc guinéen", @"GNF" }, - { @"Franc Suisse", @"CHF" }, - { @"Franc rwandais", @"RWF" }, - { @"Rouble russe", @"RUB" }, - { @"Rouble transnistriens", @"PRB" }, - { @"Nouveau rouble biélorusse", @"BYN" }, - { @"Dinar algérien", @"DZD" }, - { @"Dinar de bahreïn", @"BHD" }, - { @"Dinar iraquien", @"IQD" }, - { @"Dinar jordanien", @"JOD" }, - { @"Dinar koweïtien", @"KWD" }, - { @"Dinar libyen", @"LYD" }, - { @"Dinar serbe", @"RSD" }, - { @"Dinar tunisien", @"TND" }, - { @"Peso argentin", @"ARS" }, - { @"Peso chilien", @"CLP" }, - { @"Peso colombien", @"COP" }, - { @"Peso cubains convertibles", @"CUC" }, - { @"Peso cubains", @"CUP" }, - { @"Peso dominicain", @"DOP" }, + { @"Swedish krona", @"SEK" }, + { @"West African CFA franc", @"XOF" }, + { @"Central African CFA franc", @"XAF" }, + { @"Comorian franc", @"KMF" }, + { @"Congolese franc", @"CDF" }, + { @"Burundian franc", @"BIF" }, + { @"Djiboutian franc", @"DJF" }, + { @"CFP franc", @"XPF" }, + { @"Guinean franc", @"GNF" }, + { @"Swiss franc", @"CHF" }, + { @"Rwandan franc", @"RWF" }, + { @"Russian ruble", @"RUB" }, + { @"Transnistrian ruble", @"PRB" }, + { @"New Belarusian ruble", @"BYN" }, + { @"Algerian dinar", @"DZD" }, + { @"Bahraini dinar", @"BHD" }, + { @"Iraqi dinar", @"IQD" }, + { @"Jordanian dinar", @"JOD" }, + { @"Kuwaiti dinar", @"KWD" }, + { @"Libyan dinar", @"LYD" }, + { @"Serbian dinar", @"RSD" }, + { @"Tunisian dinar", @"TND" }, + { @"Argentine peso", @"ARS" }, + { @"Chilean peso", @"CLP" }, + { @"Colombian peso", @"COP" }, + { @"Cuban convertible peso", @"CUC" }, + { @"Cuban peso", @"CUP" }, + { @"Dominican peso", @"DOP" }, { @"Mexican peso", @"MXN" }, - { @"Peso uruguayen", @"UYU" }, - { @"Livre britannique", @"GBP" }, - { @"Livre sainte-hélène", @"SHP" }, - { @"Livre égyptienne", @"EGP" }, - { @"Livre des îles falkland", @"FKP" }, - { @"Livre gibraltar", @"GIP" }, - { @"Livre manx", @"IMP" }, - { @"Livre jersey", @"JEP" }, - { @"Livre libanaise", @"LBP" }, + { @"Uruguayan peso", @"UYU" }, + { @"British pound", @"GBP" }, + { @"Saint Helena pound", @"SHP" }, + { @"Egyptian pound", @"EGP" }, + { @"Falkland Islands pound", @"FKP" }, + { @"Gibraltar pound", @"GIP" }, + { @"Manx pound", @"IMP" }, + { @"Jersey pound", @"JEP" }, + { @"Lebanese pound", @"LBP" }, { @"South Sudanese pound", @"SSP" }, - { @"Livre soudanaise", @"SDG" }, - { @"Livre syrienne", @"SYP" }, - { @"Dollar États-Unis", @"USD" }, - { @"Dollar Australien", @"AUD" }, - { @"Dollar des bahamas", @"BSD" }, + { @"Sudanese pound", @"SDG" }, + { @"Syrian pound", @"SYP" }, + { @"United States dollar", @"USD" }, + { @"Australian dollar", @"AUD" }, + { @"Bahamian dollar", @"BSD" }, { @"Barbadian dollar", @"BBD" }, - { @"Dollar de belize", @"BZD" }, - { @"Dollar des bermudes", @"BMD" }, - { @"Dollar de brunei", @"BND" }, - { @"Dollar de Singapour", @"SGD" }, - { @"Dollar Canadien", @"CAD" }, - { @"Dollar des îles Caïmans", @"KYD" }, + { @"Belize dollar", @"BZD" }, + { @"Bermudian dollar", @"BMD" }, + { @"Brunei dollar", @"BND" }, + { @"Singapore dollar", @"SGD" }, + { @"Canadian dollar", @"CAD" }, + { @"Cayman Islands dollar", @"KYD" }, { @"New Zealand dollar", @"NZD" }, { @"Fijian dollar", @"FJD" }, - { @"Dollar guyanien", @"GYD" }, - { @"Dollar de Hong Kong", @"HKD" }, - { @"Dollar jamaïcain", @"JMD" }, - { @"Dollar libérien", @"LRD" }, - { @"Dollar namibien", @"NAD" }, - { @"Dollar des îles Salomon", @"SBD" }, - { @"Dollar du suriname", @"SRD" }, - { @"Nouveau dollar de Taïwan", @"TWD" }, - { @"Dollar trinidadien", @"TTD" }, + { @"Guyanese dollar", @"GYD" }, + { @"Hong Kong dollar", @"HKD" }, + { @"Jamaican dollar", @"JMD" }, + { @"Liberian dollar", @"LRD" }, + { @"Namibian dollar", @"NAD" }, + { @"Solomon Islands dollar", @"SBD" }, + { @"Surinamese dollar", @"SRD" }, + { @"New Taiwan dollar", @"TWD" }, + { @"Trinidad and Tobago dollar", @"TTD" }, { @"Tuvaluan dollar", @"TVD" }, - { @"Yuan Chinois", @"CNY" }, + { @"Chinese yuan", @"CNY" }, { @"Rial", @"__RI" }, { @"Shiling", @"__S" }, { @"Som", @"__SO" }, diff --git a/.NET/Microsoft.Recognizers.Definitions.Common/Hindi/NumbersWithUnitDefinitions.cs b/.NET/Microsoft.Recognizers.Definitions.Common/Hindi/NumbersWithUnitDefinitions.cs index 0931f4eb29..965a8762b3 100644 --- a/.NET/Microsoft.Recognizers.Definitions.Common/Hindi/NumbersWithUnitDefinitions.cs +++ b/.NET/Microsoft.Recognizers.Definitions.Common/Hindi/NumbersWithUnitDefinitions.cs @@ -401,7 +401,7 @@ public static class NumbersWithUnitDefinitions { @"Rwandan franc", @"RWF" }, { @"Russian ruble", @"RUB" }, { @"Transnistrian ruble", @"PRB" }, - { @"Belarusian ruble", @"BYN" }, + { @"New Belarusian ruble", @"BYN" }, { @"Algerian dinar", @"DZD" }, { @"Bahraini dinar", @"BHD" }, { @"Iraqi dinar", @"IQD" }, diff --git a/.NET/Microsoft.Recognizers.Definitions.Common/Turkish/NumbersWithUnitDefinitions.cs b/.NET/Microsoft.Recognizers.Definitions.Common/Turkish/NumbersWithUnitDefinitions.cs index efe2a371d0..67f2721028 100644 --- a/.NET/Microsoft.Recognizers.Definitions.Common/Turkish/NumbersWithUnitDefinitions.cs +++ b/.NET/Microsoft.Recognizers.Definitions.Common/Turkish/NumbersWithUnitDefinitions.cs @@ -70,7 +70,7 @@ public static class NumbersWithUnitDefinitions }; public static readonly Dictionary CurrencySuffixList = new Dictionary { - { @"Afganistan afganisi", @"afganistan afganisi|afgani|؋|afn|af|afs|afganistan afganisine|afganistan afganisinde|afganistan afganisinden|afganistan afganisini|afganistan afganisinin|afganistan afganisidir|afganistan afganisiydi|afganistan afganisiymiş" }, + { @"Afghan afghani", @"afganistan afganisi|afgani|؋|afn|af|afs|afganistan afganisine|afganistan afganisinde|afganistan afganisinden|afganistan afganisini|afganistan afganisinin|afganistan afganisidir|afganistan afganisiydi|afganistan afganisiymiş" }, { @"Pul", @"pul|pula|pulda|puldan|pulu|pulun|puldur|puldu|pulmuş|pulluk" }, { @"Euro", @"euro|€|eur|avro|avroya|avroda|avrodan|avroyu|avronun|avrodur|avroydu|avroymuş|avroluk" }, { @"Cent", @"sent|s|sentte|sentten|senti|sentin|senttir|sentti|sentmiş|sentlik" }, @@ -417,7 +417,7 @@ public static class NumbersWithUnitDefinitions { @"Rwandan franc", @"RWF" }, { @"Russian ruble", @"RUB" }, { @"Transnistrian ruble", @"PRB" }, - { @"Belarusian ruble", @"BYN" }, + { @"New Belarusian ruble", @"BYN" }, { @"Algerian dinar", @"DZD" }, { @"Bahraini dinar", @"BHD" }, { @"Iraqi dinar", @"IQD" }, diff --git a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Dutch/Extractors/CurrencyExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Dutch/Extractors/CurrencyExtractorConfiguration.cs index 4f790dffc1..c223bdc285 100644 --- a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Dutch/Extractors/CurrencyExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Dutch/Extractors/CurrencyExtractorConfiguration.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; +using System.Linq; using Microsoft.Recognizers.Definitions.Dutch; @@ -13,8 +16,25 @@ public class CurrencyExtractorConfiguration : DutchNumberWithUnitExtractorConfig public static readonly ImmutableDictionary CurrencySuffixList = NumbersWithUnitDefinitions.CurrencySuffixList.ToImmutableDictionary(); - public static readonly ImmutableDictionary CurrencyPrefixList = - NumbersWithUnitDefinitions.CurrencyPrefixList.ToImmutableDictionary(); + // CurrencyNameToIsoCodeMap dictionary (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary IsoCodeDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture)); + + // CurrencyNameToIsoCodeMap followed by '$' symbol (e.g. 'AUD$') + public static readonly Dictionary IsoCodeWithSymbolDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture) + "$"); + + // Merge IsoCodeDict and IsoCodeWithSymbolDict + public static readonly Dictionary IsoCodeCombinedDict = IsoCodeDict.Concat(IsoCodeWithSymbolDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + // Merge IsoCodeCombinedDict with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList.Concat(IsoCodeCombinedDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + public static readonly ImmutableDictionary CurrencyPrefixList = CurrencyPrefixDict.ToImmutableDictionary(); public static readonly ImmutableDictionary FractionalUnitNameToCodeMap = NumbersWithUnitDefinitions.FractionalUnitNameToCodeMap.ToImmutableDictionary(); diff --git a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/English/Extractors/CurrencyExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/English/Extractors/CurrencyExtractorConfiguration.cs index 6b5a49c193..2ee0c48be9 100644 --- a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/English/Extractors/CurrencyExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/English/Extractors/CurrencyExtractorConfiguration.cs @@ -16,12 +16,23 @@ public class CurrencyExtractorConfiguration : EnglishNumberWithUnitExtractorConf public static readonly ImmutableDictionary CurrencySuffixList = NumbersWithUnitDefinitions.CurrencySuffixList.ToImmutableDictionary(); - // Merge CurrencyNameToIsoCodeMap with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) - public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList - .Concat(NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) - .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture))) - .GroupBy(x => x.Key) - .ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + // CurrencyNameToIsoCodeMap dictionary (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary IsoCodeDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture)); + + // CurrencyNameToIsoCodeMap followed by '$' symbol (e.g. 'AUD$') + public static readonly Dictionary IsoCodeWithSymbolDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture) + "$"); + + // Merge IsoCodeDict and IsoCodeWithSymbolDict + public static readonly Dictionary IsoCodeCombinedDict = IsoCodeDict.Concat(IsoCodeWithSymbolDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + // Merge IsoCodeCombinedDict with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList.Concat(IsoCodeCombinedDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); public static readonly ImmutableDictionary CurrencyPrefixList = CurrencyPrefixDict.ToImmutableDictionary(); diff --git a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/German/Extractors/CurrencyExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/German/Extractors/CurrencyExtractorConfiguration.cs index 6899d49c10..13f6c9f148 100644 --- a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/German/Extractors/CurrencyExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/German/Extractors/CurrencyExtractorConfiguration.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; +using System.Linq; using Microsoft.Recognizers.Definitions.German; @@ -10,7 +13,25 @@ namespace Microsoft.Recognizers.Text.NumberWithUnit.German { public class CurrencyExtractorConfiguration : GermanNumberWithUnitExtractorConfiguration { - public static readonly ImmutableDictionary CurrencyPrefixList = NumbersWithUnitDefinitions.CurrencyPrefixList.ToImmutableDictionary(); + // CurrencyNameToIsoCodeMap dictionary (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary IsoCodeDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture)); + + // CurrencyNameToIsoCodeMap followed by '$' symbol (e.g. 'AUD$') + public static readonly Dictionary IsoCodeWithSymbolDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture) + "$"); + + // Merge IsoCodeDict and IsoCodeWithSymbolDict + public static readonly Dictionary IsoCodeCombinedDict = IsoCodeDict.Concat(IsoCodeWithSymbolDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + // Merge IsoCodeCombinedDict with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList.Concat(IsoCodeCombinedDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + public static readonly ImmutableDictionary CurrencyPrefixList = CurrencyPrefixDict.ToImmutableDictionary(); public static readonly ImmutableDictionary CurrencySuffixList = NumbersWithUnitDefinitions.CurrencySuffixList.ToImmutableDictionary(); diff --git a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Hindi/Extractors/CurrencyExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Hindi/Extractors/CurrencyExtractorConfiguration.cs index 65a38ed7f8..0b04947543 100644 --- a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Hindi/Extractors/CurrencyExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Hindi/Extractors/CurrencyExtractorConfiguration.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; +using System.Linq; using Microsoft.Recognizers.Definitions.Hindi; @@ -13,8 +16,25 @@ public class CurrencyExtractorConfiguration : HindiNumberWithUnitExtractorConfig public static readonly ImmutableDictionary CurrencySuffixList = NumbersWithUnitDefinitions.CurrencySuffixList.ToImmutableDictionary(); - public static readonly ImmutableDictionary CurrencyPrefixList = - NumbersWithUnitDefinitions.CurrencyPrefixList.ToImmutableDictionary(); + // CurrencyNameToIsoCodeMap dictionary (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary IsoCodeDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture)); + + // CurrencyNameToIsoCodeMap followed by '$' symbol (e.g. 'AUD$') + public static readonly Dictionary IsoCodeWithSymbolDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture) + "$"); + + // Merge IsoCodeDict and IsoCodeWithSymbolDict + public static readonly Dictionary IsoCodeCombinedDict = IsoCodeDict.Concat(IsoCodeWithSymbolDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + // Merge IsoCodeCombinedDict with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList.Concat(IsoCodeCombinedDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + public static readonly ImmutableDictionary CurrencyPrefixList = CurrencyPrefixDict.ToImmutableDictionary(); public static readonly ImmutableDictionary FractionalUnitNameToCodeMap = NumbersWithUnitDefinitions.FractionalUnitNameToCodeMap.ToImmutableDictionary(); diff --git a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Italian/Extractors/CurrencyExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Italian/Extractors/CurrencyExtractorConfiguration.cs index 1d596d9098..effca61b64 100644 --- a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Italian/Extractors/CurrencyExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Italian/Extractors/CurrencyExtractorConfiguration.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; +using System.Linq; using Microsoft.Recognizers.Definitions.Italian; @@ -12,7 +15,25 @@ public class CurrencyExtractorConfiguration : ItalianNumberWithUnitExtractorConf { public static readonly ImmutableDictionary CurrencySuffixList = NumbersWithUnitDefinitions.CurrencySuffixList.ToImmutableDictionary(); - public static readonly ImmutableDictionary CurrencyPrefixList = NumbersWithUnitDefinitions.CurrencyPrefixList.ToImmutableDictionary(); + // CurrencyNameToIsoCodeMap dictionary (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary IsoCodeDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture)); + + // CurrencyNameToIsoCodeMap followed by '$' symbol (e.g. 'AUD$') + public static readonly Dictionary IsoCodeWithSymbolDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture) + "$"); + + // Merge IsoCodeDict and IsoCodeWithSymbolDict + public static readonly Dictionary IsoCodeCombinedDict = IsoCodeDict.Concat(IsoCodeWithSymbolDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + // Merge IsoCodeCombinedDict with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList.Concat(IsoCodeCombinedDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + public static readonly ImmutableDictionary CurrencyPrefixList = CurrencyPrefixDict.ToImmutableDictionary(); private static readonly ImmutableList AmbiguousValues = NumbersWithUnitDefinitions.AmbiguousCurrencyUnitList.ToImmutableList(); diff --git a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Swedish/Extractors/CurrencyExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Swedish/Extractors/CurrencyExtractorConfiguration.cs index 04726fd623..1f60565c16 100644 --- a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Swedish/Extractors/CurrencyExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Swedish/Extractors/CurrencyExtractorConfiguration.cs @@ -16,12 +16,23 @@ public class CurrencyExtractorConfiguration : SwedishNumberWithUnitExtractorConf public static readonly ImmutableDictionary CurrencySuffixList = NumbersWithUnitDefinitions.CurrencySuffixList.ToImmutableDictionary(); - // Merge CurrencyNameToIsoCodeMap with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) - public static readonly Dictionary CurrencyPrefixDict = - NumbersWithUnitDefinitions.CurrencyPrefixList - .Concat(NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) - .ToDictionary(x => x.Key, x => x.Value.ToLowerInvariant())).GroupBy(x => x.Key) - .ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + // CurrencyNameToIsoCodeMap dictionary (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary IsoCodeDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture)); + + // CurrencyNameToIsoCodeMap followed by '$' symbol (e.g. 'AUD$') + public static readonly Dictionary IsoCodeWithSymbolDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture) + "$"); + + // Merge IsoCodeDict and IsoCodeWithSymbolDict + public static readonly Dictionary IsoCodeCombinedDict = IsoCodeDict.Concat(IsoCodeWithSymbolDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + // Merge IsoCodeCombinedDict with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList.Concat(IsoCodeCombinedDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); public static readonly ImmutableDictionary CurrencyPrefixList = CurrencyPrefixDict.ToImmutableDictionary(); diff --git a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Turkish/Extractors/CurrencyExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Turkish/Extractors/CurrencyExtractorConfiguration.cs index bde89239c6..13a0e90c52 100644 --- a/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Turkish/Extractors/CurrencyExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.NumberWithUnit/Turkish/Extractors/CurrencyExtractorConfiguration.cs @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; +using System.Linq; using Microsoft.Recognizers.Definitions.Turkish; @@ -12,7 +15,25 @@ public class CurrencyExtractorConfiguration : TurkishNumberWithUnitExtractorConf { public static readonly ImmutableDictionary CurrencySuffixList = NumbersWithUnitDefinitions.CurrencySuffixList.ToImmutableDictionary(); - public static readonly ImmutableDictionary CurrencyPrefixList = NumbersWithUnitDefinitions.CurrencyPrefixList.ToImmutableDictionary(); + // CurrencyNameToIsoCodeMap dictionary (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary IsoCodeDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture)); + + // CurrencyNameToIsoCodeMap followed by '$' symbol (e.g. 'AUD$') + public static readonly Dictionary IsoCodeWithSymbolDict = + NumbersWithUnitDefinitions.CurrencyNameToIsoCodeMap.Where(x => !x.Value.StartsWith("_", StringComparison.Ordinal)) + .ToDictionary(x => x.Key, x => x.Value.ToLower(CultureInfo.InvariantCulture) + "$"); + + // Merge IsoCodeDict and IsoCodeWithSymbolDict + public static readonly Dictionary IsoCodeCombinedDict = IsoCodeDict.Concat(IsoCodeWithSymbolDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + // Merge IsoCodeCombinedDict with CurrencyPrefixList (excluding fake and unofficial Iso codes starting with underscore) + public static readonly Dictionary CurrencyPrefixDict = NumbersWithUnitDefinitions.CurrencyPrefixList.Concat(IsoCodeCombinedDict) + .GroupBy(x => x.Key).ToDictionary(x => x.Key, y => y.Count() > 1 ? string.Join("|", new string[] { y.First().Value, y.Last().Value }) : y.First().Value); + + public static readonly ImmutableDictionary CurrencyPrefixList = CurrencyPrefixDict.ToImmutableDictionary(); public static readonly ImmutableDictionary FractionalUnitNameToCodeMap = NumbersWithUnitDefinitions.FractionalUnitNameToCodeMap.ToImmutableDictionary(); diff --git a/Patterns/Dutch/Dutch-NumbersWithUnit.yaml b/Patterns/Dutch/Dutch-NumbersWithUnit.yaml index 2fccc9bfce..d15e7862f6 100644 --- a/Patterns/Dutch/Dutch-NumbersWithUnit.yaml +++ b/Patterns/Dutch/Dutch-NumbersWithUnit.yaml @@ -616,7 +616,7 @@ CurrencyNameToIsoCodeMap: !dictionary Rwandan franc: RWF Russian ruble: RUB Transnistrian ruble: PRB - Belarusian ruble: BYN + New Belarusian ruble: BYN Algerian dinar: DZD Bahraini dinar: BHD Iraqi dinar: IQD diff --git a/Patterns/German/German-NumbersWithUnit.yaml b/Patterns/German/German-NumbersWithUnit.yaml index 492e7dbfe1..74e2f9d7d3 100644 --- a/Patterns/German/German-NumbersWithUnit.yaml +++ b/Patterns/German/German-NumbersWithUnit.yaml @@ -390,156 +390,158 @@ CurrencyNameToIsoCodeMap: !dictionary Afghan afghani: AFN Euro: EUR Albanian lek: ALL - Kwanza angolais: AOA + Angolan kwanza: AOA Armenian dram: AMD - Florins d'Aruba: AWG + Aruban florin: AWG Bangladeshi taka: BDT - Ngultrum bhoutanais: BTN - Boliviano bolivien: BOB - Bosnie-Herzégovine mark convertible: BAM - Pula: BWP - Réal brésilien: BRL - Lev bulgare: BGN - Riel cambodgien: KHR - Escudo du cap-vert: CVE - Colon du costa rica: CRC - Kuna croate: HRK - Couronne tchèque: CZK - Nakfas érythréens: ERN - Birr éthiopien: ETB - Dalasi gambienne: GMD - Lari géorgien: GEL - Cedi: GHS - Quetzal guatémaltèque: GTQ - Gourdes haïtiennes: HTG - Lempira hondurien: HNL - Forint hongrois: HUF - Rial iranien: IRR + Bhutanese ngultrum: BTN + Bolivian boliviano: BOB + Bosnia and Herzegovina convertible mark: BAM + Botswana pula: BWP + Brazilian real: BRL + Bulgarian lev: BGN + Cambodian riel: KHR + Cape Verdean escudo: CVE + Costa Rican colón: CRC + Croatian kuna: HRK + Czech koruna: CZK + Eritrean nakfa: ERN + Ethiopian birr: ETB + Gambian dalasi: GMD + Georgian lari: GEL + Ghanaian cedi: GHS + Guatemalan quetzal: GTQ + Haitian gourde: HTG + Honduran lempira: HNL + Hungarian forint: HUF + Iranian rial: IRR Yemeni rial: YER Israeli new shekel: ILS - Yen Japonais: JPY - Tenge kazakh: KZT - Shilling kényan: KES - Corée du nord won: KPW - Won sud-coréen: KRW - Som Kirghizie: KGS - Kip laotien: LAK - Loti: LSL - Rand sud-africain: ZAR - Pataca macanais: MOP - Dinar macédonien: MKD - Ariary malagache: MGA - Kwacha malawien: MWK - Ringitt malaisien: MYR - Ouguiya mauritanienne: MRO - Togrogs mongoles: MNT - Metical mozambique: MZN - Kyat birmanie: MMK - Cordoba nicaraguayen: NIO + Japanese yen: JPY + Kazakhstani tenge: KZT + Kenyan shilling: KES + North Korean won: KPW + South Korean won: KRW + Kyrgyzstani som: KGS + Lao kip: LAK + Lesotho loti: LSL + South African rand: ZAR + Macanese pataca: MOP + Macedonian denar: MKD + Malagasy ariary: MGA + Malawian kwacha: MWK + Malaysian ringgit: MYR + Mauritanian ouguiya: MRO + Mongolian tögrög: MNT + Mozambican metical: MZN + Burmese kyat: MMK + Nicaraguan córdoba: NIO Nigerian naira: NGN - Livre turque: TRY - Rials omanais: OMR - Balboa panaméennes: PAB - Kina: PGK - Guaraní paraguayen: PYG + Turkish lira: TRY + Omani rial: OMR + Panamanian balboa: PAB + Papua New Guinean kina: PGK + Paraguayan guaraní: PYG Peruvian sol: PEN - Złoty polonais: PLN - Riyal qatari: QAR - Riyal saudi: SAR - Tala: WST + Polish złoty: PLN + Qatari riyal: QAR + Saudi riyal: SAR + Samoan tālā: WST São Tomé and Príncipe dobra: STN - Leone: SLL - Lilangeni: SZL - Somoni tadjikistan: TJS - Baht thaïlandais: THB - Hryvnia ukrainien: UAH + Sierra Leonean leone: SLL + Swazi lilangeni: SZL + Tajikistani somoni: TJS + Thai baht: THB + Ukrainian hryvnia: UAH Vanuatu vatu: VUV - Bolívar vénézuélien: VEF - Kwacha de Zambie: ZMW - Dirham marocain: MAD - Dirham des Émirats arabes unis: AED - Manat azerbaïdjanais: AZN - Manat turkmène: TMT - Shilling somalien: SOS - Shilling tanzanien: TZS - Shilling ougandais: UGX - Leu roumain: RON - Leu moldave: MDL - Roupie népalaise: NPR - Roupie pakistanaise: PKR - Roupie indienne: INR - Roupie seychelloise: SCR - Roupie mauricienne: MUR - Rufiyaa maldives: MVR + Venezuelan bolívar: VEF + Zambian kwacha: ZMW + Moroccan dirham: MAD + United Arab Emirates dirham: AED + Azerbaijani manat: AZN + Turkmenistan manat: TMT + Somali shilling: SOS + Tanzanian shilling: TZS + Ugandan shilling: UGX + Romanian leu: RON + Moldovan leu: MDL + Nepalese rupee: NPR + Pakistani rupee: PKR + Indian rupee: INR + Seychellois rupee: SCR + Mauritian rupee: MUR + Maldivian rufiyaa: MVR Sri Lankan rupee: LKR - Rupiah Indonésie: IDR - Couronne danoise: DKK - Couronne norvégienne: NOK + Indonesian rupiah: IDR + Danish krone: DKK + Norwegian krone: NOK Icelandic króna: ISK - Couronne suédoise: SEK - Franc CFA de l'Afrique de l'Ouest: XOF - Franc CFA d'Afrique centrale: XAF - Franc comorien: KMF - Franc congolais: CDF - Franc burundais: BIF - Franc djiboutienne: DJF - Franc CFP: XPF - Franc guinéen: GNF - Franc Suisse: CHF - Franc rwandais: RWF - Rouble russe: RUB - Rouble transnistriens: PRB - Nouveau rouble biélorusse: BYN - Dinar algérien: DZD - Dinar de bahreïn: BHD - Dinar iraquien: IQD - Dinar jordanien: JOD - Dinar koweïtien: KWD - Dinar libyen: LYD - Dinar serbe: RSD - Dinar tunisien: TND - Peso argentin: ARS - Peso chilien: CLP - Peso colombien: COP - Peso cubains convertibles: CUC - Peso cubains: CUP - Peso dominicain: DOP + Swedish krona: SEK + West African CFA franc: XOF + Central African CFA franc: XAF + Comorian franc: KMF + Congolese franc: CDF + Burundian franc: BIF + Djiboutian franc: DJF + CFP franc: XPF + Guinean franc: GNF + Swiss franc: CHF + Rwandan franc: RWF + Russian ruble: RUB + Transnistrian ruble: PRB + New Belarusian ruble: BYN + Algerian dinar: DZD + Bahraini dinar: BHD + Iraqi dinar: IQD + Jordanian dinar: JOD + Kuwaiti dinar: KWD + Libyan dinar: LYD + Serbian dinar: RSD + Tunisian dinar: TND + Argentine peso: ARS + Chilean peso: CLP + Colombian peso: COP + Cuban convertible peso: CUC + Cuban peso: CUP + Dominican peso: DOP Mexican peso: MXN - Peso uruguayen: UYU - Livre britannique: GBP - Livre sainte-hélène: SHP - Livre égyptienne: EGP - Livre des îles falkland: FKP - Livre gibraltar: GIP - Livre manx: IMP - Livre jersey: JEP - Livre libanaise: LBP + Uruguayan peso: UYU + British pound: GBP + Saint Helena pound: SHP + Egyptian pound: EGP + Falkland Islands pound: FKP + Gibraltar pound: GIP + Manx pound: IMP + Jersey pound: JEP + Lebanese pound: LBP South Sudanese pound: SSP - Livre soudanaise: SDG - Livre syrienne: SYP - Dollar États-Unis: USD - Dollar Australien: AUD - Dollar des bahamas: BSD + Sudanese pound: SDG + Syrian pound: SYP + United States dollar: USD + Australian dollar: AUD + Bahamian dollar: BSD Barbadian dollar: BBD - Dollar de belize: BZD - Dollar des bermudes: BMD - Dollar de brunei: BND - Dollar de Singapour: SGD - Dollar Canadien: CAD - Dollar des îles Caïmans: KYD + Belize dollar: BZD + Bermudian dollar: BMD + Brunei dollar: BND + Singapore dollar: SGD + Canadian dollar: CAD + Cayman Islands dollar: KYD New Zealand dollar: NZD Fijian dollar: FJD - Dollar guyanien: GYD - Dollar de Hong Kong: HKD - Dollar jamaïcain: JMD - Dollar libérien: LRD - Dollar namibien: NAD - Dollar des îles Salomon: SBD - Dollar du suriname: SRD - Nouveau dollar de Taïwan: TWD - Dollar trinidadien: TTD + Guyanese dollar: GYD + Hong Kong dollar: HKD + Jamaican dollar: JMD + Liberian dollar: LRD + Namibian dollar: NAD + Solomon Islands dollar: SBD + Surinamese dollar: SRD + New Taiwan dollar: TWD + Trinidad and Tobago dollar: TTD Tuvaluan dollar: TVD - Yuan Chinois: CNY + Chinese yuan: CNY + # Fake ISO code + # Special main unit Rial: __RI Shiling: __S Som: __SO @@ -556,6 +558,7 @@ CurrencyNameToIsoCodeMap: !dictionary Ruble: __RB Peso: __PE Pound: __P + # Currencies we extract, but that don't have an official ISO code Tristan da Cunha pound: _TP South Georgia and the South Sandwich Islands pound: _SP Somaliland shilling: _SS diff --git a/Patterns/Hindi/Hindi-NumbersWithUnit.yaml b/Patterns/Hindi/Hindi-NumbersWithUnit.yaml index 96da14f524..6aca858a78 100644 --- a/Patterns/Hindi/Hindi-NumbersWithUnit.yaml +++ b/Patterns/Hindi/Hindi-NumbersWithUnit.yaml @@ -477,7 +477,7 @@ CurrencyNameToIsoCodeMap: !dictionary Rwandan franc: RWF Russian ruble: RUB Transnistrian ruble: PRB - Belarusian ruble: BYN + New Belarusian ruble: BYN Algerian dinar: DZD Bahraini dinar: BHD Iraqi dinar: IQD diff --git a/Patterns/Turkish/Turkish-NumbersWithUnit.yaml b/Patterns/Turkish/Turkish-NumbersWithUnit.yaml index 19e3211c56..5388662630 100644 --- a/Patterns/Turkish/Turkish-NumbersWithUnit.yaml +++ b/Patterns/Turkish/Turkish-NumbersWithUnit.yaml @@ -55,7 +55,7 @@ CurrencySuffixList: !dictionary entries: #Abhazya -> Rus Rublesi #Afghan afghani - Afganistan afganisi: afganistan afganisi|afgani|؋|afn|af|afs|afganistan afganisine|afganistan afganisinde|afganistan afganisinden|afganistan afganisini|afganistan afganisinin|afganistan afganisidir|afganistan afganisiydi|afganistan afganisiymiş + Afghan afghani: afganistan afganisi|afgani|؋|afn|af|afs|afganistan afganisine|afganistan afganisinde|afganistan afganisinden|afganistan afganisini|afganistan afganisinin|afganistan afganisidir|afganistan afganisiydi|afganistan afganisiymiş Pul: pul|pula|pulda|puldan|pulu|pulun|puldur|puldu|pulmuş|pulluk #Euro Euro: euro|€|eur|avro|avroya|avroda|avrodan|avroyu|avronun|avrodur|avroydu|avroymuş|avroluk @@ -507,7 +507,7 @@ CurrencyNameToIsoCodeMap: !dictionary Rwandan franc: RWF Russian ruble: RUB Transnistrian ruble: PRB - Belarusian ruble: BYN + New Belarusian ruble: BYN Algerian dinar: DZD Bahraini dinar: BHD Iraqi dinar: IQD diff --git a/Specs/NumberWithUnit/Dutch/CurrencyModel.json b/Specs/NumberWithUnit/Dutch/CurrencyModel.json index b8f849e49b..88d118aa81 100644 --- a/Specs/NumberWithUnit/Dutch/CurrencyModel.json +++ b/Specs/NumberWithUnit/Dutch/CurrencyModel.json @@ -446,5 +446,90 @@ "End": 28 } ] + }, + { + "Input": "usd$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "usd$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "United States dollar", + "isoCurrency": "USD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "mxn$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "mxn$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Mexican peso", + "isoCurrency": "MXN" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "aud$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "aud$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Australian dollar", + "isoCurrency": "AUD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "cad$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "cad$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Canadian dollar", + "isoCurrency": "CAD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "nzd$15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "nzd$15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "New Zealand dollar", + "isoCurrency": "NZD" + }, + "Start": 0, + "End": 5 + } + ] } ] \ No newline at end of file diff --git a/Specs/NumberWithUnit/English/CurrencyModel.json b/Specs/NumberWithUnit/English/CurrencyModel.json index b4844bf9e4..43ed9feec7 100644 --- a/Specs/NumberWithUnit/English/CurrencyModel.json +++ b/Specs/NumberWithUnit/English/CurrencyModel.json @@ -2516,5 +2516,56 @@ "End": 6 } ] + }, + { + "Input": "aud$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "aud$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Australian dollar", + "isoCurrency": "AUD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "cad$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "cad$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Canadian dollar", + "isoCurrency": "CAD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "nzd$15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "nzd$15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "New Zealand dollar", + "isoCurrency": "NZD" + }, + "Start": 0, + "End": 5 + } + ] } ] \ No newline at end of file diff --git a/Specs/NumberWithUnit/German/CurrencyModel.json b/Specs/NumberWithUnit/German/CurrencyModel.json index ba46e977fd..b81170b5a7 100644 --- a/Specs/NumberWithUnit/German/CurrencyModel.json +++ b/Specs/NumberWithUnit/German/CurrencyModel.json @@ -512,5 +512,90 @@ "End": 25 } ] + }, + { + "Input": "usd$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "usd$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "United States dollar", + "isoCurrency": "USD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "mxn$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "mxn$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Mexican peso", + "isoCurrency": "MXN" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "aud$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "aud$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Australian dollar", + "isoCurrency": "AUD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "cad$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "cad$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Canadian dollar", + "isoCurrency": "CAD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "nzd$15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "nzd$15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "New Zealand dollar", + "isoCurrency": "NZD" + }, + "Start": 0, + "End": 5 + } + ] } ] \ No newline at end of file diff --git a/Specs/NumberWithUnit/Hindi/CurrencyModel.json b/Specs/NumberWithUnit/Hindi/CurrencyModel.json index 2155d80a93..bd94e7010d 100644 --- a/Specs/NumberWithUnit/Hindi/CurrencyModel.json +++ b/Specs/NumberWithUnit/Hindi/CurrencyModel.json @@ -1825,5 +1825,90 @@ "End": 10 } ] + }, + { + "Input": "usd$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "usd$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "United States dollar", + "isoCurrency": "USD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "mxn$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "mxn$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Mexican peso", + "isoCurrency": "MXN" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "aud$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "aud$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Australian dollar", + "isoCurrency": "AUD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "cad$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "cad$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Canadian dollar", + "isoCurrency": "CAD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "nzd$15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "nzd$15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "New Zealand dollar", + "isoCurrency": "NZD" + }, + "Start": 0, + "End": 5 + } + ] } ] \ No newline at end of file diff --git a/Specs/NumberWithUnit/Italian/CurrencyModel.json b/Specs/NumberWithUnit/Italian/CurrencyModel.json index 9d638a839c..ea19cd4f10 100644 --- a/Specs/NumberWithUnit/Italian/CurrencyModel.json +++ b/Specs/NumberWithUnit/Italian/CurrencyModel.json @@ -1410,5 +1410,90 @@ "End": 23 } ] + }, + { + "Input": "usd$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "usd$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "United States dollar", + "isoCurrency": "USD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "mxn$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "mxn$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Mexican peso", + "isoCurrency": "MXN" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "aud$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "aud$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Australian dollar", + "isoCurrency": "AUD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "cad$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "cad$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Canadian dollar", + "isoCurrency": "CAD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "nzd$15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "nzd$15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "New Zealand dollar", + "isoCurrency": "NZD" + }, + "Start": 0, + "End": 5 + } + ] } ] \ No newline at end of file diff --git a/Specs/NumberWithUnit/Swedish/CurrencyModel.json b/Specs/NumberWithUnit/Swedish/CurrencyModel.json index 6419bfb545..93e3e76a47 100644 --- a/Specs/NumberWithUnit/Swedish/CurrencyModel.json +++ b/Specs/NumberWithUnit/Swedish/CurrencyModel.json @@ -515,5 +515,90 @@ "End": 27 } ] + }, + { + "Input": "usd$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "usd$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "United States dollar", + "isoCurrency": "USD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "mxn$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "mxn$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Mexican peso", + "isoCurrency": "MXN" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "aud$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "aud$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Australian dollar", + "isoCurrency": "AUD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "cad$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "cad$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Canadian dollar", + "isoCurrency": "CAD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "nzd$15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "nzd$15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "New Zealand dollar", + "isoCurrency": "NZD" + }, + "Start": 0, + "End": 5 + } + ] } ] \ No newline at end of file diff --git a/Specs/NumberWithUnit/Turkish/CurrencyModel.json b/Specs/NumberWithUnit/Turkish/CurrencyModel.json index 1a065eb51f..2a74e5ff78 100644 --- a/Specs/NumberWithUnit/Turkish/CurrencyModel.json +++ b/Specs/NumberWithUnit/Turkish/CurrencyModel.json @@ -1709,5 +1709,90 @@ } } ] + }, + { + "Input": "usd$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "usd$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "United States dollar", + "isoCurrency": "USD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "mxn$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "mxn$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Mexican peso", + "isoCurrency": "MXN" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "aud$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "aud$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Australian dollar", + "isoCurrency": "AUD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "cad$ 15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "cad$ 15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "Canadian dollar", + "isoCurrency": "CAD" + }, + "Start": 0, + "End": 6 + } + ] + }, + { + "Input": "nzd$15", + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "nzd$15", + "TypeName": "currency", + "Resolution": { + "value": "15", + "unit": "New Zealand dollar", + "isoCurrency": "NZD" + }, + "Start": 0, + "End": 5 + } + ] } ] \ No newline at end of file