From d2539f5b57e541375dd4a2669f4ef7f75171bb7d Mon Sep 17 00:00:00 2001 From: Al Date: Mon, 27 Jul 2015 01:44:33 -0400 Subject: [PATCH] [numex] Fixing case of hyphen/space-initial phrases in numex, as well as whole token only languages with ordinals --- src/numex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/numex.c b/src/numex.c index 276a00ab..dd6fa356 100644 --- a/src/numex.c +++ b/src/numex.c @@ -759,7 +759,7 @@ numex_result_array *convert_numeric_expressions(char *str, char *lang) { /* e.g. in English, "two hundred", when you get to hundred, multiply by the left value mod the current value, which also covers things like - "one thousand two hundred" although in those cases should be less commmon in addresses + "one thousand two hundred" although those cases should be less commmon in addresses */ if (result.len == 0) { @@ -808,7 +808,7 @@ numex_result_array *convert_numeric_expressions(char *str, char *lang) { if (rule.rule_type == NUMEX_ORDINAL_RULE) { result.is_ordinal = true; - if (rule.right_context_type == NUMEX_RIGHT_CONTEXT_NONE) { + if (rule.right_context_type == NUMEX_RIGHT_CONTEXT_NONE && !whole_tokens_only) { number_finished = true; } log_debug("rule is ordinal\n"); @@ -826,8 +826,8 @@ numex_result_array *convert_numeric_expressions(char *str, char *lang) { set_rule = false; if (advance_index) { - idx += phrase.len; - ptr += phrase.len; + idx += phrase.start + phrase.len; + ptr += phrase.start + phrase.len; } advance_index = true;