Skip to content

記号を含む英字の半角大文字候補を修正 / Fix uppercase candidates with symbols - #1227

Merged
KazumaProject merged 2 commits into
devfrom
fix/symbol-prefixed-uppercase-candidates
Oct 31, 2026
Merged

KazumaProject merged 2 commits into
devfrom
fix/symbol-prefixed-uppercase-candidates

Conversation

@KazumaProject

Copy link
Copy Markdown
Owner

日本語

問題と原因

:a を入力すると :a / :A は候補に出る一方、半角大文字の :A が出ませんでした。英字のみの入力は EnglishEngine でケース候補を生成しますが、記号を含む入力はその分岐を通らず、代替のリテラル候補生成も「ASCII 英字と数字の混在」に限定されていました。全角候補は記号を含む半角 ASCII 全体を対象にしており、この条件差で半角大文字だけが欠落していました。

変更

  • 共有のリテラル候補生成を、英字を含む印字可能な半角 ASCII(記号・空白を含む)に対応させます。例: :a → :A、@ab → @AB、a-b → A-B。
  • 7 つの変換エントリーポイントで同じ処理を使います。候補のケース・スコア・型・消費文字数の生成方式は維持します。
  • 直接関係する既存テストを拡張し、先頭・途中・末尾の記号、空白、従来の英数字混在入力、数字・記号のみや非 ASCII 入力を確認します。

検証

  • 修正前: :a の候補が [:a, :a, :A, :a, :a, :a, :] となり、:A がないことを回帰テストで再現しました。
  • 修正後: Lite Standard Debug / Robolectric API 35 で以下の関連 32 テストが成功しました。
    • KanaKanjiConversionSessionParityTest: 18 テスト。ケース候補のテストは 16 入力 × 32 設定(両バックエンド、全 4 問い合わせモード、文節分割 ON/OFF、英語予測 ON/OFF)を確認。
    • KanaKanjiEngineEnglishKanaNumberTest: 11 テスト。
    • EnglishCandidateCaseResolverTest: 3 テスト。
  • 使用コマンド: ANDROID_HOME=/Users/kazuma/Library/Android/sdk ./gradlew :app:testLiteStandardDebugUnitTest --tests 'com.kazumaproject.markdownhelperkeyboard.converter.session.KanaKanjiConversionSessionParityTest' --tests 'com.kazumaproject.markdownhelperkeyboard.converter.engine.KanaKanjiEngineEnglishKanaNumberTest' --tests 'com.kazumaproject.markdownhelperkeyboard.converter.engine.EnglishCandidateCaseResolverTest' --max-workers=2
  • セッションテストは既存の TestEngineFactory と同梱辞書を使用し、EnglishEngine とユーザー辞書リポジトリはモックです。実機 UI、Full/F-Droid ビルドは未確認です。
  • git diff --check 成功。変更は実装と関連テストの 2 ファイルのみで、ログや作業用成果物は含めていません。

English

Problem and cause

Typing :a offered :a / :A, but omitted the half-width uppercase candidate :A. Letter-only input gets case variants from EnglishEngine. Input containing symbols bypasses that branch, while the literal fallback accepted only mixed ASCII letters and digits. Full-width variants accepted all printable half-width ASCII, causing the mismatch.

Changes

  • Allow the shared literal fallback to handle printable half-width ASCII containing a letter, including symbols and spaces: :a → :A, @ab → @AB, and a-b → A-B.
  • Use the same fallback in all seven conversion entry points, retaining its existing case transformations, scores, types, and consumed input lengths.
  • Extend the directly related tests for leading/internal/trailing symbols, spaces, existing alphanumeric inputs, and excluded inputs containing no ASCII letters or containing non-ASCII characters.

Validation

  • Before the fix: the regression test reproduced :a yielding [:a, :a, :A, :a, :a, :a, :], with no :A.
  • After the fix: all 32 related tests passed on Lite Standard Debug / Robolectric API 35.
    • KanaKanjiConversionSessionParityTest: 18 tests. The case-variant test covers 16 inputs × 32 request configurations: both backends, all four query modes, bunsetsu separation on/off, and English prediction on/off.
    • KanaKanjiEngineEnglishKanaNumberTest: 11 tests.
    • EnglishCandidateCaseResolverTest: 3 tests.
  • The Gradle command above runs the three test classes.
  • Session tests use the existing TestEngineFactory and bundled dictionaries, with EnglishEngine and the user dictionary repository mocked. Device UI and Full/F-Droid builds were not verified.
  • git diff --check passed. Only the implementation and its related test file are changed; no logs or temporary artifacts are included.

@KazumaProject
KazumaProject merged commit 5ab22b9 into dev Oct 31, 2026
1 check passed
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