Maintenance de l'index des Kanji

VérifiéSûr

Guide pour maintenir l'index des kanji incluant l'assignation d'IDs, les mises à jour d'index et le dépannage.

Spar Skills Guide Bot
DeveloppementIntermédiaire
4002/06/2026
Claude CodeCursorWindsurf
#kanji#index#dictionary#maintenance#japanese

Recommandé pour

Notre avis

Ce skill permet de maintenir un index de kanji pour un dictionnaire japonais, incluant l'assignation d'identifiants et la reconstruction des fichiers.

Points forts

  • Automatisation des tâches via des scripts Python.
  • Format d'ID structuré avec lecture et glossaire.
  • Guide de dépannage détaillé pour les problèmes courants.

Limites

  • Nécessite des connaissances en lectures on'yomi et kun'yomi.
  • L'assignation des ID est semi-manuelle.
  • Dépend de l'outil build/update_kanji_index.py.
Quand l'utiliser

Utilisez ce skill lorsque vous devez ajouter de nouveaux kanji à l'index ou résoudre des problèmes d'affichage de liens kanji.

Quand l'éviter

Ne l'utilisez pas pour des modifications de contenu de dictionnaire qui n'impliquent pas de nouveaux kanji.

Analyse de sécurité

Sûr
Score qualité92/100

The skill describes a workflow using local Python build scripts and manual editing of JSON files for a specific project's kanji index maintenance. There is no instruction for executing destructive commands, exfiltrating data, disabling safety, or downloading remote code. The use of bash and Python is legitimate and confined to project-specific build tasks.

Aucun point d'attention détecté

Exemples

Add a new kanji to the index
Add the kanji 新 to the kanji index. Assign its ID as '00123_shin_atara_new' with on'yomi 'shin', kun'yomi 'atara', and gloss 'new'. Update kanji_list.json and rebuild.
Check for missing kanji
Run the check for new kanji in the dictionary and report any kanji that need IDs assigned.
Rebuild all kanji HTML pages
Rebuild all kanji HTML pages from the JSON files using the build_kanji_html.py script.

name: kanji-index description: Guidelines for maintaining the kanji index feature. Covers kanji ID assignment, index updates, and troubleshooting.

Kanji Index Maintenance

The kanji index allows users to click on any kanji in a dictionary headword to find all other entries containing that same kanji.

How It Works

  1. Headword kanji are linked to kanji index pages
  2. Kanji index pages list all entries containing that kanji
  3. Entry lists are sorted by reading (hiragana order)

Directory Structure

kanji/
├── kanji_list.json       # Master list: kanji → kanji_id mapping
├── kanji_extracted.json  # Temporary: extracted kanji needing IDs
├── 00001_jin_hito_person.json  # Entry list for 人
├── 00002_nichi_hi_day.json     # Entry list for 日
└── ...

docs/kanji/
├── 00001_jin_hito_person.html  # HTML page for 人
├── 00002_nichi_hi_day.html     # HTML page for 日
└── ...

Kanji ID Format

Format: {5-digit}_{onyomi}_{kunyomi}_{gloss}

  • 5-digit: Sequential number (00001, 00002, ...)
  • onyomi: Most common on'yomi in romaji (or "none")
  • kunyomi: Most common kun'yomi in romaji without okurigana (or "none")
  • gloss: Single English word for primary meaning

Examples

| Kanji | Kanji ID | |-------|----------| | 人 | 00001_jin_hito_person | | 日 | 00002_nichi_hi_day | | 大 | 00003_dai_oo_big | | 畑 | 00004_none_hatake_field | | 茶 | 00005_cha_none_tea |

Romaji Rules

  • Long vowels: "ou" not "ō" (e.g., 高 → "kou")
  • Voiced: "ga", "za", "da", "ba" (e.g., 学 → "gaku")
  • No okurigana in kun'yomi (e.g., 高い → "taka", not "takai")

Assigning New Kanji IDs

When new entries introduce kanji not in kanji_list.json:

  1. Detect new kanji:

    python3 build/update_kanji_index.py --check-new
    
  2. Assign readings and gloss using your knowledge:

    • Most common on'yomi
    • Most common kun'yomi (without okurigana)
    • Single-word English gloss
  3. Update kanji_list.json:

    {
      "新": {
        "kanji_id": "00123_shin_atara_new",
        "onyomi": "shin",
        "kunyomi": "atara",
        "gloss": "new"
      }
    }
    
  4. Rebuild:

    python3 build/build_flat.py
    

Common Tasks

Check for New Kanji

python3 build/update_kanji_index.py --check-new

Rebuild All Kanji JSON Files

python3 build/update_kanji_index.py --rebuild-all

Rebuild Kanji HTML Pages

python3 build/build_kanji_html.py

Full Site Build (includes kanji)

python3 build/build_flat.py

Troubleshooting

"Warning: X kanji need IDs assigned"

New kanji were found in entries. Assign IDs manually:

  1. Run --check-new to see the full list
  2. For each kanji, determine on'yomi, kun'yomi, gloss
  3. Add to kanji/kanji_list.json
  4. Rebuild

Missing kanji index page

Check that:

  1. Kanji is in kanji/kanji_list.json
  2. JSON file exists: kanji/{kanji_id}.json
  3. Run python3 build/build_kanji_html.py

Kanji link not appearing in headword

Check that:

  1. Kanji is in kanji/kanji_list.json
  2. Entry HTML was rebuilt after kanji was added

Entry count wrong on kanji page

Rebuild the kanji JSON file:

python3 build/update_kanji_index.py --rebuild-all
python3 build/build_kanji_html.py

File Formats

kanji_list.json

{
  "metadata": {
    "description": "Index mapping kanji characters to their kanji index IDs",
    "generated": "2026-01-22T10:30:00Z",
    "total_kanji": 1500
  },
  "kanji": {
    "人": {
      "kanji_id": "00001_jin_hito_person",
      "onyomi": "jin",
      "kunyomi": "hito",
      "gloss": "person"
    }
  }
}

Individual kanji JSON

{
  "metadata": {
    "kanji": "人",
    "kanji_id": "00001_jin_hito_person",
    "onyomi": "jin",
    "kunyomi": "hito",
    "gloss": "person",
    "entry_count": 245,
    "generated": "2026-01-22T10:30:00Z"
  },
  "entries": [
    {
      "id": "01234_akunin",
      "headword": "{悪|あく}{人|にん}",
      "reading": "あくにん",
      "gloss": "villain, bad person"
    }
  ]
}

Design Decisions

Why invisible links?

  • Preserves clean headword appearance
  • Users discover feature through tooltip
  • No visual clutter

Why romaji in kanji IDs?

  • ASCII-safe file names
  • Human-readable
  • Easy to search and sort

Why sort by reading?

  • Natural Japanese ordering (gojuon)
  • Consistent with how dictionaries organize entries
  • Helps users find related words
Skills similaires