Skip to content

NGワードの完全一致・部分一致対応 / Support exact and partial NG word matching - #982

Merged
KazumaProject merged 2 commits into
devfrom
feature/ng-word-match-mode
Sep 8, 2026
Merged

KazumaProject merged 2 commits into
devfrom
feature/ng-word-match-mode

Conversation

@KazumaProject

@KazumaProject KazumaProject commented Sep 6, 2026

Copy link
Copy Markdown
Owner

日本語

概要

NGワードごとに部分一致・完全一致を選択できます。部分一致は候補文字列に登録単語が含まれる場合、完全一致は入力の読みと候補文字列が登録した読み・単語の両方に一致する場合に除外します。既存の部分一致の対象範囲と、記号をリテラルとして比較する動作を維持します。

実装

  • 共通matcherを使用し、管理画面の追加・編集と候補長押し登録に照合方式の選択を追加。一覧にも方式を表示します。
  • NGワード一覧の更新時に、入力中の候補へ設定を再適用します。
  • 最新devを取り込み、競合を解消しました。devの45→46移行(key_definitions.textInputBehavior)を維持し、NGワードのmatchModeは46→47で追加します。DBバージョンは47、既存レコードはPARTIALです。
  • JSON処理をNgWordBackupに集約し、画面と互換性テストで同じ処理を使用します。従来のキーを維持し、方式未指定・null・未知の文字列はPARTIALへフォールバックします。
  • Gsonが反射で読み取るバックアップDTOに明示的なR8 keepルールを追加し、難読化による取り込み失敗を防ぎます。

検証

  • :app:testFullStandardDebugUnitTest: 最終実行で1,464件中1,460件成功・4件スキップ(失敗0)。NGワード関連12件には45→47、46→47、移行後のRoomスキーマ検証、旧JSON・両方式の往復・未知値を含みます。
  • :app:assembleLiteStandardReleaseUnsigned: 成功。R8難読化・リソース縮小・release向けLintを含みます。
  • R8のclassfile出力で実際のJSON codecと互換性テストを検証: keepルールありで4件成功、同ルールを除いた対照実行では4件すべて失敗し、修正の有効性を確認しました。
  • リリースAPKのDEXを検査し、バックアップDTOのyomitangomatchModeが保持されていることを確認しました。
  • 初回の全テストでは既存グライド性能テストが時間上限を超えましたが、リリースビルド終了後の全テスト再実行では成功しました。
  • エミュレーターは別の検証が使用中だったため、今回のリリースUI操作による確認は未実施です。JSON互換性は上記のR8実行テストとAPK検査で確認しています。
  • 最終差分を再レビューし、追加のマージ阻害事項は見つかりませんでした。

English

Summary

Each NG word supports partial or exact matching. Partial matching blocks candidates containing the registered word; exact matching requires both the input reading and candidate text to match the registered pair. Existing partial-match filtering scope and literal treatment of symbols are preserved.

Implementation

  • Share matching logic; add a mode selector to settings add/edit forms and long-press registration, and display the mode in the list.
  • Refresh candidates for active input when NG words change.
  • Merge the latest dev and resolve conflicts. Preserve dev's 45→46 migration for key_definitions.textInputBehavior; add NG word matchMode in 46→47. The database version is 47 and existing records default to PARTIAL.
  • Share the JSON codec between the settings UI and compatibility tests. Preserve the wire keys; missing, null, and unknown string modes fall back to PARTIAL.
  • Explicitly keep the Gson backup DTO in R8 to preserve reflective deserialization in minified builds.

Validation

  • :app:testFullStandardDebugUnitTest: final run: 1,464 tests, 1,460 passed, 4 skipped, zero failures. The 12 NG word tests cover 45→47, 46→47, Room schema validation after migration, legacy JSON, both modes, and unknown values.
  • :app:assembleLiteStandardReleaseUnsigned: passed, including R8 minification, resource shrinking, and release lint.
  • Executed the real JSON codec and compatibility tests through R8 classfile output: all 4 tests passed with the keep rule, while the control build without that rule failed all 4 tests.
  • Inspected the release APK DEX and verified that the backup DTO retains yomi, tango, and matchMode.
  • The initial full test run exceeded the existing glide benchmark time limit; the final full run passed after the release build finished.
  • Release UI interaction was not tested because the emulator was in use by another verification task. JSON compatibility was checked with the R8 execution tests and APK inspection above.
  • Re-reviewed the final diff; no additional merge blockers were found.

@KazumaProject
KazumaProject merged commit ec7f066 into dev Sep 8, 2026
1 check passed
@KazumaProject
KazumaProject deleted the feature/ng-word-match-mode branch September 13, 2026 02:09
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