data(kana): Mozc's romaji table

hira.map and kata.map knew 152 keys of the 320 every Japanese IME
accepts: no nn, no small kana by x or l (xtu, xya, la, ...), no sya, tya,
zya, jya, dya, cya, tsa, thi, dhi, twu, kye, ye, fya, wha, and zi gave ぢ.
Both are now Mozc's default table in full, kata.map in Katakana, so that
they agree (kata.map alone had di → ディ and a lone v).  With Mozc, wi
and we are うぃ and うぇ (wyi and wye the old kana), the v row is ゔ, nn
is ん, and [ ] ~ and the z-prefixed symbols type 「 」 〜 ・ … ← ↓ ↑ →.

n' is a row now, not a case in transjp.  A row whose value is っ keeps
its consonant pending only when it is a doubled consonant or tch: xtu
and ltu are っ itself, so a lone っ can finally be typed.
This commit is contained in:
2026-08-17 00:58:36 +09:00
parent b77400fa86
commit 221117f93d
6 changed files with 536 additions and 181 deletions

View File

@@ -285,10 +285,15 @@ backjp(Im *p)
spopr(&p->pre);
}
/*
* kk and the like are a sokuon: っ, and the consonant stays pending, as
* ch does after tch. xtu and ltu are っ itself.
*/
static int
issmalltsu(Str *s)
issokuon(Str *key, Str *mapped)
{
return s->n == 1 && (s->r[0] == L'' || s->r[0] == L'');
return mapped->n == 1 && (mapped->r[0] == L'' || mapped->r[0] == L'') &&
(key->r[0] == key->r[1] || (key->r[0] == 't' && key->r[1] == 'c'));
}
static void
@@ -312,17 +317,11 @@ transjp(Im *p, Rune c)
e.eat = 1;
e.next = p->pre;
e.raw = p->raw;
if(c == '\'' && e.raw.n == 1 && e.raw.r[0] == 'n'){
if(mapget(p->l->map, &e.raw, &mapped))
sappend(&e.next, &mapped);
sclear(&e.raw);
return e;
}
key = e.raw;
sputr(&key, c);
if(mapmatch(p->l->map, &key, &mapped) != TrieMiss){
e.raw = key;
if(issmalltsu(&mapped)){
if(issokuon(&key, &mapped)){
sappend(&e.next, &mapped);
keeptail(&e.raw);
}