# shimohq/chinese-programmer-wrong-pronunciation architecture

> Architecture diagram of the GitHub repository shimohq/chinese-programmer-wrong-pronunciation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shimohq/chinese-programmer-wrong-pronunciation
- Repository: https://github.com/shimohq/chinese-programmer-wrong-pronunciation

## Overview

This repository is a pronunciation reference for Chinese programmers, with a Chromium extension for playing pronunciations and searching a word without leaving the page. The main interaction is a reader selecting a word or audio link in the README table; extension code routes those actions to an embedded search or audio playback. A small Python helper fetches pronunciation data for new entries. The extension’s manifest and some integrations are present in the tree, but their wiring is not shown in the sampled source, so uncertain links are omitted.

Main entry points: [`tools/chromium_extension/js/app/components.js`](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/components.js) (Search Overlay), [`tools/chromium_extension/js/app/init.js`](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/init.js) (Page Interaction), [`tools/chromium_extension/js/app/box.js`](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/box.js) (Search Dispatch), [`README.md`](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/README.md) (Word Table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reference["Pronunciation Reference"]
  node_word_table["Word Table<br/>[README.md]"]
end

subgraph group_extension["Chromium Extension"]
  node_extension_manifest["Extension Manifest<br/>[manifest.json]"]
  node_content_script["Content Script<br/>[content-script.js]"]
  node_page_init["Page Interaction<br/>[init.js]"]
  node_search_dispatch["Search Dispatch<br/>[box.js]"]
  node_overlay["Search Overlay<br/>[components.js]"]
  node_dragging["Overlay Dragging<br/>[pretty-box.js]"]
  node_dom_helpers["DOM Helpers<br/>[utils.js]"]
  node_extension_styles["Overlay Styles<br/>[app.css]"]
  node_custom_box["Custom Box Element<br/>[x-custom-box.html]"]
end

subgraph group_lookup["Pronunciation Lookup"]
  node_search_urls["Search URL Builders<br/>[search-engine.js]"]
  node_pronunciation_services["Search Providers"]
  node_audio_services["Audio Links"]
  node_word_helper["Word Entry Helper<br/>[addword.py]"]
  node_youdao_dictionary["Youdao Dictionary"]
end

node_reader(("Reader"))

node_reader -->|"reads"| node_word_table
node_reader -->|"uses extension"| node_page_init
node_content_script -->|"loads and calls"| node_page_init
node_page_init -->|"handles table clicks"| node_word_table
node_page_init -->|"dispatches word"| node_search_dispatch
node_page_init -->|"plays linked audio"| node_audio_services
node_search_dispatch -->|"builds search URL"| node_search_urls
node_search_dispatch -->|"opens embedded search"| node_overlay
node_search_dispatch -->|"opens search URL"| node_pronunciation_services
node_overlay -->|"positions overlay"| node_dragging
node_overlay -->|"uses class helpers"| node_dom_helpers
node_dragging -->|"uses class helpers"| node_dom_helpers
node_overlay -->|"loads stylesheet"| node_extension_styles
node_overlay -->|"loads element markup"| node_custom_box
node_word_helper -->|"fetches pronunciations"| node_youdao_dictionary
node_word_helper -->|"prints entry row"| node_word_table

click node_word_table "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/README.md"
click node_extension_manifest "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/manifest.json"
click node_content_script "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/content-script.js"
click node_page_init "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/init.js"
click node_search_dispatch "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/box.js"
click node_search_urls "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/search-engine.js"
click node_overlay "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/components.js"
click node_dragging "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/pretty-box.js"
click node_dom_helpers "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/utils.js"
click node_extension_styles "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/css/app.css"
click node_custom_box "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/web-components/x-custom-box.html"
click node_word_helper "https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/addword.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_word_table toneBlue
class node_extension_manifest,node_content_script,node_page_init,node_search_dispatch,node_overlay,node_dragging,node_dom_helpers,node_extension_styles,node_custom_box toneAmber
class node_search_urls,node_pronunciation_services,node_audio_services,node_word_helper,node_youdao_dictionary toneMint
class node_reader toneIndigo
```

## Components

### Pronunciation Reference

- [Word Table](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/README.md): `README.md`

### Chromium Extension

- [Extension Manifest](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/manifest.json): `tools/chromium_extension/manifest.json`
- [Content Script](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/content-script.js): `tools/chromium_extension/js/content-script.js`
- [Page Interaction](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/init.js): `tools/chromium_extension/js/app/init.js`
- [Search Dispatch](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/box.js): `tools/chromium_extension/js/app/box.js`
- [Search Overlay](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/components.js): `tools/chromium_extension/js/app/components.js`
- [Overlay Dragging](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/pretty-box.js): `tools/chromium_extension/js/app/pretty-box.js`
- [DOM Helpers](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/utils.js): `tools/chromium_extension/js/app/utils.js`
- [Overlay Styles](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/css/app.css): `tools/chromium_extension/css/app.css`
- [Custom Box Element](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/web-components/x-custom-box.html): `tools/chromium_extension/web-components/x-custom-box.html`

### Pronunciation Lookup

- [Search URL Builders](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/chromium_extension/js/app/search-engine.js): `tools/chromium_extension/js/app/search-engine.js`
- **Search Providers**
- **Audio Links**
- [Word Entry Helper](https://github.com/shimohq/chinese-programmer-wrong-pronunciation/blob/master/tools/addword.py): `tools/addword.py`
- **Youdao Dictionary**

### Other components

- **Reader**

## Connections

- Reader → Word Table: reads (evidence: `README.md`)
- Reader → Page Interaction: uses extension (evidence: `README.md`)
- Content Script → Page Interaction: loads and calls (evidence: `tools/chromium_extension/js/content-script.js`)
- Page Interaction → Word Table: handles table clicks (evidence: `tools/chromium_extension/js/app/init.js`)
- Page Interaction → Search Dispatch: dispatches word (evidence: `tools/chromium_extension/js/app/init.js`)
- Page Interaction → Audio Links: plays linked audio (evidence: `tools/chromium_extension/js/app/init.js`)
- Search Dispatch → Search URL Builders: builds search URL (evidence: `tools/chromium_extension/js/app/box.js`)
- Search Dispatch → Search Overlay: opens embedded search (evidence: `tools/chromium_extension/js/app/box.js`)
- Search Dispatch → Search Providers: opens search URL (evidence: `tools/chromium_extension/js/app/box.js`)
- Search Overlay → Overlay Dragging: positions overlay (evidence: `tools/chromium_extension/js/app/components.js`)
- Search Overlay → DOM Helpers: uses class helpers (evidence: `tools/chromium_extension/js/app/components.js`)
- Overlay Dragging → DOM Helpers: uses class helpers (evidence: `tools/chromium_extension/js/app/pretty-box.js`)
- Search Overlay → Overlay Styles: loads stylesheet (evidence: `tools/chromium_extension/js/app/components.js`)
- Search Overlay → Custom Box Element: loads element markup (evidence: `tools/chromium_extension/js/app/components.js`)
- Word Entry Helper → Youdao Dictionary: fetches pronunciations (evidence: `tools/addword.py`)
- Word Entry Helper → Word Table: prints entry row (evidence: `tools/addword.py`)
