Bounded example-guided string program synthesis, disagreement selection and portable recipes in MoonBit.

moon check --deny-warn
moon test --deny-warn
moon run cmd/demo
node scripts/build.mjs
node scripts/serve.mjs| 使用者与问题 | 输入与操作 | 输出与验证 |
|---|---|---|
| 小商家/运营整理供应商复合编码 | examples/products/input.csv;提供两个型号/颜色样例,分别选择规则 | 型号 0012、123456 等保留前导零,颜色转大写;另外两行不参与训练,逐值检查 |
| 活动组织者生成名单标签 | examples/labels/input.csv;用姓名、班级示范 A1 / 陈雨,另外复制编号字段 | 新行生成 C20 / 赵晨,编号不变;测试重排列后重用配方仍一致 |
| 内容创作者整理音视频文件 | examples/media/input.csv;标注两个日期和 take 编号 | 未见的 20240229 正确变为 2024-02-29;invalid.csv 中 20260229 报错并停止 CSV 导出 |
node scripts/integration.mjsnode bin/exampleloom.mjs learn --data examples/products/input.csv --examples examples/products/model-labels.json --out candidates.json
node bin/exampleloom.mjs recipe --report candidates.json --choose 0 --name model --out product.recipe.json
node bin/exampleloom.mjs apply --data examples/products/input.csv --recipe product.recipe.json --out product.result.csvlet report = @loom.synthesize([
{ input: ["订单-0012"], output: "0012" },
{ input: ["订单-123456"], output: "123456" },
])
// 先检查 report.truncated、候选表达式和 disagreements,再选择。
let output = @loom.evaluate(report.candidates[0].expression, ["订单-00987"])moon fmt --check
moon check --deny-warn --target all
moon test --deny-warn --target wasm-gc
moon test --deny-warn --target js
moon test --deny-warn --target wasm
moon infopub(all) struct SearchOptions {
max_candidates : Int
max_parts : Int
max_atom_evaluations : Int
max_steps : Int
max_frontier : Int
}fn handle(request : String) -> StringInstall
Download zipBounded example-guided string program synthesis, disagreement selection and portable recipes in MoonBit.