译脉·先知 2.0 预知记忆网络引擎的 MoonBit 零依赖实现:带预测能力的记忆网络,支持可解释预测与语义召回。
Dependencies
一套带预测能力的记忆网络——让本地智能体记住工作流,并在遇到同类任务时预测下一步需求、给出可白盒解释的路径。这是「译脉·先知 2.0 预知记忆网络」引擎的 MoonBit 零依赖实现(仅 core/json + core/math)。在「预测记忆」内核之外,已落地 #22 翻译记忆(TM)/ 术语库(TB)一等公民:真正的 fuzzy match(含匹配率%)、concordance 检索、TBX 术语库强制对齐与一致性校验——让引擎从「只预测」走向「预测 + 检索 + 术语守门」。📜 变更历史:CHANGELOG.md 记录每次 P 增量的完整 commit 列表与影响范围;本 README 只描述当前状态。
| Module | Algorithm | What it does |
|---|---|---|
| D1 Synaptic graph | Hebbian w ← w + LR·(1−w) | Co-occurrence creates edges; weights decay over time. |
| D2 Activation spread | Multi-hop a·w·decay | Seed node → activate similar nodes → recall by spreading. |
| D3 Forward model | 1st-order + 2nd-order Markov src→{dst} / (w1,w2)→{w3} | Predict next step by blending context-weighted 1st-order transitions with λ·P(w3\|w1,w2) (second-order). |
| D4 Value pricing | V = α·U_past + β·U_pred + γ·C_graph + δ·R − ε·Cost | β=0.45 dominates — predicted-hit value ranks highest. |
| D5 Episode sequence | episode log | Records sequences for consolidation replay. |
| D6 Consolidation | prune + constraint-contract snapshot | Meta-cognitive explore control; contract roll-back via restore. |
| D7 Uncertainty | distribution entropy | Emits confidence / uncertainty. |
| D8 Concept abstraction | multi-granularity role transitions (cold-start) | 前二 / 前四 / 前后各二 role keys induce cross-topic rules. |
yimai_prophecy_moonbit/
├── engine.mbt # Layer0: 零依赖预测记忆引擎内核(D1–D8, #22 TM/TB, MQM)
├── util.mbt # 编码/TF-IDF/对齐/URL解码工具函数(P4 decode_pct 新增)
├── yimai_prophecy_moonbit.mbt # Lib 主入口(routes_meta 单一源 + lib 共享 helper 文档化)
├── tests/ # P5 仓库整理:18 个测试按主题分到 3 个 sub-package
│ ├── core/ # 核心/经典测试(69 测试)
│ │ ├── moon.pkg # sub-package(独立 wasm-gc 测试目标)
│ │ ├── _test_helpers.mbt # 跨子包共享 helper(canon/topics + 6 fn,pub)
│ │ ├── yimai_prophecy_moonbit_test.mbt # 主测试(L1–L2 批量 Hit@3)
│ │ ├── yimai_prophecy_moonbit_accept_test.mbt # 验收测试台
│ │ ├── yimai_prophecy_moonbit_bench_p1.mbt # 基准 P1(pruned vs full acc)
│ │ ├── yimai_prophecy_moonbit_benchmark_test.mbt
│ │ ├── yimai_prophecy_moonbit_golden_test.mbt # 黄金集回归
│ │ ├── yimai_prophecy_moonbit_long_text_test.mbt # 长文本 / 分段 / 数字 token
│ │ ├── yimai_prophecy_moonbit_tm_test.mbt # TM 专项
│ │ ├── yimai_prophecy_moonbit_v2_test.mbt # V2 引擎 API
│ │ └── yimai_prophecy_moonbit_wbtest.mbt # 白盒内部测试
│ ├── corpus/ # 语料/数据集驱动测试(54 测试)
│ │ ├── moon.pkg
│ │ ├── _test_helpers.mbt # inline 副本(与 core/ 同步)
│ │ ├── yimai_prophecy_moonbit_extended_corpus_test.mbt # 6 个领域 11 测试
│ │ ├── yimai_prophecy_moonbit_modern_corpus_test.mbt # Modern Corpus:8 个前沿领域
│ │ ├── yimai_prophecy_moonbit_roadmap_test.mbt # Roadmap 增量语料
│ │ ├── yimai_prophecy_moonbit_frontier_corpus_test.mbt # Frontier Corpus:10 个领域 14 测试
│ │ └── yimai_prophecy_moonbit_business_corpus_test.mbt # 商务领域(P5 新增,ISO 11669 / GB/T 30539)
│ └── feature/ # 扩展/新功能测试(52 测试)
│ ├── moon.pkg
│ ├── yimai_prophecy_moonbit_extension_test.mbt # 扩展能力回归(E1–E18)
│ ├── yimai_prophecy_moonbit_quality_test.mbt # P4 质量/安全(T30–T37)
│ ├── yimai_prophecy_moonbit_routes_test.mbt # 端点元数据单一源测试
│ └── yimai_prophecy_moonbit_mqm_reannotation_test.mbt # P5 MQM 二次标注(Google 2025-10-28)
├── cmd/
│ ├── main/moon.pkg # demo 程序(训练 → Hit@3 → replay → D8 冷启动 → consolidate → reward → restore)
│ └── service/
│ ├── moon.pkg # 服务入口(`moon run cmd/service --target native` → 127.0.0.1:8787)
│ ├── mcp.mbt # MCP Server 实现(spec 2025-11-25 Streamable HTTP)
│ ├── routes.mbt # 27 个 HTTP 端点路由(24 + metrics + health + mqm_re_annotate)
│ ├── tm_store.mbt # 引擎持久化(`save_store` 深度守卫 P4)
│ └── web/ # 前端工作台(静态资源,`serve_static` URL 解码 P4 修复)
├── scripts/
│ ├── dev.ps1 # 一键起服务(env check → build → run → seed → smoke)
│ ├── push.ps1 # 双 remote 推送(github via ghproxy.net + gitlink)
│ ├── smoke.ps1 # 烟雾测试(27 端点 + MCP)
│ └── reorganize_repo.py # 仓库整理复现脚本(git mv + add @lib. prefix + sub-package init)
├── .githooks/
│ └── pre-commit # 本地门禁(`moon check` + `moon test --target wasm-gc`)
├── docs/
│ ├── skill/SKILL.md # WorkBuddy 技能编排手册(frontmatter agent_created=true)
│ ├── harness-configs/ # 13 个 harness 配置(Claude Code / Cursor / Gemini CLI / ...)
│ ├── plans/ # 项目级 plan / note(按日期 YYYY-MM-DD-<topic>.md 命名)
│ └── roadmap.md # 项目路线图(中文转英文,仓库国际友好)
├── AGENTS.md # AI agent 集成指南(含 Project layout 段:未来 _test.mbt 必须在子目录)
├── README.md # 项目说明(badge 175/175 + P6 hardening + International Standards)
├── CHANGELOG.md # 版本变更记录
└── LICENSE # MIT Licensemoon add Across2005/yimai_prophecy_moonbitimport {
"Across2005/yimai_prophecy_moonbit" @lib,
"moonbitlang/core/json" @json,
}Requires the MoonBit toolchain (moon, v0.1.2026+).
powershell -ExecutionPolicy Bypass -File scripts/dev.ps1确定性回归门禁(纯本地,零云端依赖): scripts/dev.ps1 在构建前自动运行 moon test --target wasm-gc(175/175 契约回归,P6 hardening 后),任何一项失败即中止。 此外,仓库自带本地 pre-commit hook(.githooks/pre-commit,moon check + moon test --target wasm-gc),已通过 git config core.hooksPath .githooks 接入本仓库——每个 commit 前自动挡住破坏确定性契约的改动。
Windows native prerequisites: cmd/service requires MSVC (link.native.cc in cmd/service/moon.pkg and cmd/main/moon.pkg points at cl.exe — update both if the path differs on your machine); after a MoonBit toolchain upgrade, rebuild the core native bundle once (cd ~/.moon/lib/core && moon clean --target-dir _build/native &&moon bundle --target native --release). AI agents: see AGENTS.md for the full out-of-the-box guide.
pub fn quickstart() -> Unit {
let mut eng = @lib.ProphecyEngine::make()
// 1) observe() records real steps in order; the engine maintains a
// context window and a 1st/2nd-order Markov transition model internally.
let _ = eng.observe("解析源文件结构", "step")
let _ = eng.observe("提取核心术语表并锁定", "step")
let _ = eng.observe("生成双语对照草稿", "step")
// 2) predict Top-3 most likely next steps from current context.
let pred = eng.predict(3)
println(@json.stringify(pred))
// 3) recall: given a query, return related memories (with activation + path).
let hits = eng.recall("术语", 5)
println(@json.stringify(hits))
// 4) persist & restore.
let snap = eng.to_json()
let eng2 = @lib.ProphecyEngine::from_json(snap)
let _ = eng2
// 5) #22 — TM / TermBase: add memory, load a TBX glossary, align & verify.
let _ = eng.add_tm("电池包热管理策略", "Battery pack thermal management strategy")
let tbx =
"<martif><text><body>" +
"<termEntry id=\"1\"><langSet xml:lang=\"en-US\"><ntig><termGrp><term>sensor</term></termGrp></ntig></langSet>" +
"<langSet xml:lang=\"zh-CN\"><ntig><termGrp><term>传感器</term></termGrp></ntig></langSet></termEntry>" +
"</body></text></martif>"
let _ = eng.load_tbx(tbx)
let tmx = eng.fuzzy_match("电池包热管理", 3, 0.70) // Top-K with match_pct
let v = eng.check_terms("install the sensor", "安装设备") // 1 violation (漏译 传感器)
println(@json.stringify(tmx))
println(@json.stringify(v))
}observe(text, mtype) builds edges/transitions from the current context window and advances the logical clock. To control co-occurrence manually, call remember(text, mtype, ctx) with an explicit ctx array.
moon build
moon run cmd/main # training → Hit@3 → replay prediction → D8 cold-start → consolidate → reward → restoremoon build cmd/service --target native && moon run cmd/service --target native
# 译脉引擎服务: http://127.0.0.1:8787curl -X POST localhost:8787/api/add_tm -d '{"src":"电池包热管理策略","tgt":"Battery pack thermal management strategy"}'
curl -X POST localhost:8787/api/fuzzy_match -d '{"query":"电池包热管理方案","k":3,"threshold":0.5}'
curl -X POST localhost:8787/api/check_terms -d '{"source":"install the sensor","target":"安装设备"}'
curl -X POST localhost:8787/api/qe_auto -d '{"source":"a","target":"b","match_rate":0.8}'
curl -X POST localhost:8787/api/predict -d '{"k":3}'| # | Domain | Sample training content |
|---|---|---|
| 1 | AI Safety & Alignment | RLHF reward hacking audits, red-teaming frontier models against CBRN knowledge, mechanistic interpretability of superposition in SAE features |
| 2 | Climate Modeling & Carbon Capture | CMIP7 AR7 scenario SSP5-8.5 projection, direct air capture with solid amine sorbents, enhanced weathering of olivine for ocean alkalinity enhancement |
| 3 | Quantum Computing & Error Correction | Surface code logical error rates at 10⁻⁶ physical error threshold, cat qubit bias-preserving gates with autonomous stabilization, LDPC code benchmarks on IBM ibm_sherbrooke vs Google Willow |
| 4 | CRISPR & Gene Therapy | CRISPR-Cas12a multiplexed genome editing with AI-designed gRNA libraries, PCSK9 base editing for durable LDL cholesterol reduction, AAV9 capsid engineering for blood-brain barrier crossing |
| 5 | Cybersecurity & Zero Trust | NIST SP 800-207 Zero Trust Architecture deployment, post-quantum TLS 1.3 hybrid key exchange with Kyber-1024 + X25519, AI-driven SOC automation with graph neural network anomaly detection |
| 6 | Neuroscience & Brain-Computer Interfaces | High-density 1024-channel ECoG grid for speech decoding, latent diffusion models reconstructing perceived natural images from 7T fMRI BOLD signals |
| 7 | Distributed Systems & Cloud Native | Multi-region Spanner-style TrueTime with bounded clock uncertainty, service mesh mTLS with SPIFFE identities, disaggregated memory pooling over CXL 3.0 fabrics |
| 8 | NLP & Large Language Models | Llama-4-Maverick MOE routing with 128 experts + top-8 gating, RLAIF vs RLHF head-to-head on MT-Bench and AlpacaEval 2.0, retrieval-augmented generation with late interaction ColBERTv2 |
| 9 | Robotics & Embodied AI | Diffusion policy for dexterous manipulation with visuotactile feedback, sim-to-real transfer of quadruped locomotion via domain randomization |
| 10 | Fusion Energy & Plasma Physics | SPARC tokamak Q>1 breakeven experiments, stellarator coil optimization with adjoint methods |
| 11 | Synthetic Biology & Metabolic Engineering | Cell-free biosynthesis of taxol precursors, CRISPRi logic gates for genetic circuit design |
| 12 | Protein Design & Drug Discovery | RFdiffusion backbone generation + ProteinMPNN sequence design, PROTAC ternary complex prediction with AlphaFold3 |
| 13 | Battery Technology & Solid-State Electrolytes | LLZO garnet-type solid electrolyte ionic conductivity tuning, lithium metal anode dendrite suppression with ALD coatings |
| 14 | Space Tech & Satellite Constellations | Starlink V2 laser inter-satellite link mesh routing, lunar surface habitat construction with regolith 3D printing |
| 15 | AI Safety (Frontier) | Constitutional AI alignment workflows, mechanistic interpretability of attention head superposition, red-teaming procedures for CBRN knowledge boundary enforcement |
| 16 | Science (Frontier) | CRISPR-Cas12a multiplexed editing workflows, stem cell differentiation protocols, protein folding prediction pipelines with AlphaFold3 |
| 17 | Mathematics (Frontier) | Category theory proof verification, homological algebra computation, topological data analysis with persistent homology |
| 18 | Philosophy (Frontier) | Analytic philosophy argument structure mapping, phenomenology consciousness studies, ethical framework deployment workflows |
| 19 | Digital Humanities (Frontier) | Text mining for corpus linguistics, digital archive curation workflows, computational narrative analysis |
| 20 | CBT Psychology (Frontier) | Cognitive restructuring session workflows, exposure therapy protocol management, mindfulness-based cognitive therapy deployment |
| 21 | Aviation (Frontier) | Flight deck procedure automation, air traffic control coordination protocols, aircraft maintenance scheduling workflows |
| 22 | Space Exploration (Frontier) | Mars mission planning workflows, orbital mechanics computation pipelines, satellite constellation deployment protocols |
| Domain | Predicted Project | Hit@3 |
|---|---|---|
| AI Safety | Project: AI Safety Technical Report Q4 2025 | ✅ |
| Climate Modeling | Project: Global Carbon Budget Analysis 2026 | ✅ |
| Quantum Computing | Project: Surface Code Error Correction Benchmark | ✅ |
| CRISPR & Gene Therapy | Project: CRISPR-Cas12a Off-Target Analysis Pipeline | ✅ |
| Cybersecurity | Project: Zero Trust Architecture Security Audit | ✅ |
| Neuroscience & BCI | Project: High-Density ECoG Neural Decoding Pipeline | ✅ |
| Distributed Systems | Project: Multi-Region Eventual Consistency Benchmark | ✅ |
| NLP & LLMs | Project: Multilingual LLM Evaluation Suite v3 | ✅ |
Engine-wide Hit@3 = 0.7773. All 8/8 domains produce valid, domain-specific workflow predictions.
| Metric | Value |
|---|---|
| Total modern corpus tests | 11/11 passing |
| Domains covered | 8 (AI safety, climate, quantum, CRISPR, cybersecurity, neuroscience, distributed systems, NLP) |
| Training observations | 240 |
| Engine Hit@3 | 0.7773 |
| Post-consolidation nodes/edges | 48/534 |
| Cold-start generalization | ✅ Unseen domains produce valid predictions |
| Determinism | ✅ Byte-identical serialization, round-trip verified |
| White-box explainability | ✅ activation_path + prediction_path + value_breakdown |
| WAL event sourcing | ✅ Replay integrity confirmed |
| # | Domain | Sample training content |
|---|---|---|
| 1 | Robotics & Embodied AI | Diffusion policy for dexterous manipulation with visuotactile feedback, sim-to-real transfer of quadruped locomotion via domain randomization |
| 2 | Fusion Energy & Plasma Physics | SPARC tokamak Q>1 breakeven experiments, stellarator coil optimization with adjoint methods |
| 3 | Synthetic Biology & Metabolic Engineering | Cell-free biosynthesis of taxol precursors, CRISPRi logic gates for genetic circuit design |
| 4 | Protein Design & Drug Discovery | RFdiffusion backbone generation + ProteinMPNN sequence design, PROTAC ternary complex prediction with AlphaFold3 |
| 5 | Battery Technology & Solid-State Electrolytes | LLZO garnet-type solid electrolyte ionic conductivity tuning, lithium metal anode dendrite suppression with ALD coatings |
| 6 | Space Tech & Satellite Constellations | Starlink V2 laser inter-satellite link mesh routing, lunar surface habitat construction with regolith 3D printing |
| # | Domain | Sample training content |
|---|---|---|
| 1 | AI Safety (Frontier) | Constitutional AI alignment workflows, mechanistic interpretability of attention head superposition, red-teaming procedures for CBRN knowledge boundary enforcement |
| 2 | Science (Frontier) | CRISPR-Cas12a multiplexed editing workflows, stem cell differentiation protocols, protein folding prediction pipelines with AlphaFold3 |
| 3 | Mathematics (Frontier) | Category theory proof verification, homological algebra computation, topological data analysis with persistent homology |
| 4 | Philosophy (Frontier) | Analytic philosophy argument structure mapping, phenomenology consciousness studies, ethical framework deployment workflows |
| 5 | Digital Humanities (Frontier) | Text mining for corpus linguistics, digital archive curation workflows, computational narrative analysis |
| 6 | CBT Psychology (Frontier) | Cognitive restructuring session workflows, exposure therapy protocol management, mindfulness-based cognitive therapy deployment |
| 7 | Aviation (Frontier) | Flight deck procedure automation, air traffic control coordination protocols, aircraft maintenance scheduling workflows |
| 8 | Space Exploration (Frontier) | Mars mission planning workflows, orbital mechanics computation pipelines, satellite constellation deployment protocols |
| 维度 | 旧架构(v1) | 新架构(v2,当前) |
|---|---|---|
| 总体形态 | 单一纯库(零依赖内核)+ cmd/main demo | 三层:Layer0 零依赖内核 / Layer2 纯 MoonBit 服务层 / Layer1 知识层(文档 + 前端工作台已实现) |
| I/O 能力 | 无 stdin / 无文件 I/O(wasm-gc 内存态) | async/fs 原子写持久化(tm_store.json,tmp+rename)+ 重启恢复闭环 |
| 对外接口 | 仅 MoonBit 函数调用(moon add 后进程内调用) | 27 个 HTTP REST 端点,前端 / Agent / LLM 宿主可直接消费 |
| 集成路径 | 2 条:库引用、算法移植 | 4 条:A 构建运行 / B wasm-gc exports / C HTTP 服务(新增,已实测) / D 算法移植 |
| 运行形态 | wasm-gc 内存态(测试友好) | native(Windows 需 MSVC)本地常驻服务,127.0.0.1:8787 |
| 语言栈 | 单一 MoonBit(仅库) | 单一 MoonBit(库 + HTTP 服务 + 文件 I/O)——引擎到服务零桥接语言 |
| 状态持有 | 调用方自管引擎实例 | Ref[ProphecyEngine] 服务内单例 + JSON 边界透出 |
演进动机:旧架构的引擎能力只能被「会 MoonBit 的程序」消费;新架构让任何会 HTTP 的宿主(浏览器前端、Agent 工具调用、LLM 函数调用)都能用上确定性记忆引擎——内核零依赖铁律不变,只是多了一层纯 MoonBit 的 I/O 壳。
| 端点 | 方法 | 请求体 | 响应 | 说明 |
|---|---|---|---|---|
| /api/ping | GET | — | {"status":"ok"} | 健康检查 |
| /api/add_tm | POST | {"src","tgt"} | {"id","status"} | 新增 TM,原子落盘 |
| /api/fuzzy_match | POST | {"query","k","threshold"} | Top-K(S1 四分量白盒) | TM 模糊检索 |
| /api/check_terms | POST | {"source","target"} | 违规数组 | 术语一致性校验 |
| /api/concordance | POST | {"term","k"} | 含术语 TM 段 | 术语上下文检索 |
| /api/qe_auto | POST | {"source","target","match_rate"} | {"qe_score","term_ok","mqm"} | 自动 QE 评分 |
| /api/predict | POST | {"k"} | {"predictions","confidence","uncertainty"} | 下一步预测 + 白盒 |
| /api/observe | POST | {"text","mtype"} | {"mid","status"} | 记录真实步骤(学习/转移)→ 落盘 |
| /api/recall | POST | {"query","k"} | Array[{id,text,score,via_edges}] | 激活扩散语义召回 |
| /api/explain | POST | {"mid"} | 白盒卡片 | value_breakdown / activation_path 证据链 |
| /api/reward | POST | {"mid","score"} | {"ok"} | 采纳/拒绝反馈 → predictive_value(闭环核心) |
| /api/consolidate | POST | {"prune"} | {pruned,nodes,edges,...} | 固化重放(价值重算 + 剪枝) |
| /api/retrieve_prompt | POST | {"query","k","threshold"} | 三段式 | TMPlm:suggestions/terms/glossary 供 LLM prompt 注入 |
| /api/bleu / /api/chrf | POST | {"ref","hyp"} | {bleu} / {chrf} | MT 质量评测(零依赖自实现) |
| /api/style_check | POST | {"text"} | 问题数组 | 风格一致性(句长/标点/括号/术语命中) |
| /api/style_report | POST | {"text"?} | {sentence_count,avg_src_len,avg_tgt_len,formal_score,distribution,term_variants,tips} | 风格一致报告(记忆库分布 + 术语变体族 + 新译文偏离建议) |
| /api/back_align | POST | {"source","target"} | {align_score,misaligns,ops} | 回译 LCS 对齐(含字符级 ops 供热力图) |
| /api/term_conflicts | POST | — | 冲突数组 | 一词多译 / 多词一译 |
| /api/fed_export / /api/fed_import | POST | {"added","updated"} | {status} | 联邦增量导出/导入(FedAvg 端点层) |
| /api/distill_inject | POST | {"table":{k:v}} | {status,keys} | 蒸馏偏置表注入 |
| /api/active_learning | POST | {"k"} | Array[{id,text,uncertainty,role}] | 主动学习推荐(uncertainty+diversity 待标注句) |
| /api/tm_count | GET | — | {"tm_count"} | 存量统计 |
| /api/metrics | GET | — | 引擎/服务指标 | 可观测指标 |
| /api/health | GET | — | 健康状态 | 含 uptime / 上次落盘状态 |
| /api/mqm_re_annotate | POST | {"source","target","match_rate"} | MQM 二次标注结果 | Critical 段强制重审 |
POST /api/fuzzy_match {"query":"电池包热管理方案","k":3,"threshold":0.5}
→ [{"id":"m3","source":"电池包温度管理方案","target":"Battery pack temperature management plan",
"score":0.7377,"match_pct":73.7723,"sim_token":0.7125,"sim_tfidf":0.6796,
"sim_char":0.7778,"sim_ngram":0.6667,"sim_tokenset":0.75}, ...]前端操作 ──HTTP──▶ Layer2 服务端点 ──调用──▶ Layer0 引擎方法
▲ │
│ ▼
└─── JSON 响应(白盒分数/证据链)◀── save_store() 原子落盘 ◀┘
│
▼
重启 load_store() → from_json() → 记忆不丢| MCP tool | 参数 | 说明 |
|---|---|---|
| fuzzy_match | query / k / threshold | TM 模糊检索(S1 四分量白盒) |
| add_tm | src / tgt | 新增 TM 并落盘 |
| check_terms | source / target | 术语一致性校验 |
| concordance | term / k | 术语上下文检索 |
| qe_auto | source / target / match_rate | 自动 QE 评分 |
| predict | k | 下一步预测 + 白盒路径 |
| observe | text / mtype | 记录步骤(学习)并落盘 |
| recall | query / k | 语义召回 |
| explain | mid | 白盒卡片 |
| reward | mid / score | 采纳/拒绝反馈 |
| consolidate | prune | 固化重放 |
| tm_count / ping | — | 存量 / 健康检查 |
| retrieve_prompt | query / k / threshold | TMPlm:为 LLM prompt 组装三段式检索上下文(suggestions/terms/glossary) |
| bleu / chrf | ref / hyp | MT 质量评测(零依赖自实现) |
| style_check | text | 风格一致性(句长/标点/括号/术语命中) |
| style_report | text? | 风格一致报告:记忆库句长/正式度分布 + 术语变体族 + 新译文偏离建议 |
| back_align | source / target | 回译 LCS 对齐验证 |
| term_conflicts | — | 术语冲突检测(一词多译/多词一译) |
| fed_export / fed_import | added / updated | 联邦增量导出/导入 |
| distill_inject | table | 蒸馏偏置表注入 |
| active_learning | k | 主动学习推荐:uncertainty×0.6+novelty×0.4,角色去重,待标注句 |
| mqm_re_annotate | source / target / match_rate | MQM 二次标注:Critical 段强制重审 |
# MCP 握手(curl 模拟客户端)
curl -X POST localhost:8787/mcp -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'
curl -X POST localhost:8787/mcp -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
curl -X POST localhost:8787/mcp -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"fuzzy_match","arguments":{"query":"电池","k":2}}}'协议:initialize(protocolVersion 2025-11-25 + capabilities.tools)/ notifications/initialized(202)/ tools/list(25 tools,inputSchema JSON Schema 2020-12)/ tools/call(未知工具 -32602,引擎异常 isError:true);GET /mcp 回 405。实现为自建轻量 JSON-RPC 2.0 层(cmd/service/mcp.mbt,MoonBit 无现成 MCP 库),全程复用引擎 @lib.obj/str_json/num_json 构造(Json 为 FFI 类型)。
| Method | Signature | Description |
|---|---|---|
| make | () -> ProphecyEngine | Create an empty engine. |
| remember | (text, mtype, ctx : Array[String]) -> String | Write/dedupe a memory node, build co-occurrence synapse, return node id. |
| observe | (text, mtype) -> String | Record a real next step: remember + update transition + hit accounting + advance context. |
| predict | (k : Int) -> Json | Predict Top-K next steps from context window; returns prob/path/confidence/uncertainty. |
| recall | (query : String, k : Int) -> Array[Json] | Activation-spread associative recall; returns memory + activation + path. |
| consolidate | (prune : Bool) -> Json | Consolidation replay: decay, recompute value, optional prune, meta-cognitive explore. |
| restore | () -> Json | Roll back to the pre-consolidation snapshot (constraint contract). |
| reward | (mid, score : Double) -> Bool | Success/failure feedback into predictive value. |
| explain | (mid : String) -> Json | White-box explanation of a node's edges/transitions/hit-rate. |
| end_episode | () -> Unit | End the current episode sequence. |
| hit_rate | () -> Double | Cumulative prediction hit rate. |
| stats_view | () -> Json | Node/edge/episode counts, type distribution, avg predictive value. |
| context_texts | () -> Array[String] | Texts in the current context window. |
| last_context_id | () -> String | Last node id in the context window. |
| to_json | () -> Json | Export full engine state (persistence). |
| from_json | (data : Json) -> ProphecyEngine | Restore engine state from JSON. |
| Method | Signature | Description |
|---|---|---|
| set_domain_bias | (role, delta : Double) -> Unit | Inject/accumulate per-domain bias ΔW (LoRA-style). |
| inject_distillation | (table : Map[String, Double]) -> Unit | Inject read-only distilled bias table (neural-symbolic distillation, consume-side). |
| cl_step | (anchor, positive, negative : String) -> Unit | Online contrastive learning: strengthen (anchor,pos), suppress (anchor,neg). |
| set_attention | (alpha, beta : Double) -> Unit | Toggle attention-gated edge weights in recall (default off). |
| mark_term | (mid : String) -> Bool | Mark a node as terminology (TermNode): boost recall + flag for explain card. |
| explain_card | (mid : String) -> Json | White-box explainable card: activation/prediction paths + value breakdown. |
| Method | Signature | Description |
|---|---|---|
| active_learning_candidates | (k : Int) -> Array[Json] | Top-K uncertain + role-diverse nodes for human labeling. |
| wal_replay | () -> ProphecyEngine | Rebuild engine from the Write-Ahead Log (event sourcing). |
| wal_export / wal_compact / wal_clear / wal_len | (…) -> Array[String] / Unit / Int | WAL inspection & maintenance. |
| fed_export / fed_import | () -> Json / (added, updated : Int) -> Unit | Federated increment counter export/import (coordinator merges weights). |
| Method | Signature | Description |
|---|---|---|
| add_tm | (src, tgt : String) -> String | Add a translation-memory entry (source→target), build the TF index, return the node id. |
| fuzzy_match | (query : String, k : Int, threshold : Double) -> Json | TM fuzzy match Top-K. S1 升级评分 = 0.55·idf_dice + 0.20·char-2gram-dice + 0.15·token-set-dice + 0.10·position(IDF 加权让罕见术语优先、2-gram 捕捉形态变体、token-set Dice 容忍词序重排);returns match_pct / sim_token / sim_tfidf / sim_char / sim_ngram / sim_tokenset. (建议阈值 threshold = 0.70;MoonBit 无默认参数,调用方需显式传入。) |
| fuzzy_match_legacy | (query : String, k : Int, threshold : Double) -> Json | A/B 对照基线,长期保留不删除(≥0.3.0 讨论移除):旧公式 0.7·token-cosine + 0.3·char-ratio,4 处引用(engine.mbt + 2 test + 本 README)。新代码请用 fuzzy_match(S1 公式 + IDF 倒排剪枝)。 |
| concordance | (term : String, k : Int) -> Json | Concordance search: returns all TM segments containing the query term, scored by term occurrence count (distinct from the fuzzy_match similarity score). |
| load_tbx | (xml : String, src_lang~ : String = "en-US", tgt_lang~ : String = "zh-CN") -> Int | Parse a TBX (ISO 30042) termbase. Resolves source/target by each langSet's xml:lang (default en-US→zh-CN; falls back to document order when absent). Returns the number of concept entries loaded. |
| enforce_terms | (text : String) -> Json | Term enforcement: scan text for known terms (Latin terms require word boundaries, so log won't false-match logical), return hits with translation. |
| check_terms | (source, target : String) -> Json | Term-consistency check: for each source term whose translation is missing from the target, return a violation. |
{
"memories": {
"m1": { "id":"m1","text":"解析源文件结构","type":"step",
"vec":{"解析":1,"源":1},"created":1,"last_used":3,
"use_count":2,"feedback":0,"edges":{"m2":0.30},
"predictive_value":0.42,"hit_count":1,"predict_count":1,
"is_term":false,"translation":"" }
},
"transitions": { "m1": {"m2":1.0} },
"episodes": [["m1","m2","m3"]],
"context": ["m1","m2","m3"],
"stats": { "preds":1, "hits":1, "remembers":3, "evolutions":0 },
"seq": 3, "explore": 0.0, "clock": 3, "meta_hits": [1],
"snapshot": {}, "role_trans": {}, "role_index": {}
}TM / TermBase nodes add two fields: a TM node carries "type":"tm","translation":"<target>"; a terminology node carries "type":"term","is_term":true,"translation":"<target term>". Both are round-trip preserved through to_json/from_json (covered by R20).
{
"predictions": [
{ "id":"m4", "text":"生成双语对照草稿", "prob":0.62,
"path": [ { "from":"m3", "p":0.55 } ] }
],
"confidence": 0.62,
"uncertainty": 0.41
}[
{ "id":"m2", "text":"提取核心术语表并锁定", "type":"step",
"score":0.71, "activation":1.0, "via_edges": [ { "to":"m1", "w":0.30 } ] }
]{ "pruned": 0, "nodes": 3, "edges": 2, "explore": 0.0, "recent_hit_rate": 0.5 }[
{ "id":"m7", "source":"电池包热管理策略", "target":"Battery pack thermal management strategy",
"score":0.91, "match_pct":91.0, "sim_token":0.90, "sim_tfidf":0.88,
"sim_char":0.95, "sim_ngram":0.86, "sim_tokenset":0.93 }
][
{ "id":"m11", "source":"打开设置菜单选择网络", "target":"Open Settings menu, choose Network", "hits":1 }
]<martif><text><body>
<termEntry id="1">
<langSet xml:lang="en-US"><ntig><termGrp><term>network logon</term></termGrp></ntig></langSet>
<langSet xml:lang="zh-CN"><ntig><termGrp><term>网络登录</term></termGrp></ntig></langSet>
</termEntry>
</body></text></martif>[
{ "term":"network logon", "translation":"网络登录", "mid":"m20" }
][
{ "term":"sensor", "expected":"传感器", "mid":"m21" }
]| Layer | Check | Result | Evidence |
|---|---|---|---|
| L1 | Batch Hit@3 > 0.8 | ✅ | hit_rate = 0.8246 over 8 topics × 8 rounds |
| L1 | Determinism / reproducibility | ✅ | Two to_json calls are byte-identical |
| L1 | JSON round-trip | ✅ | to_json → from_json → to_json identical |
| L1 | Consolidation keeps core memory | ✅ | 13 nodes → 13 nodes after consolidate |
| L2 | Known-project replay predicts correct next | ✅ | observe project → Top1 提取核心术语表并锁定 |
| L2 | Cold-start generalization | ✅ | unseen topic via D8 role-abstraction yields correct next step |
| L2 | White-box explainable | ✅ | explain_card returns concrete activation_path / prediction_path / value_breakdown |
| L2 | Persistence after restart | ✅ | to_json → from_json Top1 unchanged |
| MC | Modern Corpus: 8 domains × 5 rounds | ✅ | 11/11 tests passing; Hit@3=0.7773; see Modern Corpus Evaluation |
| MC | Cold-start on unseen domains | ✅ | Zero-Day Threat Intelligence / Perovskite Solar Cell → valid predictions |
| MC | Cross-domain semantic recall | ✅ | Multi-domain queries activate correct domain clusters |
| MC | Deep fuzzy match (S1 upgrade) | ✅ | sim_token / sim_tfidf / sim_char / sim_ngram / sim_tokenset |
| MC | Attention-gated recall + domain bias | ✅ | α=0.3, β=0.2 + ΔW=0.15 shifts ranking correctly |
| MC | WAL event sourcing replay | ✅ | 384 entries → replay clone produces 576 entries |
| MC | Fed export/import + distillation | ✅ | Increment diff export → merge → distilled bias confirmed |
cd yimai_prophecy_moonbit
moon test --target wasm-gc # all 175 tests (P6 hardened)
moon test --target wasm-gc --filter Layer* # modern + extended + frontier corpus (25 tests)
moon test --target wasm-gc --filter T* # P4 quality/security tests (T30–T51, 22 tests)
moon build --target wasm-gc # library only
cd cmd/main && moon build --target wasm-gc && moon run .| # | Capability | Key methods | Notes |
|---|---|---|---|
| 2 | Quality estimation + MQM | qe_score, mqm_tags, qe_auto | qe_score = 0.55·match_rate + 0.30·term_ok + 0.15·char_ratio (cross-language length penalty dropped — it dragged scores to ~0.7 and distorted QE). mqm_tags emits terminology / accuracy / fluency / omission with major / critical / minor severity. |
| 3 | Format-fidelity round-trip | check_format_fidelity, protect_tags | Detects missing (source tag absent in target) / extra (target-only) inline tags & placeholders; protect_tags masks them to __TAG__ so fuzzy token-cosine isn't polluted. |
| 4 | Multimodal / screenshot | ocr_image (stub), align_regions | ocr_image is an external boundary stub (real OCR = Tesseract / vision-LLM, injected by host). Regions flow as JSON {bbox, text}; the engine does region ↔ TM alignment purely. |
| 5 | Localization CI / batch | batch_apply | Top-1 TM match + term-gate per segment, threshold-driven → {total, passed, failed, items}. Drop-in for a CI localization gate. |
| 6 | TMS interoperability | parse_tmx, parse_xliff, export_tmx | XLIFF 1.2 <trans-unit> and 2.0 <unit> both parsed; TMX 1.4 exported with XML escaping. Round-trip verified (E10). |
| 7 | Observability & drift | metrics, drift_report | metrics = tm/term counts + term-coverage; drift_report(before, after) diffs two to_json snapshots by (type\|is_term\|text\|translation) key to surface TM/term add/remove. |
Boundary principle. Capabilities #4 (OCR) and any host persistence stay outside the zero-dependency engine. The engine speaks JSON at these boundaries, so the host (Node/Python/Agent) supplies OCR, files, and I/O — the MoonBit core stays 100% pure-stdlib and wasm-gc-testable.
| Roadmap entry | Engine implementation | Status |
|---|---|---|
| Role inverted-index + Top-K pruning + LRU pred cache | role_members / predict Top-K / pred_cache | ✅ |
| 2nd-order Markov | trans2 | ✅ |
| Multi-granularity roles | roles_of | ✅ |
| Adaptive LR + elastic forgetting | hebb_lr / consolidate | ✅ |
| Domain bias ΔW (LoRA-style) | domain_bias / set_domain_bias / inject_distillation | ✅ |
| Online contrastive learning | cl_step | ✅ |
| Attention edge weights | attn_alpha/beta / set_attention | ✅ |
| TermNode + explainable card | mark_term / explain_card | ✅ |
| Incremental WAL | wal_* | ✅ |
| Bilingual alignment (Myers/LCS) | align_diff | ✅ |
| Active-learning candidates | active_learning_candidates | ✅ |
| Federated increment | fed_export / fed_import | ✅ |
| Neural-symbolic distillation (consume side) | inject_distillation | ✅ |
| #22 TM / TermBase | add_tm / fuzzy_match / concordance / load_tbx / enforce_terms / check_terms | ✅ (new) |
| S1 fuzzy-match upgrade | fuzzy_match(IDF + 2-gram + word-order)/ fuzzy_match_legacy | ✅ |
| Pure-MoonBit HTTP service | cmd/service:27 端点 + 记忆闭环 + 原子写持久化 + 重启恢复 | ✅ (new) |
| MCP Server (/mcp) | cmd/service/mcp.mbt:25 引擎能力 → MCP tools(spec 2025-11-25) | ✅ (new) |
| TMPlm 桥接 (M5) | retrieve_for_prompt + /api/retrieve_prompt(三段式) | ✅ (new) |
| SKILL.md 编排壳 | docs/skill/SKILL.md(agent_created,安装见 For Agents) | ✅ (new) |
| Translator workbench (web front-end) | cmd/service/web(四面板 + 记忆图谱) | ✅ (new,阶段 C 已交付) |
| Visual memory graph | web 第 4 面板(recall 节点 + via_edges 边 → SVG 确定性环布局) | ✅ (new) |
| S4 评测 / M1 风格 / M2 回译 / M3 冲突 | bleu_score/chrf_score/style_check/back_align/term_conflicts + 端点 | ✅ (new) |
| 风格一致报告 (风格一致) | style_report(记忆库句长/正式度分布 + 术语变体族 + 偏离建议)+ /api/style_report + MCP + web ⑧ 面板 | ✅ (new) |
| FedAvg / 蒸馏注入端点 | /api/fed_export /api/fed_import /api/distill_inject | 🔶 端点已落地,外部协调器/独立训练流仍缺 |
| # | Capability | Status | Notes |
|---|---|---|---|
| 1 | TM / TermBase first-class (fuzzy match %, concordance, TBX enforcement) | ✅ Done | moon test 175/175 (P6 hardening 后); reviewed + hardened (word-boundary, xml:lang); S1 fuzzy-match upgrade (IDF + 2-gram + word-order, R23–R25); open-code-review + MoA fixes for parse_tmx cross-language/</tu> split + mqm_tags cross-language false positives + empty-target/language-variant robustness; P0 长文 + 数字守门加固(MAX_TOKENS 截断 / numeric_consistency MQM 维度 / fuzzy_match 长 query 不崩 / L1–L12 长文回归); P4 fuzzy_match 抽公共 helper + drift_report.text_chrf_avg + MQM 严重度数值化; P6 last_body_oversize→Result enum 消 TOCTOU + NaN/Inf API 修正 + validate.mbt 同包。 |
| 2 | Quality estimation + MQM auto-eval | ✅ Done | qe_score (0.55·match + 0.30·term + 0.15·char) + mqm_tags (terminology/accuracy/fluency/omission w/ severity). Tested E1–E3. |
| 3 | Format-fidelity round-trip | ✅ Done | check_format_fidelity (missing/extra tag detection) + protect_tags (mask tags to __TAG__). Tested E4–E5. |
| 4 | Multimodal / screenshot translation | ✅ Done (OCR external stub) | ocr_image (external boundary) + align_regions (region ↔ TM align). Zero-dep engine speaks JSON at the OCR boundary; real OCR injected by host. Tested E6–E7. |
| 5 | Localization CI / batch pipeline | ✅ Done | batch_apply (Top-1 TM + term-gate, threshold-driven) → {total, passed, failed, items}. Tested E8–E9. |
| 6 | TMS interoperability | ✅ Done | parse_tmx / parse_xliff (XLIFF 1.2 <trans-unit> & 2.0 <unit>) + export_tmx (round-trip). Tested E10–E11; cross-language TMX correctness regression added as E14 (open-code-review fix). |
| 7 | Observability & drift monitoring | ✅ Done | metrics (tm/term counts + coverage) + drift_report (before/after snapshot diff). Tested E12–E13. |
This project is not packaged as a WorkBuddy skill yet. The dev loop for these is: research (Deep Research / WebSearch) → review (open-code-review) → verify (browser automation + moon test). MoA is intentionally not embedded inside the skill (kept as an external advisor).
2026-08 增补:随着项目演进,本节列出当前已声明对齐 / 仍属 roadmap 的国际/区域标准, 以及对应的本地化合规姿态。yimai 本身是技术构建块(library + local service)而非翻译服务 机构;本节为「adopter 集成指南」,非 ISO 认证声明。
| 标准 | yimai 映射 | 备注 |
|---|---|---|
| ISO 17100:2015 (Translation services) | observe / predict + reward 反馈闭环;retrieve_prompt 注入双语上下文 | 译员能力、项目管理、技术资源、反馈机制由 yimai 闭环支撑;adopter 仍需认证译员/项目流程 |
| ISO 18587:2017 (MT post-editing) | qe_auto(QE+MQM 标签)+ bleu / chrf 度量 | MTPE 工作流核心;数字守门 P0 加固后覆盖本地化高危硬伤 |
| ISO 30042:2019 / TBX3 (TermBase eXchange) | load_tbx 解析 ISO 30042-compliant <martif>/<termEntry> | TBX3 v3.0 dialect(非 TBX2 v2.0,namespace 不同) |
| ISO 11669:2024 (Translation projects — General guidance) | predict 逐步推荐 + consolidate 项目收尾复盘 | 完整标准(replaced ISO/TS 11669:2012) |
| ISO 5060:2024 (Translation services — Evaluation of translation output) | qe_auto / mqm_tags / drift_report.text_chrf_avg 三层指标覆盖 | 与 MQM Council 强对齐(MQM 官网声明 "Aligned with ISO 5060") |
| MQM Core (Lommel et al., 2014–present) | mqm_tags 7 维度标签 + 严重度数值(severity_score: None=0 / Minor=1 / Major=5 / Critical=10) | 权威背书:https://www.themqm.org/ |
| W3C ITS 2.0 (Internationalization Tag Set) | 由宿主 CMS/应用注入;protect_tags / mark_term 消费 in-text metadata | 不在引擎内;consume 边界由 adopter 决定 |
| MCP 2025-11-25 (Model Context Protocol) | /mcp 端点(Streamable HTTP + JSON-RPC 2.0) | 25 tools;2026-07-28 已发稳定版(无状态核心 / 移除 initialize 握手 / server/discover),但因纯本地无鉴权、现有 13 harness 均基于 2025-11-25 握手,yimai 停留在 2025-11-25(迁移 0.2.0 再议);已落实该版本的 Origin 头校验(DNS 重绑定防护) |
| Severity | yimai severity_score | Phrase penalty | Lokalise penalty (vs 100) | 用途 |
|---|---|---|---|---|
| None | 0 | 0 | 0 | 可接受变体,不扣分 |
| Minor | 1 | 1 | 5 | 局部小问题(拼写/标点) |
| Major | 5 | 5 | 25 | 影响理解(术语错/漏译) |
| Critical | 10 | 25 | 75 | 改变意义(negation flip / 数字错) |
⚠️ mqm_re_annotate 当前实现是 deterministic 自重审:因 qe_auto 算法本身确定性, re_severity == original_severity 恒成立,consistent: true。 端点接口与 JSON schema(re_annotated / critical_count / re_annotations 三段式)已 按 Google 2025-10-28 论文语义设计;多标注员模型(multi-rater / Cohen's κ / Krippendorff's α) 只需替换 mqm_re_annotate 内部循环即可,外部契约不变。
| 标准 | 为什么重要 | 状态 |
|---|---|---|
| TMX 1.4b | CAT-tool 互操作(Trados / memoQ / OmegaT) | parse_tmx / export_tmx 是 pub fn 但无 /api/* 入口 |
| XLIFF 2.1 / ISO 21720:2024 | 段级交换的事实标准(ISO 21720:2024 为第二版;OASIS XLIFF 2.2 2025-03 进入 CS) | parse_xliff 是 pub fn 但无入口 |
| SRX 2.0 | 跨工具段切规则可复现性 | 未声明;需 /api/import_srx |
| Harness | 配置入口 | 关键字段 |
|---|---|---|
| Claude Code | ~/.claude/mcp.json 或项目级 .mcp.json | mcpServers.yimai.{url,type:"http"} |
| Cursor | ~/.cursor/mcp.json | 同上 |
| Gemini CLI | ~/.gemini/settings.json | mcpServers.yimai.{url,type:"http"} |
AI agent 拆箱即用:克隆后先读 AGENTS.md(项目结构、构建/运行/消费指南、Windows 前置、MoonBit 坑、多 harness 接入),再跑 scripts/dev.ps1 一键起服务——无需人工配置。
安装为 WorkBuddy skill(可选):仓库内 docs/skill/SKILL.md 是编排手册(frontmatter 含 agent_created: true,触发词 + 26 端点 API 手册 + MCP 接入 + 数据契约)。复制到 ~/.workbuddy/skills/yimai-prophecy/ 并重启 WorkBuddy 后即成为可用技能。
cd yimai_prophecy_moonbit
moon test --target wasm-gc # green ⇒ engine is usable
cd cmd/main && moon build --target wasm-gc && moon run .{ "mcpServers": { "yimai": { "url": "http://127.0.0.1:8787/mcp" } } }pub struct MemoryNode {
id : String
text : String
mtype : String
vec : Map[String, Double]
created : Double
last_used : Double
use_count : Int
feedback : Double
edges : Map[String, Double]
predictive_value : Double
hit_count : Int
predict_count : Int
last_active : Double
is_term : Bool
translation : String
tm_toks : Array[String]
tm_ngrams : Map[String, Bool]
tm_toks_set : Map[String, Bool]
}pub struct ProphecyEngine {
memories : Map[String, MemoryNode]
transitions : Map[String, Map[String, Double]]
episodes : Array[Array[String]]
context : Array[String]
stats_preds : Int
stats_hits : Int
stats_remembers : Int
stats_evolutions : Int
seq : Int
last_pred : Array[String]
cur_episode : Array[String]
explore : Double
meta_hits : Array[Int]
snapshot : Map[String, MemoryNode]?
snap_trans : Map[String, Map[String, Double]]?
snap_role : Map[String, Map[String, Double]]?
role_trans : Map[String, Map[String, Double]]
role_index : Map[String, String]
role_members : Map[String, Array[String]]
trans2 : Map[String, Map[String, Double]]
domain_bias : Map[String, Double]
hebb_lr : Double
attn_alpha : Double
attn_beta : Double
pred_cache : Map[String, Json]
cache_epoch : Int
cl_buf : Array[Json]
wal_log : Array[String]
fed_add : Int
fed_upd : Int
clock : Double
tm_df : Map[String, Int]
tm_idf : Map[String, Double]
tm_idf_dirty : Bool
tm_count : Int
tm_postings : Map[String, Array[String]]
term_idx : Map[String, Array[String]]
term_idx_dirty : Bool
}fn ProphecyEngine::align_regions(self : ProphecyEngine, regions : Array[Json], threshold : Double) -> Jsonfn ProphecyEngine::batch_apply(self : ProphecyEngine, segments : Array[String], threshold : Double) -> Jsonfn ProphecyEngine::check_format_fidelity(_self : ProphecyEngine, source : String, target : String) -> Jsonfn ProphecyEngine::cl_step(self : ProphecyEngine, anchor : String, positive : String, negative : String) -> Unitfn ProphecyEngine::export_tmx(self : ProphecyEngine, src_lang? : String, tgt_lang? : String) -> Stringfn ProphecyEngine::fuzzy_match(self : ProphecyEngine, query : String, k : Int, threshold : Double, weights? : (Double, Double, Double, Double)) -> Jsonfn ProphecyEngine::fuzzy_match_full(self : ProphecyEngine, query : String, k : Int, threshold : Double) -> Jsonfn ProphecyEngine::fuzzy_match_legacy(self : ProphecyEngine, query : String, k : Int, threshold : Double) -> Jsonfn ProphecyEngine::load_tbx(self : ProphecyEngine, xml : String, src_lang? : String, tgt_lang? : String) -> Intfn ProphecyEngine::mqm_re_annotate(self : ProphecyEngine, source : String, target : String, match_rate : Double) -> Jsonfn ProphecyEngine::mqm_tags(_self : ProphecyEngine, source : String, target : String, _match_rate : Double, term_ok : Bool) -> Jsonfn ProphecyEngine::qe_auto(self : ProphecyEngine, source : String, target : String, match_rate : Double) -> Jsonfn ProphecyEngine::qe_score(_self : ProphecyEngine, source : String, target : String, match_rate : Double, term_ok : Bool) -> Doublefn ProphecyEngine::remember(self : ProphecyEngine, text : String, mtype : String, ctx : Array[String]) -> Stringfn ProphecyEngine::retrieve_for_prompt(self : ProphecyEngine, query : String, k : Int, threshold : Double) -> JsonInstall
Download zip译脉·先知 2.0 预知记忆网络引擎的 MoonBit 零依赖实现:带预测能力的记忆网络,支持可解释预测与语义召回。
Dependencies