mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 06:26:03 +00:00
fix: add support for leading zero in transcription when spoken by user
- Ensures that leading zero is included in the transcription when explicitly voiced.
This commit is contained in:
parent
173ff7dd1d
commit
fdd1b6f1a9
@ -208,6 +208,10 @@ class EnglishNumberNormalizer:
|
||||
prefix = current[0] if has_prefix else prefix
|
||||
if f.denominator == 1:
|
||||
value = f.numerator # store integers as int
|
||||
# count the number of leading zeros and add back all leading zeros if they were removed
|
||||
leading_zeros = len(current_without_prefix) - len(current_without_prefix.lstrip('0'))
|
||||
if leading_zeros > 0 and value != 0:
|
||||
value = "0" * leading_zeros + str(value)
|
||||
else:
|
||||
value = current_without_prefix
|
||||
elif current not in self.words:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user