`vendor/MetasequoiaImeEngine` submodule 改为 `engine/` 目录,导入的是 product-lock.json 原本钉住的提交 c810d201,逐文件核对过 blob,因此这是一次 搬迁而不是引擎升级。引擎自己的嵌套 submodule(googlepinyinime-rev、utfcpp、 miniaudio)按各自 gitlink 一并展开,来源与提交见 engine/UPSTREAM.md。 Windows 专门化裁掉了不属于本产品的部分:whisper.cpp 与本地推理 provider、 macOS 示例宿主、整个 dictionary/ 建库流水线、上游 CI 与 release-please 配置。 词库仍按 product-lock.json 在构建时取发布产物。 引擎不再进 product-lock.json:没有 gitlink 就没有可比对的东西,锁里写一个上游 commit 等于宣称这棵树仍等于上游,而第一个 Windows 专门化改动落地时这句话就假了。 verify-contracts / verify-checkout 随之移除,verify-published 保留。 CI 与工具链:引擎源码并入根 scripts/format.sh(删掉引擎自己的那份,避免两套排除 列表分叉);引擎 voice.yml 里的 silero_vad.onnx 摘要校验移到本仓 lock job; engine-bump-triage 工作流与其测试删除;gitsubmodule 的 dependabot 频率由 daily 改为 monthly。 README、README.en、AGENTS.md、CONTRIBUTING、docs/product-release.md 及各子目录 文档同步说明新的位置与边界。
57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
#include <Windows.h>
|
|
#include <fmt/core.h>
|
|
#include <sqlite3.h>
|
|
#include "fmt/base.h"
|
|
#include "shuangpin/engine.h"
|
|
#include <chrono>
|
|
#include "shuangpin/shuangpin_query.h"
|
|
#include "core/query_request.h"
|
|
|
|
using namespace std;
|
|
|
|
void testGenerate()
|
|
{
|
|
ShuangpinEngine engine;
|
|
QueryRequest request;
|
|
request.scheme = SchemeType::Shuangpin;
|
|
vector<UINT> sequence;
|
|
// sequence = {'N', 'I', 'R'};
|
|
// sequence = {'Y', 'I', 'R', 'F', 'I'};
|
|
// sequence = {'Y', 'I', 'G', 'E'};
|
|
// sequence = {'Y', 'I'};
|
|
// sequence = {'N', 'I', 'H'};
|
|
sequence = {'C', 'L', 'S'};
|
|
|
|
for (const auto &c : sequence)
|
|
{
|
|
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
|
|
request.key_strokes.push_back(KeyStroke{c, 0, static_cast<WCHAR>(c + ('a' - 'A'))});
|
|
std::chrono::high_resolution_clock::time_point end = std::chrono::high_resolution_clock::now();
|
|
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
|
fmt::println("Time: {} us", duration.count());
|
|
}
|
|
request.raw_input = "cls";
|
|
request.valid = true;
|
|
std::vector<WordItem> result = engine.query(request);
|
|
|
|
for (const auto &item : result)
|
|
{
|
|
fmt::println("Word: {}", item.word);
|
|
}
|
|
}
|
|
|
|
void testGetChar()
|
|
{
|
|
fmt::println("First char: {}", shuangpin::get_first_han_char("𰻝什么东西呢"));
|
|
fmt::println("Last char: {}", shuangpin::get_last_han_char("𰻝什么东西呢"));
|
|
fmt::println("First char: {}", shuangpin::get_first_han_char("你好呀什么东西呢"));
|
|
fmt::println("Last char: {}", shuangpin::get_last_han_char("什么东西呢我的汴梁"));
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
testGenerate();
|
|
// testGetChar();
|
|
return 0;
|
|
}
|