From c0593e6f5baec77dcf60af27e70a5e06b2dc4c2b Mon Sep 17 00:00:00 2001 From: Mohammad Hijjawi Date: Sat, 17 Oct 2026 23:14:34 +0100 Subject: [PATCH] Keep "point" when it does not start a decimal in the English normalizer EnglishNumberNormalizer only emitted "point" when the next word was not a number word at all. When the next word was number-related but not a decimal digit ("and", "minus", "first", "dollars", ...), the branch did nothing and the word was silently dropped: "that was the point and then" -> "that was the and then" "match point minus two" -> "match -2" Emit "point" (after flushing any pending value) in that case, as the "double"/"triple" branch already does. --- tests/test_normalizer.py | 4 ++++ whisper/normalizers/english.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/tests/test_normalizer.py b/tests/test_normalizer.py index 7f89da0ec..870df524e 100644 --- a/tests/test_normalizer.py +++ b/tests/test_normalizer.py @@ -46,6 +46,10 @@ def test_number_normalizer(std): assert std("fourteen point 4") == "14.4" assert std("one point five") == "1.5" assert std("two point two five dollars") == "$2.25" + assert std("that was the point and then") == "that was the point and then" + assert std("match point minus two") == "match point -2" + assert std("good point first of all") == "good point 1st of all" + assert std("two point and") == "2 point and" assert std("two hundred million dollars") == "$200000000" assert std("$20.1 million") == "$20100000" diff --git a/whisper/normalizers/english.py b/whisper/normalizers/english.py index 21c3a54e5..ba94be63d 100644 --- a/whisper/normalizers/english.py +++ b/whisper/normalizers/english.py @@ -375,6 +375,11 @@ def output(result: Union[str, int]): elif current == "point": if next in self.decimals or next_is_numeric: value = str(value or "") + "." + else: + # not a decimal point, e.g. "the point and", "match point minus" + if value is not None: + yield output(value) + yield output(current) else: # should all have been covered at this point raise ValueError(f"Unexpected token: {current}")