Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

KokoroAne zh: erhua merge folds any 'er' syllable (二/而/耳/尔), not only 儿 — 十二, 二千, 女儿 lose a syllable

Chiusa
#983 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #986 di @guoyingtao — integrata

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
40/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
swift

Direzione di ricerca

Start at Sources/FluidAudio/TTS/KokoroAne/G2P/Mandarin/MandarinErhua.swift, around line 43 where the merge condition compares only the pinyin base to "er"; then read MandarinPinyinNormalizer.Syllable to see what information survives normalisation. The fix is to carry the source character (儿/兒) or a flag on the syllable and to port misaki's not_erhua / must_erhua word lists. Done means the table in the issue behaves as expected: 这儿 and 小孩儿 still merge, while 十二, 女儿, 然而 and 木耳 keep a full èr, verified by a new regression test. Note an open pull request (#986) already targets this.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

MandarinErhua.merge folds any syllable whose pinyin base is er into the previous syllable, not only the character 儿. So 二 / 而 / 耳 / 尔 after another syllable are silently dropped and the previous syllable gets an r-coloured final. Numbers are hit hardest: 十二, 二十 (after any syllable), 二千 all lose their 二.

Repro

FluidAudio v0.17.5 (0b1f462); MandarinErhua.swift is unchanged on main. Phonemes from KokoroAneManager(variant: .mandarin).phonemes(for:):

Input Phonemes Heard as Expected
相隔二千里 ㄒ阳1ㄍㄜㄦ2ㄑ言1ㄌㄧ3 xiāng gér qiān lǐ xiāng gé èr qiān lǐ
别了二十年 ㄅㄝ2ㄌㄜㄦ5ㄕ十2ㄋ言2 bié ler shí nián bié le èr shí nián
第十二回 ㄉㄧ4ㄕ十ㄦ2ㄏ为2 dì shír huí dì shí èr huí
偶尔 ㄡㄦ3 ǒur ǒu ěr
然而他 ㄖㄢㄦ2ㄊㄚ1 ránr tā rán ér tā
木耳 ㄇㄨㄦ4 mùr mù ěr
女儿 ㄋㄩㄦ3 nǚr nǚ ér
这儿 ㄓㄜㄦ4 zhèr zhèr ✓
小孩儿 ㄒ要3ㄏㄞㄦ2 xiǎo háir xiǎo háir ✓

Found while auditioning public-domain books (鲁迅《故乡》: 「相隔二千余里,别了二十余年」). In long-form reading this comes up constantly: chapter numbers (第十二回), years and counts, and very common words like 女儿, 然而, 偶尔.

Cause

MandarinErhua.swift#L43 matches on the pinyin only:

if cur.base == "er" && shouldMergeInto(prev: prev) {

The doc comment says cases misaki blocks are "already filtered out by the dict.phrases / single-char lookup happening upstream", but the lookup has no way to tell 儿 from 二/而/耳/尔 once everything is pinyin. The sandhi buffer also spans word boundaries (相隔 + 二千), so the index-0 guard doesn't help.

misaki's _merge_erhua only merges when the character is 儿, it is the last character of the word, and the word is not in not_erhua (女儿, 男儿, 婴儿, 孤儿, 幼儿, 花儿, 鸟儿, …), with a must_erhua override list.

Suggested fix

  • Carry the source character (or a "came from 儿/兒" flag) on MandarinPinyinNormalizer.Syllable, and only merge when it is 儿 or 兒.
  • Port misaki's not_erhua / must_erhua word lists so 女儿, 婴儿, 孤儿 and similar words keep a full ér.
  • A regression test with the table above would cover both the over-merge and the existing 这儿 / 小孩儿 behaviour.
Lingua principale
Swift
Stelle
3k
Fork
451
Merge medio
17h 57m
PR unite (30g)
54

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FluidInference/FluidAudio

Tutte le issue di FluidInference/FluidAudio

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.