Skip to content

fix(vocabulary): Homophones sorting should be stable.#1079

Merged
ksqsf merged 1 commit intomasterfrom
fix/stable-sort
Sep 20, 2025
Merged

fix(vocabulary): Homophones sorting should be stable.#1079
ksqsf merged 1 commit intomasterfrom
fix/stable-sort

Conversation

@ksqsf
Copy link
Member

@ksqsf ksqsf commented Sep 19, 2025

在编译 table 时,有时可以观察到 sort: by_weight 的词典中,重码候选顺序会因为排序不稳定而乱掉,改为稳定排序即可修复。

@ksqsf ksqsf requested review from a team and Copilot September 19, 2025 15:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes unstable sorting behavior in the Rime dictionary vocabulary system that was causing homophones (words with same pronunciation) to be reordered unpredictably during table compilation when using sort: by_weight.

  • Replaces std::sort with std::stable_sort in template functions to maintain relative order of equivalent elements
  • Ensures consistent ordering of homophone candidates with equal weights

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ksqsf ksqsf merged commit d6a9280 into master Sep 20, 2025
20 checks passed
@ksqsf ksqsf deleted the fix/stable-sort branch September 20, 2025 18:06
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.

3 participants