Merge fdd1b6f1a98913c489076c836c25640f4fa29dad into c0d2f624c09dc18e709e37c2ad90c039a4eb72a2

This commit is contained in:
chihangc 2025-06-27 02:28:02 +00:00 committed by GitHub
commit 8137fad5a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,6 +208,10 @@ class EnglishNumberNormalizer:
prefix = current[0] if has_prefix else prefix prefix = current[0] if has_prefix else prefix
if f.denominator == 1: if f.denominator == 1:
value = f.numerator # store integers as int 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: else:
value = current_without_prefix value = current_without_prefix
elif current not in self.words: elif current not in self.words: