Skip to content

Commit

Permalink
[Python] Update French Currency and DateTimeV2 to parity with .NET (#…
Browse files Browse the repository at this point in the history
…2920)

* Update French Currency Parsers in Python and a change to its Datetime extractor

* Use connector regex, according to review
  • Loading branch information
samhickey25 authored May 5, 2022
1 parent 8dc1452 commit 0d21241
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,5 @@ def is_connector_token(self, source: str) -> bool:
return (
source == '' or source == ',' or
regex.search(self.preposition_regex, source) is not None or
source == 't' or
source == 'pour' or
source == 'vers'
regex.search(self.connector_regex, source) is not None
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def __init__(self, culture_info: CultureInfo = None):
super().__init__(culture_info)
self.add_dict_to_unit_map(FrenchNumericWithUnit.CurrencySuffixList)
self.add_dict_to_unit_map(FrenchNumericWithUnit.CurrencyPrefixList)
self.currency_name_to_iso_code_map = FrenchNumericWithUnit.CurrencyNameToIsoCodeMap
self.currency_fraction_code_list = FrenchNumericWithUnit.FractionalUnitNameToCodeMap


class FrenchDimensionParserConfiguration(FrenchNumberWithUnitParserConfiguration):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ def initialize_configuration(self):
# endregion

# region French
self.register_model('CurrencyModel', Culture.French, lambda options: CurrencyModel([
ExtractorParserModel(
NumberWithUnitExtractor(
FrenchCurrencyExtractorConfiguration()),
NumberWithUnitParser(FrenchCurrencyParserConfiguration()))
]))
self.register_model('CurrencyModel', Culture.French, lambda options: CurrencyModel(
[ExtractorParserModel(BaseMergedUnitExtractor(FrenchCurrencyExtractorConfiguration(
)), BaseMergedUnitParser(FrenchCurrencyParserConfiguration()))]
))
self.register_model('TemperatureModel', Culture.French, lambda options: TemperatureModel([
ExtractorParserModel(
NumberWithUnitExtractor(
Expand Down
Loading

0 comments on commit 0d21241

Please sign in to comment.