diff --git a/lingua_franca/lang/parse_de.py b/lingua_franca/lang/parse_de.py index 5f7f7b32..110eb189 100644 --- a/lingua_franca/lang/parse_de.py +++ b/lingua_franca/lang/parse_de.py @@ -14,70 +14,14 @@ # limitations under the License. # import re +import json from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta from lingua_franca.lang.parse_common import is_numeric, look_for_fractions, \ extract_numbers_generic, Normalizer from lingua_franca.lang.common_data_de import _DE_NUMBERS from lingua_franca.lang.format_de import pronounce_number_de - -de_numbers = { - 'null': 0, - 'ein': 1, - 'eins': 1, - 'eine': 1, - 'einer': 1, - 'einem': 1, - 'einen': 1, - 'eines': 1, - 'zwei': 2, - 'drei': 3, - 'vier': 4, - 'fünf': 5, - 'sechs': 6, - 'sieben': 7, - 'acht': 8, - 'neun': 9, - 'zehn': 10, - 'elf': 11, - 'zwölf': 12, - 'dreizehn': 13, - 'vierzehn': 14, - 'fünfzehn': 15, - 'sechzehn': 16, - 'siebzehn': 17, - 'achtzehn': 18, - 'neunzehn': 19, - 'zwanzig': 20, - 'einundzwanzig': 21, - 'zweiundzwanzig': 22, - 'dreiundzwanzig': 23, - 'vierundzwanzig': 24, - 'fünfundzwanzig': 25, - 'sechsundzwanzig': 26, - 'siebenundzwanzig': 27, - 'achtundzwanzig': 28, - 'neunundzwanzig': 29, - 'dreißig': 30, - 'einunddreißig': 31, - 'vierzig': 40, - 'fünfzig': 50, - 'sechzig': 60, - 'siebzig': 70, - 'achtzig': 80, - 'neunzig': 90, - 'hundert': 100, - 'zweihundert': 200, - 'dreihundert': 300, - 'vierhundert': 400, - 'fünfhundert': 500, - 'sechshundert': 600, - 'siebenhundert': 700, - 'achthundert': 800, - 'neunhundert': 900, - 'tausend': 1000, - 'million': 1000000 -} +from lingua_franca.internal import resolve_resource_file # TODO: short_scale and ordinals don't do anything here. # The parameters are present in the function signature for API compatibility @@ -405,7 +349,8 @@ def date_found(): dayOffset -= 7 used += 1 start -= 1 - # parse 15 of July, June 20th, Feb 18, 19 of February + + # parse 15 Mai, Mai der 20ste, Dez 18 elif word in months or word in monthsShort and not fromFlag: try: m = months.index(word) @@ -413,35 +358,38 @@ def date_found(): m = monthsShort.index(word) used += 1 datestr = months[m] + #commonly spoken : 15(.=gets replaced) Mai /