大規模ユーザー辞書向けのインデックス/キャッシュを追加#320
Draft
artin-kagun wants to merge 1 commit intoazooKey:mainfrom
Draft
Conversation
Member
|
@artin-kagun |
Member
|
もう少し細かく実装を読んでみたのですが、今のrevision周りの実装はexportを変換のタイミングでやろうとしているのが原因だと思うので、ユーザ辞書を設定し終わったタイミングでexportするようにすることでもっとシンプルにできると思いました。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
大きなユーザー辞書を使う場合に、毎回すべての辞書項目を動的辞書として走査・投入する負荷を減らします。
#318 で一度まとめて提案していた変更のうち、このPRでは「大規模ユーザー辞書向けインデックス / キャッシュ」に範囲を絞っています。複数辞書管理、インポート / エクスポート、候補欄へのコメント表示は含めていません。
変更内容
UserDictionaryIndexStoreを追加し、ユーザー辞書項目をDictionaryBuilder.exportDictionaryで検索用ファイルに変換できるようにしました。SegmentsManager側で、現在の入力に関係する動的辞書項目だけを fallback として渡すようにしました。意図
候補数を上限で切るのではなく、辞書検索の入力経路を converter が扱いやすい形式に寄せることで、変換候補の網羅性を落とさずに大規模辞書の負荷を下げる狙いです。
インデックス化できない読みは捨てず、従来の動的辞書 fallback に残します。そのため、キャッシュ対象外の項目も引き続き変換候補として出せます。
検証
swift test --disable-sandbox --package-path Core --build-path /private/tmp/azookey-pr-import-export-buildgit diff --check upstream/mainswiftlint --quiet --strict