Add Japanese g2p katakana accent support#15170
Merged
XuesongYang merged 8 commits intoNVIDIA-NeMo:mainfrom Dec 19, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
XuesongYang
reviewed
Dec 10, 2025
nemo/collections/common/tokenizers/text_to_speech/ipa_lexicon.py
Outdated
Show resolved
Hide resolved
XuesongYang
reviewed
Dec 10, 2025
XuesongYang
reviewed
Dec 10, 2025
35d675c to
7ce8a40
Compare
XuesongYang
reviewed
Dec 10, 2025
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: quapham <quapham@users.noreply.github.com>
blisc
reviewed
Dec 16, 2025
Signed-off-by: Xuesong Yang <16880-xueyang@users.noreply.gitlab-master.nvidia.com> Signed-off-by: Xuesong Yang <1646669+XuesongYang@users.noreply.github.com>
Signed-off-by: XuesongYang <XuesongYang@users.noreply.github.com>
XuesongYang
previously approved these changes
Dec 17, 2025
Signed-off-by: Jason <jasoli@nvidia.com> Signed-off-by: Jason <jasoli@nvidia.com>
Signed-off-by: blisc <blisc@users.noreply.github.com>
Signed-off-by: Jason <jasoli@nvidia.com>
blisc
approved these changes
Dec 17, 2025
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.
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