@louisultra/dsh-verymath 0.0.0-stage → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +133 -0
- package/LICENSE +21 -0
- package/NOTICE.md +35 -0
- package/README.md +108 -2
- package/README_EN.md +105 -0
- package/UPSTREAM.json +106 -0
- package/cordis.patch.yml +12 -0
- package/docs/capability-examples.md +581 -0
- package/docs/examples/README.md +32 -0
- package/docs/examples/bad_scan.md +10 -0
- package/docs/examples/broken-proof.lean +9 -0
- package/docs/examples/claims.md +7 -0
- package/docs/examples/knapsack.json +10 -0
- package/docs/examples/matrix.json +1 -0
- package/docs/examples/points.csv +21 -0
- package/docs/examples/qp.json +8 -0
- package/docs/examples/research-ws/project/GOALS.yaml +4 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/report.md +13 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/reviews/r1.json +1 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/status.yaml +1 -0
- package/docs/examples/source.csv +4 -0
- package/lib/core/error.d.ts +20 -0
- package/lib/core/error.js +25 -0
- package/lib/core/gates.d.ts +42 -0
- package/lib/core/gates.js +217 -0
- package/lib/core/glossary.d.ts +101 -0
- package/lib/core/glossary.js +243 -0
- package/lib/core/graph.d.ts +118 -0
- package/lib/core/graph.js +460 -0
- package/lib/core/index.d.ts +120 -0
- package/lib/core/index.js +197 -0
- package/lib/core/paper.d.ts +163 -0
- package/lib/core/paper.js +73 -0
- package/lib/core/paths.d.ts +2 -0
- package/lib/core/paths.js +12 -0
- package/lib/core/sage.d.ts +61 -0
- package/lib/core/sage.js +212 -0
- package/lib/core/skills.d.ts +11 -0
- package/lib/core/skills.js +110 -0
- package/lib/tool/index.d.ts +21 -0
- package/lib/tool/index.js +1144 -0
- package/package.json +92 -4
- package/skills/after-ocr/SKILL.md +123 -0
- package/skills/after-ocr/references/audit-schema.md +94 -0
- package/skills/after-ocr/references/error-taxonomy.md +179 -0
- package/skills/after-ocr/scripts/merge_audit_logs.py +329 -0
- package/skills/after-ocr/scripts/scan_markdown_ocr.py +350 -0
- package/skills/after-ocr/tests/test_scripts.py +84 -0
- package/skills/discover-math-problems/SKILL.md +115 -0
- package/skills/discover-math-problems/references/artifact-contract.md +93 -0
- package/skills/discover-math-problems/references/autonomous-research-protocol.md +86 -0
- package/skills/discover-math-problems/references/conjecture-generation-protocol.md +63 -0
- package/skills/discover-math-problems/references/extremal-graph-variants.md +53 -0
- package/skills/graph-theory-paper-reading/SKILL.md +600 -0
- package/skills/invariant-computation/SKILL.md +169 -0
- package/skills/invariant-computation/examples/invariant_summary.example.json +51 -0
- package/skills/invariant-computation/manifest.yaml +46 -0
- package/skills/invariant-computation/references/INDEX.md +20 -0
- package/skills/invariant-computation/references/failure_modes.md +40 -0
- package/skills/invariant-computation/references/method_route_map.md +177 -0
- package/skills/invariant-computation/references/source_notes.md +19 -0
- package/skills/invariant-computation/references/tool_catalog.md +65 -0
- package/skills/invariant-computation/references/validation_checks.md +52 -0
- package/skills/invariant-computation/schema/invariant_summary.schema.json +260 -0
- package/skills/lean-formalization/SKILL.md +111 -0
- package/skills/lean-formalization/lean-runtime/config/env.example +5 -0
- package/skills/lean-formalization/lean-runtime/config/lean_agent.example.toml +28 -0
- package/skills/lean-formalization/lean-runtime/config/numina_runtime.example.toml +12 -0
- package/skills/lean-formalization/lean-runtime/examples/smoke/LocalLeanSmoke.lean +7 -0
- package/skills/lean-formalization/lean-runtime/prompts/complete_sorries.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/formalize_statement.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/prove_theorem.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/repair_lean_file.md +3 -0
- package/skills/lean-formalization/lean-runtime/references/backend_adapter_checklist.md +36 -0
- package/skills/lean-formalization/lean-runtime/references/direct_lean_workflow.md +48 -0
- package/skills/lean-formalization/lean-runtime/references/failure_taxonomy.md +17 -0
- package/skills/lean-formalization/lean-runtime/references/interactive_orchestration.md +83 -0
- package/skills/lean-formalization/lean-runtime/references/lean_agent_capability_map.md +116 -0
- package/skills/lean-formalization/lean-runtime/references/lean_lsp_mcp_adapter.md +219 -0
- package/skills/lean-formalization/lean-runtime/references/lean_runtime_configuration.md +92 -0
- package/skills/lean-formalization/lean-runtime/references/numina_reverse_analysis.md +80 -0
- package/skills/lean-formalization/lean-runtime/references/numina_runtime.md +41 -0
- package/skills/lean-formalization/lean-runtime/references/numina_subagent_troubleshooting.md +77 -0
- package/skills/lean-formalization/lean-runtime/references/review_checklist.md +10 -0
- package/skills/lean-formalization/lean-runtime/references/specialist_agent_patterns.md +65 -0
- package/skills/lean-formalization/lean-runtime/schemas/config.schema.json +12 -0
- package/skills/lean-formalization/lean-runtime/schemas/result.schema.json +33 -0
- package/skills/lean-formalization/lean-runtime/schemas/task.schema.json +30 -0
- package/skills/lean-formalization/lean-runtime/scripts/ai4m_lean.py +222 -0
- package/skills/lean-formalization/lean-runtime/scripts/check_lean_project.py +134 -0
- package/skills/lean-formalization/lean-runtime/scripts/common.py +296 -0
- package/skills/lean-formalization/lean-runtime/scripts/configure_lean.py +222 -0
- package/skills/lean-formalization/lean-runtime/scripts/detect_sorry.py +49 -0
- package/skills/lean-formalization/lean-runtime/scripts/direct_task.py +100 -0
- package/skills/lean-formalization/lean-runtime/scripts/extract_minimal_failure.py +74 -0
- package/skills/lean-formalization/lean-runtime/scripts/numina_runtime.py +414 -0
- package/skills/lean-formalization/lean-runtime/scripts/smoke_test.py +75 -0
- package/skills/lean-formalization/lean-runtime/scripts/tool_status.py +79 -0
- package/skills/lean-formalization/lean-runtime/scripts/validate_patch.py +81 -0
- package/skills/lean-formalization/lean-runtime/scripts/verify_delivery.py +484 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/after_bad.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/after_statement_changed.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/before.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/failure.lean +7 -0
- package/skills/lean-formalization/lean-runtime/tests/test_check_lean_project.py +59 -0
- package/skills/lean-formalization/lean-runtime/tests/test_cli.py +377 -0
- package/skills/lean-formalization/lean-runtime/tests/test_common_config.py +84 -0
- package/skills/lean-formalization/lean-runtime/tests/test_configure_lean.py +138 -0
- package/skills/lean-formalization/lean-runtime/tests/test_detect_sorry.py +24 -0
- package/skills/lean-formalization/lean-runtime/tests/test_direct_task.py +69 -0
- package/skills/lean-formalization/lean-runtime/tests/test_numina_runtime.py +168 -0
- package/skills/lean-formalization/lean-runtime/tests/test_validate_patch.py +29 -0
- package/skills/lean-setup/SKILL.md +99 -0
- package/skills/least-squares/README.md +85 -0
- package/skills/least-squares/SKILL.md +613 -0
- package/skills/least-squares/examples.md +380 -0
- package/skills/math-beamer/SKILL.md +325 -0
- package/skills/math-beamer/references/build-and-layout-audit.md +63 -0
- package/skills/math-beamer/references/math-domain-patterns.md +56 -0
- package/skills/math-beamer/references/template-policy.md +43 -0
- package/skills/math-beamer/references/template-source-index.md +51 -0
- package/skills/math-beamer/templates/catalog.yaml +235 -0
- package/skills/math-beamer/templates/packs/algebra-number-theory-talk/main.tex +45 -0
- package/skills/math-beamer/templates/packs/algebra-number-theory-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/algorithm-talk/main.tex +43 -0
- package/skills/math-beamer/templates/packs/algorithm-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/analysis-core-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/analysis-core-talk/template.yaml +19 -0
- package/skills/math-beamer/templates/packs/backup-heavy-talk/main.tex +40 -0
- package/skills/math-beamer/templates/packs/backup-heavy-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/beamerposter-a0/main.tex +45 -0
- package/skills/math-beamer/templates/packs/beamerposter-a0/template.yaml +12 -0
- package/skills/math-beamer/templates/packs/combinatorics-graph-talk/main.tex +53 -0
- package/skills/math-beamer/templates/packs/combinatorics-graph-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/control-systems-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/control-systems-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/course-lecture-zh/main.tex +43 -0
- package/skills/math-beamer/templates/packs/course-lecture-zh/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/data-experiment-results/main.tex +45 -0
- package/skills/math-beamer/templates/packs/data-experiment-results/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/dynamical-systems-talk/main.tex +42 -0
- package/skills/math-beamer/templates/packs/dynamical-systems-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/geometry-topology-talk/main.tex +43 -0
- package/skills/math-beamer/templates/packs/geometry-topology-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/information-coding-crypto-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/information-coding-crypto-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/logic-foundations-category-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/logic-foundations-category-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/numerical-analysis-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/numerical-analysis-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/optimization-talk/main.tex +58 -0
- package/skills/math-beamer/templates/packs/optimization-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/pde-analysis-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/pde-analysis-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/probability-statistics-talk/main.tex +52 -0
- package/skills/math-beamer/templates/packs/probability-statistics-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/reading-group-paper/main.tex +46 -0
- package/skills/math-beamer/templates/packs/reading-group-paper/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-en/main.tex +60 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-en/template.yaml +13 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-zh/main.tex +60 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-zh/template.yaml +13 -0
- package/skills/math-beamer/templates/packs/theorem-proof-talk/main.tex +60 -0
- package/skills/math-beamer/templates/packs/theorem-proof-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/thesis-defense/main.tex +42 -0
- package/skills/math-beamer/templates/packs/thesis-defense/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/workshop-tutorial/main.tex +32 -0
- package/skills/math-beamer/templates/packs/workshop-tutorial/template.yaml +9 -0
- package/skills/math-beamer/templates/preview-gallery.md +32 -0
- package/skills/math-beamer/templates/previews/algebra-number-theory-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/algebra-number-theory-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/algorithm-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/algorithm-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/analysis-core-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/analysis-core-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/backup-heavy-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/backup-heavy-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/beamerposter-a0-content.png +0 -0
- package/skills/math-beamer/templates/previews/beamerposter-a0-cover.png +0 -0
- package/skills/math-beamer/templates/previews/combinatorics-graph-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/combinatorics-graph-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/control-systems-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/control-systems-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/course-lecture-zh-content.png +0 -0
- package/skills/math-beamer/templates/previews/course-lecture-zh-cover.png +0 -0
- package/skills/math-beamer/templates/previews/data-experiment-results-content.png +0 -0
- package/skills/math-beamer/templates/previews/data-experiment-results-cover.png +0 -0
- package/skills/math-beamer/templates/previews/dynamical-systems-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/dynamical-systems-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/geometry-topology-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/geometry-topology-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/information-coding-crypto-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/information-coding-crypto-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/logic-foundations-category-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/logic-foundations-category-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/numerical-analysis-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/numerical-analysis-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/optimization-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/optimization-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/pde-analysis-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/pde-analysis-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/probability-statistics-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/probability-statistics-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/reading-group-paper-content.png +0 -0
- package/skills/math-beamer/templates/previews/reading-group-paper-cover.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-en-content.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-en-cover.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-zh-content.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-zh-cover.png +0 -0
- package/skills/math-beamer/templates/previews/theorem-proof-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/theorem-proof-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/thesis-defense-content.png +0 -0
- package/skills/math-beamer/templates/previews/thesis-defense-cover.png +0 -0
- package/skills/math-beamer/templates/previews/workshop-tutorial-content.png +0 -0
- package/skills/math-beamer/templates/previews/workshop-tutorial-cover.png +0 -0
- package/skills/math-beamer/templates/review-report.md +54 -0
- package/skills/math-beamer/templates/slide-source-ledger.md +22 -0
- package/skills/math-beamer/templates/source-packet.md +50 -0
- package/skills/math-glossary/SKILL.md +347 -0
- package/skills/math-glossary/references/glossary-schema.md +71 -0
- package/skills/math-glossary/references/glossary-usage-guide.md +176 -0
- package/skills/math-glossary/references/glossary-web-template.md +127 -0
- package/skills/math-glossary/references/glossary.schema.json +76 -0
- package/skills/math-glossary/references/user-manual.md +435 -0
- package/skills/math-glossary/requirements-ai.txt +3 -0
- package/skills/math-glossary/requirements.txt +3 -0
- package/skills/math-glossary/scripts/glossary_backup.py +42 -0
- package/skills/math-glossary/scripts/glossary_build.py +467 -0
- package/skills/math-glossary/scripts/glossary_enrich_examples.py +283 -0
- package/skills/math-glossary/scripts/glossary_export.py +333 -0
- package/skills/math-glossary/scripts/glossary_web.py +1265 -0
- package/skills/math-paper-reading/README.md +163 -0
- package/skills/math-paper-reading/SKILL.md +48 -0
- package/skills/math-paper-reading/agent_router.md +36 -0
- package/skills/math-paper-reading/references/proof_pattern_taxonomy.md +123 -0
- package/skills/math-paper-reading/references/quality_rubric.md +36 -0
- package/skills/math-paper-reading/skill_base.md +627 -0
- package/skills/math-paper-reading/skill_literature_search.md +866 -0
- package/skills/math-paper-reading/skill_paper_deep_read.md +1024 -0
- package/skills/math-paper-reading/skill_pathway_proof.md +718 -0
- package/skills/math-paper-reading/skill_reference_manager.md +746 -0
- package/skills/matlab-runner/SKILL.md +217 -0
- package/skills/matlab-runner/examples/README.md +33 -0
- package/skills/matlab-runner/examples/matrix_report.m +28 -0
- package/skills/matlab-runner/examples/plot_damped_sine.m +64 -0
- package/skills/matlab-runner/examples/test_vector_norm.m +12 -0
- package/skills/matlab-runner/references/client-setup.md +24 -0
- package/skills/matlab-runner/references/file-session-safety.md +86 -0
- package/skills/matlab-runner/references/numerical-safety.md +126 -0
- package/skills/matlab-runner/references/resource-safety.md +125 -0
- package/skills/mixed-integer-programming/SKILL.md +119 -0
- package/skills/mixed-integer-programming/lp-examples.md +251 -0
- package/skills/mixed-integer-programming/mip-examples-verified.md +118 -0
- package/skills/open-problem-research-pipeline/SKILL.md +76 -0
- package/skills/open-problem-research-pipeline/skill_literature_analysis.md +201 -0
- package/skills/open-problem-research-pipeline/skill_literature_proof_framework.md +206 -0
- package/skills/open-problem-research-pipeline/skill_literature_search.md +172 -0
- package/skills/open-problem-research-pipeline/skill_qskill.md +177 -0
- package/skills/osqp-solver/SKILL.md +245 -0
- package/skills/osqp-solver/references/citation.md +25 -0
- package/skills/osqp-solver/references/dual-infeasible-example.json +14 -0
- package/skills/osqp-solver/references/feasible-example.json +21 -0
- package/skills/osqp-solver/references/primal-infeasible-example.json +17 -0
- package/skills/osqp-solver/references/python-api.md +95 -0
- package/skills/osqp-solver/references/verification.md +94 -0
- package/skills/osqp-solver/scripts/check_osqp_environment.py +120 -0
- package/skills/osqp-solver/scripts/solve_qp.py +943 -0
- package/skills/paper-writing/SKILL.md +115 -0
- package/skills/paper-writing/skill_claim_evidence_ledger.md +55 -0
- package/skills/paper-writing/skill_formula_environment_and_readability.md +41 -0
- package/skills/paper-writing/skill_latex_build_and_layout_audit.md +73 -0
- package/skills/paper-writing/skill_notation_and_variable_consistency.md +42 -0
- package/skills/paper-writing/skill_paper_skeleton_and_logical_architecture.md +54 -0
- package/skills/paper-writing/skill_proof_obligation_and_assumption_audit.md +57 -0
- package/skills/paper-writing/templates/claim-evidence-ledger.md +23 -0
- package/skills/paper-writing/templates/proof-obligation-ledger.md +22 -0
- package/skills/paper-writing/templates/rapid-prototype-paper-skeleton.md +46 -0
- package/skills/paper-writing/templates/source-packet.md +37 -0
- package/skills/paper-writing/templates/submission-readiness.md +41 -0
- package/skills/proof-blueprint-review/SKILL.md +129 -0
- package/skills/proof-blueprint-review/references/agent-mediated-proof-protocol.md +57 -0
- package/skills/proof-blueprint-review/references/generation-agent.md +45 -0
- package/skills/proof-blueprint-review/references/proof-acceptance-contract.md +41 -0
- package/skills/proof-blueprint-review/references/verification-agent.md +37 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# 术语库使用指南(供第三方翻译 Agent 调用)
|
|
2
|
+
|
|
3
|
+
本文档面向需要调用本术语库进行翻译任务的 AI Agent,说明如何读取、查询、消歧和维护术语库。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 一、术语库文件位置
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<术语库目录>/
|
|
11
|
+
├── glossary.json ← 唯一事实源(读取此文件即可)
|
|
12
|
+
├── glossary_YYYY-MM-DD.xlsx ← Excel 导出(供人工审阅,Agent 无需读取)
|
|
13
|
+
│
|
|
14
|
+
├── 修改记录.md ← 网页端操作的变更日志
|
|
15
|
+
├── 扩充记录.md ← 批量扩充的变更日志
|
|
16
|
+
└── glossary_backup_<时间戳>.json ← 扩充流程手动备份
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Agent 只需读取 `glossary.json`。Web 与导入导出脚本保留在安装后的
|
|
20
|
+
`math-glossary/scripts/`,不复制到数据目录。
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 二、数据模型(关键字段速览)
|
|
25
|
+
|
|
26
|
+
每条术语的 JSON 结构:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"term_id": "manifold", // 唯一标识(en 小写;别名行加 __N 后缀)
|
|
31
|
+
"en": "manifold", // 英文原文
|
|
32
|
+
"cn": "流形", // 中文译名(或别名)
|
|
33
|
+
"idx": 321, // 连续序号
|
|
34
|
+
"pos": "名词", // 词性(中文)
|
|
35
|
+
"field": ["拓扑学"], // 子领域(数组,可多值)
|
|
36
|
+
"source": "新英汉数学词汇", // 来源参考书
|
|
37
|
+
"examples": [ // 例句,每个有 en + cn
|
|
38
|
+
{"en": "a smooth manifold", "cn": "光滑流形"}
|
|
39
|
+
],
|
|
40
|
+
"created_at": "2026-07-10",
|
|
41
|
+
"updated_at": "2026-07-10"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
完整字段定义见 `references/glossary-schema.md`。
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 三、翻译时的查词流程
|
|
50
|
+
|
|
51
|
+
### 3.1 基本查词
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
# 1. 读取
|
|
55
|
+
with open("glossary.json") as f:
|
|
56
|
+
terms = json.load(f)
|
|
57
|
+
|
|
58
|
+
# 2. 建索引(一次即可,建议缓存)
|
|
59
|
+
index = {t["term_id"]: t for t in terms}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3.2 精确匹配(优先级最高)
|
|
63
|
+
|
|
64
|
+
翻译时,对原文中识别到的英文术语,优先按 `term_id` 精确查找:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
def lookup(term: str, index: dict) -> dict | None:
|
|
68
|
+
"""精确匹配(大小写不敏感)"""
|
|
69
|
+
return index.get(term.lower())
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3.3 模糊匹配(精确匹配失败时)
|
|
73
|
+
|
|
74
|
+
如果原文中的术语在词库中不存在(可能是变体、复数、短语变体),按以下优先级尝试:
|
|
75
|
+
|
|
76
|
+
1. **词干匹配**:去掉末尾 `-s`/`-ing`/`-ed` 等后缀再查
|
|
77
|
+
2. **子串匹配**:在 `en` 字段中搜索原文是否为已知术语的一部分(如 `"smooth manifold"` → 匹配 `"manifold"`)
|
|
78
|
+
3. **别名匹配**:同一 `en` 下有多行时,`term_id` 无 `__N` 后缀的记录是主译名,
|
|
79
|
+
其他记录为别名行(`cn` 即为别名)。不要用排序后的物理行号判断主译名。搜索时
|
|
80
|
+
对所有 `cn` 做匹配。
|
|
81
|
+
|
|
82
|
+
### 3.4 field 上下文辅助
|
|
83
|
+
|
|
84
|
+
如果原文有章节标题或已知所属子领域(如"拓扑学""代数"),可先按 `field` 过滤候选术语再查,提高准确率。`field` 是数组,用 `in` 判断:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
candidates = [t for t in terms if "拓扑学" in t.get("field", [])]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 四、多义词消歧策略
|
|
93
|
+
|
|
94
|
+
当同一 `term_id` 有多行(含别名行),Agent 需根据翻译上下文自动选择:
|
|
95
|
+
|
|
96
|
+
### 策略 1:例句对比(最优先)
|
|
97
|
+
|
|
98
|
+
读取该术语(所有同 `en` 行)的 `examples` 数组,将原文上下文与例句对比,选择语义最接近的义项。
|
|
99
|
+
|
|
100
|
+
### 策略 2:field 匹配
|
|
101
|
+
|
|
102
|
+
如果原文上下文有明确的子领域标识(如章节名、前后文中的领域关键词),匹配 `field` 字段中的子领域。
|
|
103
|
+
|
|
104
|
+
### 策略 3:频率优先
|
|
105
|
+
|
|
106
|
+
同一 `en` 的多行中,`term_id` 无 `__N` 后缀的记录为主译名;它在按 `cn` 排序后
|
|
107
|
+
不一定排在物理第一行。无明确上下文时默认选择该记录。
|
|
108
|
+
|
|
109
|
+
### 消歧示例
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
原文: "A measure assigns a non-negative number to subsets."
|
|
113
|
+
上下文关键词: assign, non-negative, subsets
|
|
114
|
+
|
|
115
|
+
en: "measure" (有 1 行,无别名)
|
|
116
|
+
cn: "测度" ← field: 数学/测度论, examples 中有类似上下文 → 匹配 ✓
|
|
117
|
+
|
|
118
|
+
→ Agent 应选择 "测度"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 五、术语库维护约定(Agent 在翻译过程中发现新术语时)
|
|
124
|
+
|
|
125
|
+
翻译时如果遇到原文中的术语在术语库中不存在,Agent 可以:
|
|
126
|
+
|
|
127
|
+
1. 自行翻译该术语
|
|
128
|
+
2. 将新术语(含 en、cn、pos、field、source、原文例句)追加到 `glossary.json`
|
|
129
|
+
3. 写入后按 en → cn 排序 + 重新连续分配 idx
|
|
130
|
+
4. 重新导出 Excel(调用 `glossary_export.py export`)
|
|
131
|
+
|
|
132
|
+
**不要直接修改 Excel**,JSON 是唯一事实源。
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 六、示例 Python 翻译集成代码
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
"""翻译 Agent 集成术语库的最小示例"""
|
|
140
|
+
import json
|
|
141
|
+
|
|
142
|
+
def load_glossary(path="glossary.json") -> dict:
|
|
143
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
144
|
+
terms = json.load(f)
|
|
145
|
+
return {t["en"].lower(): t for t in terms}, terms
|
|
146
|
+
|
|
147
|
+
def translate_term(word: str, context: str = "", index: dict = None, all_terms: list = None) -> str:
|
|
148
|
+
"""根据上下文翻译单个术语"""
|
|
149
|
+
key = word.lower().strip()
|
|
150
|
+
term = index.get(key) if index else None
|
|
151
|
+
if not term:
|
|
152
|
+
return None # 未命中
|
|
153
|
+
|
|
154
|
+
# 如果只有单一含义(无别名行),直接返回
|
|
155
|
+
return term["cn"]
|
|
156
|
+
|
|
157
|
+
def _context_similarity(ctx: str, ex: str) -> float:
|
|
158
|
+
"""简单的上下文相似度(按共用词比例)"""
|
|
159
|
+
ctx_words = set(ctx.lower().split())
|
|
160
|
+
ex_words = set(ex.lower().split())
|
|
161
|
+
if not ex_words:
|
|
162
|
+
return 0.0
|
|
163
|
+
return len(ctx_words & ex_words) / len(ex_words)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 七、Excel 导出(人工审阅用)
|
|
169
|
+
|
|
170
|
+
翻译 Agent 不要直接修改 Excel。如需导出:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
python3 scripts/glossary_export.py export <glossary.json路径> <输出目录>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
生成的 `glossary_YYYY-MM-DD.xlsx` 含 10 列:序号、英文术语、中文译名、词性、子领域、来源、例句(英文)、例句(中文)、创建时间、更新时间。
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# 术语库 Web 管理界面说明
|
|
2
|
+
|
|
3
|
+
实现文件:`scripts/glossary_web.py`。它是单文件 Flask 应用,内嵌完整
|
|
4
|
+
HTML/CSS/JavaScript 前端。
|
|
5
|
+
|
|
6
|
+
## 启动
|
|
7
|
+
|
|
8
|
+
从 `math-glossary` package 根目录运行:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python3 scripts/glossary_web.py \
|
|
12
|
+
--glossary "/absolute/path/to/glossary.json"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
可选参数:
|
|
16
|
+
|
|
17
|
+
| 参数 | 默认值 | 说明 |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| `--host` | `127.0.0.1` | 监听地址 |
|
|
20
|
+
| `--port` | `7788` | 监听端口 |
|
|
21
|
+
| `--no-browser` | false | 不自动打开系统浏览器 |
|
|
22
|
+
| `--allow-remote` | false | 显式允许非 loopback 地址 |
|
|
23
|
+
|
|
24
|
+
界面没有用户认证。默认只在本机使用;不要为了方便直接绑定
|
|
25
|
+
`0.0.0.0`。如果确需远程访问,调用者必须理解网络暴露风险并显式添加
|
|
26
|
+
`--allow-remote`。
|
|
27
|
+
|
|
28
|
+
## 整体架构
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
glossary_web.py
|
|
32
|
+
├── configure() 路径解析与启动前验证
|
|
33
|
+
├── _load_terms/_save_terms() JSON 读取、原子写入与 Excel 刷新
|
|
34
|
+
├── REST API
|
|
35
|
+
│ ├── GET /api/terms
|
|
36
|
+
│ ├── GET /api/terms/<id>
|
|
37
|
+
│ ├── POST /api/terms
|
|
38
|
+
│ ├── PUT /api/terms/<id>
|
|
39
|
+
│ ├── DELETE /api/terms/<id>
|
|
40
|
+
│ ├── GET /api/stats
|
|
41
|
+
│ ├── GET /api/recent-changes
|
|
42
|
+
│ └── POST /api/shutdown
|
|
43
|
+
├── serve_frontend() 内嵌浏览器界面
|
|
44
|
+
└── main() CLI 与本地服务器入口
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`configure()` 从显式 `--glossary` 参数确定数据目录;`SKILL_BASE` 从脚本
|
|
48
|
+
安装位置推导。因此不需要复制脚本、修改源码或依赖某个客户端的安装目录。
|
|
49
|
+
|
|
50
|
+
## 数据一致性
|
|
51
|
+
|
|
52
|
+
每次写操作统一经过 `_save_terms()`:
|
|
53
|
+
|
|
54
|
+
1. 验证顶层为对象数组,且每条包含非空 `term_id`、`en`、`cn`;
|
|
55
|
+
2. 按 `en`、`cn` 排序;
|
|
56
|
+
3. 重新连续分配 `idx`;
|
|
57
|
+
4. 将 JSON 写入同目录临时文件并原子替换;
|
|
58
|
+
5. 原子生成当天的 Excel;
|
|
59
|
+
6. 新 Excel 成功后再删除其他日期的旧 Excel。
|
|
60
|
+
|
|
61
|
+
JSON 是唯一事实源,不要直接修改 Excel。
|
|
62
|
+
|
|
63
|
+
如果第 5 步因依赖或导出错误失败,API 仍返回成功的 JSON 写入结果,并附带
|
|
64
|
+
`warning: JSON 已完成,Excel 待完成`;旧 Excel 不会被删除。前端必须显示该
|
|
65
|
+
warning,不能把部分完成误报为三者已同步。
|
|
66
|
+
|
|
67
|
+
## 字段定制
|
|
68
|
+
|
|
69
|
+
如果将来更改 schema,需要同步审阅:
|
|
70
|
+
|
|
71
|
+
| 位置 | 责任 |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `create_term()` | 新增记录默认字段 |
|
|
74
|
+
| `update_term()` | 可修改字段白名单 |
|
|
75
|
+
| `list_terms()` | 搜索结果字段 |
|
|
76
|
+
| `showDetailView()` | 详情展示字段 |
|
|
77
|
+
| `enterEditMode()` | 编辑字段 |
|
|
78
|
+
| `submitEdit()` | 前端提交字段 |
|
|
79
|
+
| 新增弹窗 | 新增表单字段 |
|
|
80
|
+
|
|
81
|
+
字段变化属于 schema migration,不是简单换主题。更新前应先备份用户数据并补迁移
|
|
82
|
+
测试。
|
|
83
|
+
|
|
84
|
+
## 搜索与界面定制
|
|
85
|
+
|
|
86
|
+
当前搜索对 `en` 和 `cn` 做前缀匹配,`#` 返回非字母开头术语。修改搜索逻辑时,
|
|
87
|
+
更新 `list_terms()` 和相应测试。
|
|
88
|
+
|
|
89
|
+
标题、文案、颜色和字体都位于 `serve_frontend()` 的内嵌模板中。CSS 变量包括:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
--accent: #b91c1c;
|
|
93
|
+
--accent-light: #fef2f2;
|
|
94
|
+
--bg: #fcfcf9;
|
|
95
|
+
--text: #1c1c1c;
|
|
96
|
+
--border: #e8e5e0;
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
暗色模式、移动端布局和减少动画分别由对应的 CSS media query 控制。
|
|
100
|
+
|
|
101
|
+
## 关闭服务
|
|
102
|
+
|
|
103
|
+
优先在启动终端按 `Ctrl+C`。页面的关闭按钮只做 Werkzeug 开发服务器的
|
|
104
|
+
best-effort 请求;当前运行环境不提供关闭 hook 时,界面会提示回到终端停止,不会
|
|
105
|
+
调用立即终止进程的底层 API。
|
|
106
|
+
|
|
107
|
+
## 依赖与验证
|
|
108
|
+
|
|
109
|
+
先只读检查:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
python3 -c "import flask, openpyxl"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
缺失时,向用户说明用途并在获得确认后安装:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
python3 -m pip install -r requirements.txt
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
运行 package 测试:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python3 -m unittest discover -s tests -v
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
测试必须在临时目录中配置独立 `glossary.json`,不得指向用户正在使用的术语库。
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://verymath.org/schemas/math-glossary/glossary.schema.json",
|
|
4
|
+
"title": "VeryMath bilingual mathematical glossary",
|
|
5
|
+
"type": "array",
|
|
6
|
+
"items": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"required": [
|
|
9
|
+
"term_id",
|
|
10
|
+
"en",
|
|
11
|
+
"cn",
|
|
12
|
+
"created_at",
|
|
13
|
+
"updated_at"
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"term_id": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"minLength": 1
|
|
19
|
+
},
|
|
20
|
+
"en": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"minLength": 1
|
|
23
|
+
},
|
|
24
|
+
"cn": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1
|
|
27
|
+
},
|
|
28
|
+
"idx": {
|
|
29
|
+
"type": "integer",
|
|
30
|
+
"minimum": 1
|
|
31
|
+
},
|
|
32
|
+
"pos": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"field": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"items": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1
|
|
40
|
+
},
|
|
41
|
+
"uniqueItems": true
|
|
42
|
+
},
|
|
43
|
+
"source": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"examples": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"required": [
|
|
51
|
+
"en",
|
|
52
|
+
"cn"
|
|
53
|
+
],
|
|
54
|
+
"properties": {
|
|
55
|
+
"en": {
|
|
56
|
+
"type": "string"
|
|
57
|
+
},
|
|
58
|
+
"cn": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"additionalProperties": false
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"created_at": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
68
|
+
},
|
|
69
|
+
"updated_at": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"additionalProperties": false
|
|
75
|
+
}
|
|
76
|
+
}
|