ESQ Builder
v0.1.4ESQ 1.0 题库包工具链(墨题刷题机):build(auto_fix) → validate(双轨校验) → upload/publish + kajweb 词表解析与热点词统计
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
esq_build_package Esq Build Package
校验并构建 ESQ 1.0 题库包 ZIP。
| Parameter | Type | Description |
|---|---|---|
answers * | object | {paperKey: {questionKey: {correctOption:"B", score: 2}}} —— 每空必填, correctOption 必须存在于该题选项 |
manifest * | object | {packageId, contentVersion, title, subject, publisher, license:{notice}, source:{description}} |
output_path * | string | 输出 ZIP 绝对路径 |
papers * | array | [{paperKey, year, units:[{unitKey, type(cloze|reading|part_b), title, sequence, passage?, candidates?, questions:[...]}]}] - cloze: passage.blocks[].text 用 {{blank:N}} 双花括号标记空位(不… |
auto_fix | boolean | true 时先自动修复机械性坑再构建——含中文的 externalKey 重建为 cn.xxx.y2021.u1 风格(answers 键同步改名)、单花括号 {blank:N} 转双花括号、 缺失 sequence 补… |
esq_validate_package Esq Validate Package
校验 ESQ 包(默认内置校验器, 与刷题机官方 esq.py 同规则)。
| Parameter | Type | Description |
|---|---|---|
zip_path * | string | ESQ 包路径 |
validator_path | 可选, 指定后改用官方校验器 CLI(backend/tools/validate_question_bank.py) subprocess 对账——默认内置实现已与其保持一致并由一致性测试守护 |
esq_upload_and_publish Esq Upload And Publish
上传 ESQ 包到刷题机后端并(可选)发布。上传前先 esq_validate_package。
| Parameter | Type | Description |
|---|---|---|
zip_path * | string | ESQ 包路径 |
base_url | string | 后端地址(默认 http://127.0.0.1:8765, 需先启动后端) |
profile_id | 题库 profile(不传则用后端当前激活级别) | |
publish | boolean | 是否发布(默认 true) |
esq_parse_wordlist Esq Parse Wordlist
解析 kajweb/dict 高频词表 JSONL(wordRank=真题词频排序)。
| Parameter | Type | Description |
|---|---|---|
jsonl_path * | string | kajweb book/*.zip 解压后的 JSONL 文件路径 |
level | 标注级别名(如 "四级·高频") | |
top_n | 只取前 N 个(如四级核心词取 1162) |
esq_hot_words Esq Hot Words
真题 passage 文本 → 热点词频统计(去停用词, [a-zA-Z][a-zA-Z'-]{3,})。
| Parameter | Type | Description |
|---|---|---|
texts * | array | [{year: 2024, text: "passage 正文"}, ...](或纯字符串列表) |
extra_stopwords | 额外停用词 | |
since_year | integer | 只统计该年份之后的真题(默认 2023, 即"近两年热点") |
top_n | integer | 取前 N 个(默认 300) |