Skip to content

dimitori-g/phonetics-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hanzi (kanji) phonetics research

1. Create python virtual environments (optional)

  • Create

python3 -m venv venv
  • Activate

source venv/bin/activate
  • Deactivate

deactivate

2. Install requirements

pip install -r requirements.txt

3. Usage example

python3 phonetics.py 感

漢字音符画像

4. Phonetic Family Tree

Display complete phonetic family trees showing parent-child relationships between characters.

Usage

from phonetic_tree import show_phonetic_family

# Show the complete family tree for a character
glyph = "𬩆"
tree = show_phonetic_family(glyph)
print(tree)

Example output:

𡿧(zāi) --
         |
         |災(zāi) --
         |         |
         |         |𨉒(?)
         |
         |甾(zī zāi) --
         |         |
         |         |淄(zī) --
         |         |         |
         |         |         |𬩆(?)

Run demo:

python3 demo_phonetic_tree.py

The function automatically:

  • Finds the ancestor (root) of the entire family
  • Builds a hierarchical tree structure
  • Displays pinyin readings from readings.csv
  • Uses a recursive algorithm to handle multi-level relationships

5. Web Frontend (NEW!)

A beautiful web-based interface for exploring all 1,453 phonetic families interactively.

Features

  • 🔍 Search and filter by character or pinyin
  • 📈 Sort by ranking, family size, or name
  • 🌳 Interactive tree visualization
  • 📊 View all families with statistics
  • 📱 Responsive design for mobile and desktop

Quick Start

# Generate family data files (one-time setup)
python3 generate_family_data.py

# Start the web server
cd frontend
python3 serve.py

Then open your browser to: http://localhost:8000

See frontend/README.md for more details.

Top Families

  1. 向(xiàng) - 249 members
  2. 亡(wáng) - 233 members
  3. 囗(wéi) - 233 members
  4. 父(fù) - 228 members
  5. 隹(zhuī) - 225 members

Code style and test

  • Sort the imports

isort .
  • Format the code

black .
  • Check the code

flake8 .
  • Type checking

mypy .
  • Unit tests

pytest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors