Loading...
Loading...
Compare original and translation side by side
~/.claude/skills/book-metrics-generator/scripts/book-metrics-generator.sh~/.claude/skills/book-metrics-generator/scripts/book-metrics-generator.shdocs/docs/chapters/01-chapter-name/02-chapter-name/index.mddocs/learning-graph/docs/learning-graph/learning-graph.csvdocs/glossary.mddocs/faq.mddocs/sims/quiz.mddocs/docs/chapters/01-chapter-name/02-chapter-name/index.mddocs/learning-graph/docs/learning-graph/learning-graph.csvdocs/glossary.mddocs/faq.mddocs/sims/quiz.md./scripts/book-metrics-generator.shbash /path/to/skill/scripts/book-metrics-generator.shdocs/learning-graph/book-metrics.mddocs/learning-graph/chapter-metrics.mdmkdocs.ymlnav:
- Learning Graph:
- Book Metrics: learning-graph/book-metrics.md
- Chapter Metrics: learning-graph/chapter-metrics.md./scripts/book-metrics-generator.shbash /path/to/skill/scripts/book-metrics-generator.shdocs/learning-graph/book-metrics.mddocs/learning-graph/chapter-metrics.mdmkdocs.ymlnav:
- 学习图谱:
- 教材指标: learning-graph/book-metrics.md
- 章节指标: learning-graph/chapter-metrics.md./scripts/book-metrics-generator.sh path/to/custom/docs./scripts/book-metrics-generator.sh path/to/custom/docspython3 scripts/book-metrics.py docspython3 scripts/book-metrics.py docs| Category | Metric | Description |
|---|---|---|
| Structure | Chapters | Count of chapter directories with index.md files |
| Learning | Concepts | Number of concepts in learning-graph.csv |
| Learning | Glossary Terms | Count of defined terms (H2/H3 headers in glossary.md) |
| Learning | FAQs | Number of FAQ items (H2 headers in faq.md) |
| Assessment | Quiz Questions | Total quiz questions across all chapters |
| Visual | Diagrams | Count of H4 headers starting with "#### Diagram:" |
| Technical | Equations | LaTeX expressions using $ and $$ delimiters |
| Interactive | MicroSims | Directories in docs/sims/ with index.md files |
| Content | Total Words | All words in markdown files (excluding code and URLs) |
| Content | Links | Markdown-formatted hyperlinks text |
| Estimation | Equivalent Pages | Calculated pages based on words + visuals |
| 类别 | 指标 | 描述 |
|---|---|---|
| 结构 | 章节数 | 包含index.md文件的章节目录数量 |
| 学习 | 概念数 | learning-graph.csv中的概念数量 |
| 学习 | 术语表词条数 | 已定义的术语数量(glossary.md中的H2/H3标题) |
| 学习 | FAQ数量 | FAQ条目数量(faq.md中的H2标题) |
| 评估 | 测验题目数 | 所有章节的测验题目总数 |
| 可视化 | 图表数 | 以"#### Diagram:"开头的H4标题数量 |
| 技术 | 公式数 | 使用$和$$分隔符的LaTeX表达式数量 |
| 互动 | MicroSims数 | docs/sims/中包含index.md文件的目录数量 |
| 内容 | 总字数 | 所有Markdown文件中的字数(排除代码和URL) |
| 内容 | 链接数 | Markdown格式的超链接text数量 |
| 估算 | 等效页数 | 根据字数和可视化元素计算得出的页数 |
Pages = (Total Words ÷ 250) + (Diagrams × 0.25) + (MicroSims × 0.5)页数 = (总字数 ÷ 250) + (图表数 × 0.25) + (MicroSims数 × 0.5)| Column | Description |
|---|---|
| Chapter | Chapter number (leading zeros removed) |
| Name | Chapter title extracted from index.md H1 header |
| Sections | Count of H2 and H3 headers in chapter markdown files |
| Diagrams | Count of "#### Diagram:" headers in chapter |
| Words | Total word count for all markdown in the chapter |
| 列 | 描述 |
|---|---|
| 章节 | 章节编号(去除前导零) |
| 名称 | 从index.md的H1标题提取的章节标题 |
| 小节数 | 章节Markdown文件中的H2和H3标题数量 |
| 图表数 | 章节中的图表数量 |
| 字数 | 章节所有Markdown文件的总字数 |
docs/chapters/index.mddocs/learning-graph/learning-graph.csv^##^###glossary.md^##faq.md^##quiz.md^####\s+Diagram:\$[^$]+\$\$\$[^$]+\$\$docs/sims/index.md\[([^\]]+)\]\(([^)]+)\)docs/chapters/index.mddocs/learning-graph/learning-graph.csvglossary.md^##^###faq.md^##quiz.md^##^####\s+Diagram:\$[^$]+\$\$\$[^$]+\$\$docs/sims/index.md\[([^\]]+)\]\(([^)]+)\)\b\w+\b\b\w+\bBookMetricsGeneratordef count_new_metric(self) -> int:
"""Count the new metric.
Returns:
Number of items
"""
# Implementation here
passgenerate_book_metrics_md()new_metric = self.count_new_metric()md += f"| New Metric | {new_metric} | [Link](path) | Description |\n"BookMetricsGeneratordef count_new_metric(self) -> int:
"""统计新指标。
返回:
元素数量
"""
# 实现代码
passgenerate_book_metrics_md()new_metric = self.count_new_metric()md += f"| 新指标 | {new_metric} | [链接](path) | 描述 |\n"get_chapter_metrics()def get_chapter_metrics(self, chapter: Dict[str, Any]) -> Dict[str, Any]:
# Existing code...
# Add new metric
new_metric = self.count_new_metric_for_chapter(chapter)
return {
# Existing fields...
'new_metric': new_metric
}generate_chapter_metrics_md()md += "| Chapter | Name | ... | New Metric |\n"get_chapter_metrics()def get_chapter_metrics(self, chapter: Dict[str, Any]) -> Dict[str, Any]:
# 现有代码...
# 添加新指标
new_metric = self.count_new_metric_for_chapter(chapter)
return {
# 现有字段...
'new_metric': new_metric
}generate_chapter_metrics_md()md += "| 章节 | 名称 | ... | 新指标 |\n"
3. Add explanation in the "Metrics Explanation" section
3. 在“指标说明”部分添加解释undefinedundefinedundefinedundefined.github/workflows/metrics.ymlname: Generate Metrics
on:
push:
paths:
- 'docs/**/*.md'
jobs:
metrics:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate metrics
run: python3 scripts/book-metrics.py docs
- name: Commit metrics
run: |
git config user.name "GitHub Actions"
git add docs/learning-graph/book-metrics.md
git add docs/learning-graph/chapter-metrics.md
git commit -m "Update metrics" || exit 0
git push.github/workflows/metrics.ymlname: Generate Metrics
on:
push:
paths:
- 'docs/**/*.md'
jobs:
metrics:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate metrics
run: python3 scripts/book-metrics.py docs
- name: Commit metrics
run: |
git config user.name "GitHub Actions"
git add docs/learning-graph/book-metrics.md
git add docs/learning-graph/chapter-metrics.md
git commit -m "Update metrics" || exit 0
git pushdocs/chapters/index.mdNN-chapter-name/docs/chapters/index.mdNN-chapter-name/docs/learning-graph/learning-graph.csvdocs/learning-graph/learning-graph.csvdocs/learning-graph/python3docs/learning-graph/python3docs/docs/BookMetricsGeneratorBookMetricsGenerator| Metric Name | Value | Link | Notes |
|-------------|-------|------|-------|
| Chapters | 12 | [Chapters](../chapters/) | Number of chapter directories |
| Concepts | 200 | [Learning Graph](learning-graph.csv) | Concepts from learning graph |
| Total Words | 45,000 | - | Words in all markdown files |
| Equivalent Pages | 195 | - | Estimated pages (250 words/page + visuals) || 指标名称 | 数值 | 链接 | 说明 |
|-------------|-------|------|-------|
| 章节数 | 12 | [章节](../chapters/) | 章节目录数量 |
| 概念数 | 200 | [学习图谱](learning-graph.csv) | 来自学习图谱的概念数量 |
| 总字数 | 45,000 | - | 所有Markdown文件中的字数 |
| 等效页数 | 195 | - | 估算页数(每页250字 + 可视化元素) || Chapter | Name | Sections | Diagrams | Words |
|---------|------|----------|----------|-------|
| 1 | Introduction to Geometry | 8 | 3 | 3,200 |
| 2 | Points and Lines | 12 | 7 | 4,100 |
| 3 | Angles and Triangles | 15 | 12 | 5,500 || 章节 | 名称 | 小节数 | 图表数 | 字数 |
|---------|------|----------|----------|-------|
| 1 | 几何入门 | 8 | 3 | 3,200 |
| 2 | 点与线 | 12 | 7 | 4,100 |
| 3 | 角与三角形 | 15 | 12 | 5,500 |