Skip to content

Commit

Permalink
Address thinkle#931 and similar issue when parsing times
Browse files Browse the repository at this point in the history
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 thinkle#931.

Signed-off-by: Martin Pohlack <[email protected]>
  • Loading branch information
Martin Pohlack committed Jun 21, 2020
1 parent 543cee2 commit 83265e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gourmet/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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+')
Expand Down

0 comments on commit 83265e9

Please sign in to comment.