Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Per-PR attribution and contributor credits are published automatically on the co
- Brazilian Portuguese text normalization for numbers, common currencies, times, and units (#392, #598)

### Fixed
- A decimal written without a leading zero is read without one: `.45` is "point four five", not "zero point four five" (#601)
- A URL that starts with `HTTPS://` or `Https://` is read as "https", not "http"
- SSML `<voice>` names with characters outside valid voice names are ignored instead of emitting extra control tags
- `GAP_TRIM_MS=0` turns the base chunk trim off. It used to slice every chunk to nothing, so all audio came back silent
Expand Down
5 changes: 4 additions & 1 deletion api/src/services/text_processing/normalization/english.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ def handle(n: re.Match[str]) -> str:
):
return split_four_digit(number)

return f"{INFLECT_ENGINE.number_to_words(number)}{multiplier}"
words = INFLECT_ENGINE.number_to_words(number)
if raw.startswith("."):
words = words.replace("zero point", "point", 1)
return f"{words}{multiplier}"

return self.NUMBER_PATTERN.sub(handle, text)

Expand Down
5 changes: 4 additions & 1 deletion api/tests/test_normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@
("Version 2.0.1 released", "Version two point zero point one released"),
("Python 3.10.12", "Python three point ten point twelve"),
("100% sure", "one hundred percent sure"),
("Only .5 left", "Only zero point five left"),
("Only .5 left", "Only point five left"),
# no zero is read when the text has none (issue #601)
("A Colt .45 revolver", "A Colt point four five revolver"),
("Down to -.5 now", "Down to minus point five now"),
("Saved as file_1", "Saved as file one"),
# digits glued to letters are left for the phonemizer
("MP3 player", "MP3 player"),
Expand Down