Conversation
…pinyin model The sherpa engine hardcoded BPE tokenization (text2token + bpe.model), which only covers Latin-script phrases on the English GigaSpeech model. The wenetspeech KWS model is pinyin-modeled (声母/韵母 phonemes) and ships no bpe.model, so pointing model_dir at it crashed at init. Detect the model family by the presence of bpe.model: - BPE models keep the existing text2token path (Latin phrases). - Pinyin models romanize each phrase with pypinyin: toned syllables (Style.TONE) are split after their initial (nǐ → n ǐ, wén → w én, huì → h uì), with a ü→u fallback for finals the vocab spells without the umlaut (üé → ué). Phrases a model cannot represent (e.g. Latin on the pinyin model) are skipped with a warning instead of failing the listener, so mixed-language profile routing degrades gracefully. Verified end-to-end against the real wenetspeech model: all 8 official test wavs recognize (文森特卡索/周望军/朱丽楠/蒋友伯/女儿/法国/见面会/落实) and a TTS-rendered 你好妮妮 fires with correct profile routing. Docs: new 'Chinese wake phrases (pinyin model)' section.
Contributor
PR: feat(wake-word): support Chinese wake phrases via sherpa wenetspeech pinyin model
|
This was referenced Sep 15, 2026
12 tasks
This branch has not been deployed
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.
Summary
The sherpa wake-word engine hardcoded BPE tokenization (
text2token+bpe.model), which only covers Latin-script phrases on the default English GigaSpeech model. The wenetspeech KWS model — sherpa-onnx's Chinese counterpart — is pinyin-modeled (声母/韵母 phonemes) and ships nobpe.model, so pointingwake_word.sherpa.model_dirat it crashed at listener init.Changes
_SherpaKwsEnginenow checks forbpe.model— BPE models keep the existingtext2tokenpath; pinyin models (nobpe.model) romanize phrases to phonemes._phrase_to_pinyin_phonemes): splits pypinyin's toned syllables (Style.TONE) after the initial —nǐ → n ǐ,wén → w én,huì → h uì— which also fixes pypinyin's mis-timed bare finals (úen,ueì), with aü→ufallback for finals the vocab spells without umlaut (üé → ué).Verification
tmp_path+pytest.importorskip).文森特卡索/周望军/朱丽楠/蒋友伯/女儿/法国/见面会/落实) with correct phoneme output matching the officialkeywords.txtbyte-for-byte.你好妮妮fires the listener with correct profile routing (last_match == ('你好妮妮', 'nina')).Docs
New "Chinese wake phrases (pinyin model)" section under the sherpa engine docs with model download link and config example.
Notes
pypinyinwas already awake.sherpalazy-dep (sherpa_onnx'stext2tokenimports it unconditionally, so no new dependency.EOF
)