fix(engine): 英文调频不再以中文权重为基准,并按输入记英文槽位

混输列表里英文调频把「全表最高权重 + 1000」写成新权重,中文候选也算在内。
在 zai 下选一次 zaire,它的权重就变成 19,196,987,超过「在」,并且对所有能查出它的输入永久生效。

- adjust_english_candidate_ranking 只用英文候选的权重当基准
- 新增 english_slots 表和 english_slot / set_english_slot /
  learn_english_slot_selection / learn_english_slot_bypass:按输入记录首个英文候选在列表中的位置,
  选中时按调频名次前移(可以升到首位),越过它时后退一位,最多到首页末位
- 新增 InputSession::reads_as_pinyin:整串能否读成拼音(允许简拼声母和打到一半的音节)
This commit is contained in:
fanlusky committed 2026-09-30 22:49:27 +08:00
1 parent 5a74ee7a17
commit c99fb8d585
5 files changed
+220 -11

No files matched your search

+20
View File
@@ -462,6 +462,26 @@ bool InputSession::is_all_complete_pure_pinyin() const
return !segmentation.empty() && quanpin::is_complete_pinyin_input(segmentation);
}
bool InputSession::reads_as_pinyin() const
{
if (has_active_helpcode())
return true;
std::string raw = remove_delimiters(request().raw_input);
std::transform(raw.begin(), raw.end(), raw.begin(),
[](unsigned char ch) { return static_cast<char>(std::tolower(ch)); });
if (raw.empty())
return false;
if (is_shuangpin())
{
// 双拼两键一个音节,打到一半时末尾会剩一个声母键。
return raw.size() == 1 || shuangpin::is_complete_input(raw, shuangpin_profile_) ||
shuangpin::is_complete_input(raw.substr(0, raw.size() - 1), shuangpin_profile_);
}
if (current_scheme_type() == SchemeType::Quanpin)
return !quanpin::cut_one_piece_min_segments(raw, false).empty();
return false;
}
bool InputSession::wubi_unique_four_code() const
{
// Both modes spell words rather than codes; a wubi code is not composed inside them. No host