Skip to content

Commit

Permalink
Fix: 読み変更時の AivisSpeech Engine での挙動差を修正
Browse files Browse the repository at this point in the history
この変更でマルチエンジンで VOICEVOX ENGINE を呼び出した際の挙動が変わりそうだが、とりあえず読み変更自体はできるはずなので OK とする
この変更により「変更後の読みにひらがな・カタカナしか入らない」場合は引き続き is_kana=true で /accent_phrase API が呼ばれるが、句読点や「!」「?」など記号が含まれる場合は常に is_kana=false で通常の g2p 処理が行われた結果が反映されるようになり、アクセント句の末尾に記号が含まれる場合の挙動が安定するはず
is_kana=false 時に #5 の通り拗音が分割される問題もあるが、これは g2p 処理側の問題
  • Loading branch information
tsukumijima committed Dec 3, 2024
1 parent 71cb331 commit 644a183
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/Talk/AccentPhrase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ const pronunciation = computed(() => {
});
const handleChangePronounce = (newPronunciation: string) => {
let popUntilPause = false;
const popUntilPause = false;
// AivisSpeech Engine では句読点や記号もモーラ扱いとしているため、下記処理は行わない
/*
newPronunciation = newPronunciation
.replace(/,/g, "、")
// 連続する読点をまとめる
Expand All @@ -281,6 +283,7 @@ const handleChangePronounce = (newPronunciation: string) => {
popUntilPause = true;
}
}
*/
void store.actions.COMMAND_CHANGE_SINGLE_ACCENT_PHRASE({
audioKey: props.audioKey,
newPronunciation,
Expand Down
3 changes: 2 additions & 1 deletion src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,8 @@ export const audioCommandStore = transformCommandStore(

let newAccentPhrasesSegment: AccentPhrase[] | undefined = undefined;

const kanaRegex = createKanaRegex(true);
// AivisSpeech Engine では句読点や記号もモーラ扱いとしているため、includeSeparation を false に設定している
const kanaRegex = createKanaRegex(false);
if (kanaRegex.test(newPronunciation)) {
// ひらがなが混ざっている場合はカタカナに変換
const katakana = convertHiraToKana(newPronunciation);
Expand Down

0 comments on commit 644a183

Please sign in to comment.