Skip to content

refactor: move English TN to src/tts/en/ for consistency#8

Merged
Alex-Wengg merged 3 commits intomainfrom
feat/multi-language-tn-parity
Mar 12, 2026
Merged

refactor: move English TN to src/tts/en/ for consistency#8
Alex-Wengg merged 3 commits intomainfrom
feat/multi-language-tn-parity

Conversation

@Alex-Wengg
Copy link
Member

@Alex-Wengg Alex-Wengg commented Mar 12, 2026

All languages now have their own subdirectories:

  • src/tts/en/ - English TN taggers
  • src/tts/fr/ - French TN taggers
  • src/tts/es/ - Spanish TN taggers
  • src/tts/de/ - German TN taggers
  • src/tts/zh/ - Chinese TN taggers
  • src/tts/hi/ - Hindi TN taggers
  • src/tts/ja/ - Japanese TN taggers

Changes:

  • Moved all English TN files to src/tts/en/
  • Created src/tts/en/mod.rs with number_to_words() and helper functions
  • Updated src/tts/mod.rs to only declare language modules
  • Updated src/lib.rs to use tts::en:: for English TN
  • Updated tests/extensive_tests.rs import

All 741 tests passing.


Open with Devin

All languages now have their own subdirectories:
- src/tts/en/ - English TN taggers
- src/tts/fr/ - French TN taggers
- src/tts/es/ - Spanish TN taggers
- src/tts/de/ - German TN taggers
- src/tts/zh/ - Chinese TN taggers
- src/tts/hi/ - Hindi TN taggers
- src/tts/ja/ - Japanese TN taggers

Changes:
- Moved all English TN files to src/tts/en/
- Created src/tts/en/mod.rs with number_to_words() and helper functions
- Updated src/tts/mod.rs to only declare language modules
- Updated src/lib.rs to use tts::en:: for English TN
- Updated tests/extensive_tests.rs import

All 741 tests passing.
Fixes 3 issues identified in review:

1. German decimal/cardinal parser conflict
   - German decimal parser now only accepts comma (,) as decimal separator
   - Period (.) is exclusively a thousands separator in German
   - Prevents "2.025" from being incorrectly parsed as decimal
   - "2.025" → "zweitausendfuenfundzwanzig" (cardinal, correct)
   - "2,025" → "zwei komma null zwei fuenf" (decimal, correct)

2. Operator precedence bug in money parsers
   - Fixed confusing logic in DE, FR, ES money.rs parse_amount()
   - Old: `amount_str.contains(sep) && sep \!= '.' || amount_str.contains('.')`
   - New: `amount_str.contains(',') || amount_str.contains('.')`
   - Removed redundant actual_sep variable
   - Clearer and more maintainable code

3. English language handling
   - Already fixed in previous commit (refactor: move English TN to src/tts/en/)
   - tn_normalize_for_lang() explicitly handles "en" language code

All 740 tests passing.
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Stale doc comment claims period-separated decimals are supported after removing that functionality

The module-level doc comment at src/tts/de/decimal.rs:6 still says "3.14" → "drei komma eins vier", but this PR changed the parse function (lines 33-37) to reject any input that does not contain a comma. Period-only decimals like "3.14" now return None. The corresponding test test_period_decimal was correctly removed, but the doc comment was not updated to match.

(Refers to line 6)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Remove misleading example claiming "3.14" is supported as decimal input.
German decimal parser only accepts comma (,) as decimal separator.
Period (.) is exclusively for thousands separation in cardinal numbers.

Updated doc to clarify:
- Comma is the decimal separator
- Period is the thousands separator (cardinal only)
- Added negative number example instead
@Alex-Wengg Alex-Wengg merged commit 19339c4 into main Mar 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant