Files
msime-windows/engine/core/query_request.h
T
fanlusky e7f7addd4f feat(engine): 神经网络整句联想与词格 n-best 重排
- 新增 engine/neural:移植 chinese-ime-lm 的字符级 Transformer 推理,在词格解出的最多 12 条
  n-best 里重排挑选整句,desktop / keyboard 两档模型各出一条首选,后台 worker 异步打分
- 词格支持 n-best 输出与重排(quanpin/lattice_rerank),全拼、双拼共用
- 新增 SentenceAssociationOptions,经 QueryRequest 传给各 provider;四个来源默认全关
- 资源契约登记两个 safetensors 与 NOTICE;模型二进制不进仓库,由
  scripts/fetch-neural-model.ps1 按 neural-model/lock.json 下载并校验 SHA256
- 新增 neural_sentence 测试
2026-09-24 14:03:39 +08:00

42 lines
1.5 KiB
C++

#pragma once
#include "key_event.h"
#include "fuzzy_pinyin_options.h"
#include "scheme_type.h"
#include "sentence_association_options.h"
#include <string>
#include <vector>
struct KeyStroke
{
ImeKeyCode vk = 0;
ImeModifierMask modifiers_down = 0;
ImeCharacter wch = 0;
};
struct QueryRequest
{
SchemeType scheme = SchemeType::Quanpin;
std::string raw_input;
std::string raw_input_with_cases;
std::string normalized_input;
std::string raw_segmentation;
std::string normalized_segmentation;
std::string segmentation;
bool enable_shuangpin_helpcode = false;
bool enable_quanpin_helpcode = false;
// Autocorrection is type-gated (bit0 transposition, bit1 neighbor in the session-level
// mask); both default off, so a fresh install never rewrites the user's spelling.
bool enable_quanpin_autocorrect_transposition = false;
bool enable_quanpin_autocorrect_neighbor = false;
std::vector<KeyStroke> key_strokes;
metasequoia::FuzzyPinyinOptions fuzzy_pinyin;
// 整句候选来源与去重补位选项,默认全关。
SentenceAssociationOptions sentence_association;
// 给神经重排看的前文:本会话最近上屏的文本。空着也能重排,只是模型看不到语境,「shanghai」
// 到底是上海还是伤害就只能靠词格自己的静态分。词典层只取末尾若干字(RerankOptions::
// context_chars),所以这里给多了也无妨。
std::string rescoring_context;
bool valid = false;
};