-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add Japanese g2p katakana accent support #15170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Japanese g2p katakana accent support #15170
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds Japanese G2P (Grapheme-to-Phoneme) support with pitch accent markers for the NeMo TTS collection. The implementation converts multi-script Japanese input (Kanji/Katakana/Hiragana) to Katakana with pitch accent annotations (0=low, 1=high) to enable proper pronunciation and intonation for Japanese TTS models.
Key changes:
- Introduces
JapaneseKanaAccentclass using pyopenjtalk for Japanese morphological analysis and pitch accent generation - Extends ja-JP grapheme and punctuation character sets to support Katakana output
- Adds unit tests validating pitch accent disambiguation for Japanese homonyms (e.g., 箸/chopsticks vs 橋/bridge)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| nemo/collections/tts/g2p/models/ja_jp_ipa.py | Implements the JapaneseKanaAccent class with pitch accent rules (Heiban, Atamadaka, Nakadaka, Odaka), chain processing for compound words, and ASCII preservation |
| nemo/collections/common/tokenizers/text_to_speech/ipa_lexicon.py | Adds comprehensive Katakana grapheme character set and Japanese full-width punctuation marks for ja-JP locale |
| tests/collections/common/tokenizers/text_to_speech/test_tts_tokenizers.py | Adds test case verifying homonym disambiguation through pitch accent patterns |
| requirements/requirements_tts.txt | Adds pyopenjtalk dependency for Japanese text processing |
| examples/tts/conf/magpietts/magpietts_multilingual_v2_lhotse.yaml | Adds configuration for Japanese phoneme tokenizer with JapaneseKanaAccent G2P in Magpie TTS multilingual setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/collections/common/tokenizers/text_to_speech/test_tts_tokenizers.py
Outdated
Show resolved
Hide resolved
nemo/collections/common/tokenizers/text_to_speech/ipa_lexicon.py
Outdated
Show resolved
Hide resolved
nemo/collections/common/tokenizers/text_to_speech/ipa_lexicon.py
Outdated
Show resolved
Hide resolved
nemo/collections/common/tokenizers/text_to_speech/ipa_lexicon.py
Outdated
Show resolved
Hide resolved
35d675c to
7ce8a40
Compare
examples/tts/conf/magpietts/magpietts_multilingual_v2_lhotse.yaml
Outdated
Show resolved
Hide resolved
7ce8a40 to
f269f84
Compare
0b1e54b to
2328588
Compare
Signed-off-by: XuesongYang <[email protected]>
Signed-off-by: Jason <[email protected]> Signed-off-by: Jason <[email protected]>
Signed-off-by: blisc <[email protected]>
Signed-off-by: Jason <[email protected]>
Important
The
Update branchbutton must only be pressed in very rare occassions.An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.
What does this PR do ?
This PR adds a new Japanese G2P module (JapaneseKanaAccent) that supports multi script Japanese input (Kanji/Katakana/Hiragana) with pitch accent markers (0-low / 1-high),
Collection: TTS, common
Changelog
nemo/collections/tts/g2p/models/ja_jp_ipa.py:
Class JapaneseKanaAccent which uses the pyopenjtalk library and a rule base system to generate Katakana with pitch accent markers (e.g., こんにちは -> 0コ1ン 1ニ1チ1ワ).
Added logic to preserve pure English/ASCII words while converting other scripts to Katakana.
nemo/collections/common/tokenizers/text_to_speech/ipa_lexicon.py:
Updated ja-JP GRAPHEME_CHARACTER_SETS and Japanese punctuation.
tests/collections/common/tokenizers/text_to_speech/test_tts_tokenizers.py:
Added unit tests verifying homonym disambiguation based on accent.
Example: 箸 (Chopsticks) 1ハ0シ (High-Low) vs 橋 (Bridge) 0ハ1シ (Low-High).
requirements/requirements_tts.txt
Usage
GitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information