From 83265e9abf2fb8050d3ae0e276b7ea7c7df80f7e Mon Sep 17 00:00:00 2001 From: Martin Pohlack Date: Sun, 14 Jun 2020 01:48:03 +0200 Subject: [PATCH] Address #931 and similar issue when parsing times All_number_words is not working perfectly here. The number words need to go through localization and also need word boundaries, otherwise they match other partial ingredients or time words in other languages. E.g., "ten" match the tail of the German word for minutes (Minuten). Disable broken parsing of number words for now. Fixes #931. Signed-off-by: Martin Pohlack --- gourmet/convert.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gourmet/convert.py b/gourmet/convert.py index 1cfb6c227..922c33778 100644 --- a/gourmet/convert.py +++ b/gourmet/convert.py @@ -644,7 +644,8 @@ def integerp (num, approx=0.01): lambda x,y: ((len(y)>len(x) and 1) or (len(x)>len(y) and -1) or 0) ) -NUMBER_WORD_REGEXP = '|'.join(all_number_words).replace(' ','\s+') +#NUMBER_WORD_REGEXP = '|'.join(all_number_words).replace(' ','\s+') +NUMBER_WORD_REGEXP = None FRACTION_WORD_REGEXP = '|'.join(filter(lambda n: NUMBER_WORDS[n]<1.0, all_number_words) ).replace(' ','\s+')