From 6267fc195bb078554850eae18147105781198424 Mon Sep 17 00:00:00 2001 From: emphasize Date: Thu, 28 Jan 2021 13:47:53 +0100 Subject: [PATCH 01/13] fix extract_datetime offset-aware/naive bug --- lingua_franca/lang/parse_de.py | 95 +++++++++------------------------- 1 file changed, 25 insertions(+), 70 deletions(-) diff --git a/lingua_franca/lang/parse_de.py b/lingua_franca/lang/parse_de.py index 5f7f7b32..cc193e02 100644 --- a/lingua_franca/lang/parse_de.py +++ b/lingua_franca/lang/parse_de.py @@ -20,64 +20,7 @@ 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 mycroft.util.time import default_timezone # TODO: short_scale and ordinals don't do anything here. # The parameters are present in the function signature for API compatibility @@ -405,7 +348,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,10 +357,13 @@ def date_found(): m = monthsShort.index(word) used += 1 datestr = months[m] + #commonly spoken : 15(.=gets replaced) Mai /