Scribe โœ๏ธ

A context-aware kanji/kana checker for Japanese official documents โ€” judging the notation that dictionaries and regular expressions cannot, and citing the normative clause as evidence.

The problem

Japan's official-writing guidelines ("Considerations for Creating Official Documents," Council for Cultural Affairs, 7 Jan 2022) require the same word to be written differently by its syntactic role: a formal noun ใ“ใจ in kana, but the substantive ไบ‹ ("the gravity of the matter") in kanji. Uniform dictionary replacement (textlint + prh) collapses each word to one spelling, so wherever both usages appear it is structurally forced to get half of them wrong. Scribe judges the context and attaches the clause it relied on.

Worked example โ€” Scribe vs. uniform replacement (prh)

โœ“ Scribe (context-aware)

็”ณ่ซ‹ใฎๅ†…ๅฎนใ‚’็ขบ่ชใ™ใ‚‹ใ“ใจใŒๅฟ…่ฆใงใ‚ใ‚‹ใ€‚ไบ‹ๆ•…ใฎใจใใ€้€Ÿใ‚„ใ‹ใซๅพก้€ฃ็ตกใใ ใ•ใ„ใ€‚ ้‡ใ„็‰ฉใ‚’้‹ๆฌใ™ใ‚‹ๅ ดๅˆใฏใ€3ๅใง่กŒใ†ใ“ใจใ€‚ไฝใ‚€ๆ‰€ใ‚’็ขบไฟใ—ใฆใŠใใ€‚

Keeps ็‰ฉ / ๆ‰€ in kanji (substantive), fixes ไบ‹โ†’ใ“ใจ, ไธ‹ใ•ใ„โ†’ใใ ใ•ใ„, ่กŒใชใ†โ†’่กŒใ†, ๏ผŒโ†’ใ€, ๏ผ“โ†’3.

โœ— prh (uniform replacement)

็”ณ่ซ‹ใฎๅ†…ๅฎนใ‚’็ขบ่ชใ™ใ‚‹ใ“ใจใŒๅฟ…่ฆใงใ‚ใ‚‹ใ€‚ไบ‹ๆ•…ใฎใจใ๏ผŒ้€Ÿใ‚„ใ‹ใซๅพก้€ฃ็ตกใใ ใ•ใ„ใ€‚ ้‡ใ„ใ‚‚ใฎใ‚’้‹ๆฌใ™ใ‚‹ๅ ดๅˆใฏ๏ผŒ๏ผ“ๅใง่กŒใชใ†ใ“ใจใ€‚ไฝใ‚€ใจใ“ใ‚ใ‚’็ขบไฟใ—ใฆใŠใใ€‚

โš  Over-converts substantive nouns: ็‰ฉโ†’ใ‚‚ใฎ, ๆ‰€โ†’ใจใ“ใ‚ are wrong (should stay kanji).

Why it matters โ€” the evidence

Hard-set accuracy by usage
Figure 1. On the hard set, uniform replacement reaches 100% on the kana-correct side but ~0% on the kanji-correct side (substantive nouns, main verbs). Collapsing a word to one spelling must fail one side.
Findings vs over-flag rate
Figure 2. prh over-flags ~43% (it "corrects" already-correct text); Scribe stays in single digits at a comparable number of findings.
Accuracy by usage type
Figure 3. By usage type: uniform replacement scores 0% on substantive nouns and main verbs โ€” exactly the kanji-correct usages.
SystemOverallHardPrecisionRecallOver-flag
(A) prh uniform replacement0.560.510.560.560.43
(B) Jลyล-kanji rule check0.500.500.000.000.00
(D) Scribe (heuristic layer)0.940.940.940.940.06

Diagnostic on a synthetic seed corpus (CC0); demonstrates the structural claim, not absolute accuracy on natural text. The trained neural model reaches 0.82 span accuracy on a held-out (by-document) test set.

Run the interactive app locally

Hosted Gradio Spaces now require a PRO subscription, so this Space is a static showcase. The full interactive demo runs locally:

git clone https://github.com/NagaYu/scribe-koyobun
cd scribe-koyobun
pip install -e . && pip install gradio
python app.py            # or: scribe check doc.txt --profile jichitai

Apache-2.0 ยท Built with a rule layer + a 0.1โ€“0.2B token-classification model ยท Normative documents' rights belong to their issuers (clauses referenced, not reproduced).