Skip to content

chore(docs): check the conversion results written in the doc tables against tugime-cli - #162

Merged
miyaoka merged 3 commits into
mainfrom
docs/check-doc-tables
Nov 15, 2026
Merged

miyaoka merged 3 commits into
mainfrom
docs/check-doc-tables

Conversation

@miyaoka

@miyaoka miyaoka commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

目的

文書の表に載せた変換の結果が古くなったら、気づける状態にする。README・docs/how-it-works.md・docs/limitations.md の表は手書きで、変換が変わっても黙って古くなる。#160 では README の表の CPUnohukagatakai. の行が、気づかないまま古くなっていた。CI は辞書と統計の変換だけを測り、表示の変換のモデルを使わないので、表の tugime の列を確かめられない。

出所: 対話での依頼(#160 のスコープ外)。

文書の表が、今の変換と合っているかを確かめる。README の表のうち tugime の列を tugime-cli の出力と突き合わせ、表の 1 か所を書き換えて走らせると、その行だけが不一致として出て、全 17 件中 1 件が合わないで終了コード 1 になる。人が打ったライブ変換の列と期待の列は突き合わせず、決まっていない見出しの列があると止まる

変更内容

  • scripts/check-doc-examples.ts を足した。3 つの文書の表のうち、1 列目が打鍵列の行を取り出し、見出しごとに決めた方法で今の tugime-cli の出力と突き合わせる。合わない行を並べて終了コード 1 で終わる
    • tugime・表示: 入力メソッドと同じ方式(tugime-cli の既定の方式)の表示。打鍵列ごとに別の実行にする
    • 英語を見分けて辞書と統計で変換: --method lattice の表示
    • 続けて打つと: 「打鍵 で 表示」の形。打鍵列に続けて打ったときの表示
    • 打った読み: 綴りの表による読み(--whole のひらがな)
    • 日本語モードのライブ変換・期待: 突き合わせない
    • どれにも当たらない見出しの列があると、その列を示して止まる
  • scripts/lib/svg.ts に、モデルとシステム辞書を用意して tugime-cli を組み立てる prepareCli を置いた。図のスクリプトの prepare もこれを使うので、図を作るときもシステム辞書を用意する
  • docs/development.md に「文書の表を確かめる」の節を足した

設計判断

  • 表を生成せず、突き合わせるだけにした。表には、スクリプトで作れない値(人が打って確かめた他の入力方式の結果、期待する表記)も並んでいるため
  • 表示は打鍵列ごとに別の実行にした。表示の変換は前の打鍵列の生成を覚えて使うことがあり、まとめて渡すと、ある行の結果が表のほかの行とその順に左右されうるため。入力メソッドも未確定の文字列ごとに覚えを捨てる

合意事項

  • 手書きの表が黙って古くなる課題を、できる範囲で直す

未合意の判断

種別 決めたこと 内容
追加 図のスクリプトも、組み立ての前にシステム辞書を用意するようにした 突き合わせと図で用意の手順を 1 つにまとめたため。辞書は元のソースが新しくないときは組み立て直さないので、手元の辞書が新しければ何も変わらない

スコープ外

作業 重要度 行き先 根拠
このスクリプトを CI で走らせる 低 独立 CI は表示の変換のモデルを取得していない(code_validation.yml は --method lattice だけを測る)。モデルの取得を CI に足すかは、CI の時間との兼ね合いで別に決める
tugime-cli を動かす部品(cli・run・step・readLive・prepareCli)を scripts/lib/svg.ts から別のファイルに分ける 低 独立 表の突き合わせが、図のフォントの依存(opentype.js)まで引き込んでいる。#161 と #163 も svg.ts を書き換えているので、3 つのマージ後に行う
表の外の文章にある変換の例も突き合わせる 低 独立 docs/limitations.md の本文の例(home no menu wo kaeru、--before を付けた例など)と README の使い方の表の Space の行は、決まった形の表ではないので今回は対象にしない
tugime-cli --live に複数の打鍵列を渡したとき、打鍵列の間で生成の覚えを捨てる 低 独立 図のスクリプトは複数の打鍵列をまとめて渡している。tugime-eval と入力メソッドは打鍵列ごとに覚えを捨てる
図のスクリプトの組み立てを scripts/lib/swift-build.ts の指定に揃える 低 独立 prepareCli は swift build -c release で、swiftBuild と指定が違う。本 PR の前からある

完了条件

  • 今の文書で bun scripts/check-doc-examples.ts が「全 17 件中 0 件が合わない」を出し、終了コード 0 で終わる
  • 表の tugime の列を 1 か所書き換えると、その行だけを不一致として出し、終了コード 1 で終わる
  • 表に決まっていない見出しの列があると、その列を示して止まる

検証

  • 97c7a43 で走らせ、「全 17 件中 0 件が合わない」を出して終了コード 0 で終わった。その後のコミット(2fb7b76)は docs/development.md に 1 行を足しただけで、スクリプトは変わっていない
  • README の testgaotitanode の行の tugime の列を「testが落ちた」に書き換えて走らせ、その行だけが「不一致 … 表: testが落ちた 今: testが落ちたので」と出て、「全 17 件中 1 件が合わない」で終了コード 1 になった。書き換えは戻した
  • docs/limitations.md の表の見出し「期待」を「新しい方式」に書き換えて走らせ、「docs/limitations.md:13 の列「新しい方式」を突き合わせるか決まっていない」で止まった。書き換えは戻した

確認事項

なし

🤖 Generated with Claude Code

…gainst tugime-cli

intent(docs): the tables in README, how-it-works and limitations are written by hand and silently went stale when the conversion changed
decision(docs): check rather than generate; the tables also hold values a script cannot produce (live conversion typed by a person, expected spellings, readings), so only columns whose header names a tugime-cli method are compared
constraint(ci): CI measures only the lattice method without the model, so the check runs by hand with the figure scripts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@miyaoka miyaoka self-assigned this Nov 15, 2026
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 74f732fc-dc37-408a-aa89-011a6be1a9f2
Commits

Reviewing files that changed from the base of the PR and between 4b814c2 and 2fb7b76.

Files selected for processing: 3

  • docs/development.md
  • scripts/check-doc-examples.ts
  • scripts/lib/svg.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

miyaoka and others added 2 commits November 15, 2026 16:46
… each keystroke sequence on its own

decision(docs): a column header that is neither checked nor listed as unchecked stops the check, so a new column cannot silently go unchecked
decision(docs): run --live once per keystroke sequence like the input method, since the display generator may reuse what it remembered from the previous sequence
decision(figures): prepare the system dictionary before building tugime-cli, in one prepareCli shared by the figure scripts and the doc check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e doc tables

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tugime-bot

tugime-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown

変換の精度(lattice)

集まり before after 問題数
ajimee 49.0% 49.0% 200
mozc-oss 74.5% 74.5% 310
mozc-regression 59.8% 59.8% 82

before だけ正解 0 件 / after だけ正解 0 件

片方だけが正解した問題
問題 正解した側 読み 入力の前の文脈 before after 判定

@miyaoka
miyaoka marked this pull request as ready for review November 15, 2026 07:51
@miyaoka
miyaoka merged commit 32edf14 into main Nov 15, 2026
9 checks passed
@miyaoka
miyaoka deleted the docs/check-doc-tables branch November 15, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant