refactor: move English TN to src/tts/en/ for consistency#8
Merged
Alex-Wengg merged 3 commits intomainfrom Mar 12, 2026
Merged
Conversation
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.
There was a problem hiding this comment.
🟡 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)
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All languages now have their own subdirectories:
Changes:
All 741 tests passing.