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
4 changes: 4 additions & 0 deletions tests/test_normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
5 changes: 5 additions & 0 deletions whisper/normalizers/english.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down