Skip to main content

A lightweight Python library for looking up Korean Hanja characters with their 훈음 (Hun-eum) meanings and pronunciations

Project description

HanjaDict (한자사전)

PyPI version Python Versions License Downloads

A lightweight Python package for looking up Hanja (Chinese characters used in Korea) information, specifically focusing on 훈음 (hun-eum).

Installation

pip install hanjadict

Usage

import hanjadict

# Look up a Hanja character
result = hanjadict.lookup("雪")
print(result)
# Output: '눈 설'

# Check if a character is Hanja
is_hanja = hanjadict.is_hanja("雪")
print(is_hanja)
# Output: True

# Get only the pronunciation (음/音) part
pron = hanjadict.pronunciation("雪")
print(pron)
# Output: '설'

# Access the raw dictionary data
raw_data = hanjadict.table_data
print(len(raw_data))
# Output: 53458

# If the character is not found, returns None
result = hanjadict.lookup("xyz")
print(result)  # Output: None

Features

  • Fast lookups using a pre-compiled dictionary
  • Simple API with intuitive functions
  • Comprehensive dictionary of 53,458 characters
  • Lightweight with no external dependencies
  • Access to raw dictionary data for advanced usage

Available Functions

  • lookup(c): Get the full 훈음 information for a character
  • is_hanja(c): Check if a character is a valid Hanja in the dictionary
  • pronunciation(c): Extract only the Sino-Korean pronunciation (음/音) part
  • table_data: Access the raw dictionary data (as a Python dictionary)

What is 훈음 (Hun-eum)?

훈음 (訓音) refers to the combined Korean native word meaning (훈/訓) and Sino-Korean pronunciation (음/音) of a Hanja character. For example:

  • 雪 (눈 설): "눈" is the 훈 (native Korean word for "snow") and "설" is the 음 (Sino-Korean pronunciation)
  • 山 (메 산): "메" is the 훈 (native Korean word for "mountain") and "산" is the 음

This concept is unique to Korean language and helps learners understand both the meaning and pronunciation of Hanja characters.

Special Formats Handled

The pronunciation() function can handle various dictionary formats:

  • Normal format: "눈 설" → returns "설"
  • Comma-separated: "샘솟을 집, 샘솟을 설" → returns "집"
  • Slash-separated: "제비 연/잔치 연" → returns "연"
  • Parentheses: "영양 령(영)" → returns "령"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hanjadict-0.4.1.tar.gz (466.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hanjadict-0.4.1-py3-none-any.whl (481.5 kB view details)

Uploaded Python 3

File details

Details for the file hanjadict-0.4.1.tar.gz.

File metadata

  • Download URL: hanjadict-0.4.1.tar.gz
  • Upload date:
  • Size: 466.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for hanjadict-0.4.1.tar.gz
Algorithm Hash digest
SHA256 91d06b9fc64ab8b9a395485c52051910810df870f42c7d3921b97236d9033858
MD5 5e9d415e926ca5495e0c5e6d58d759d2
BLAKE2b-256 34342798d73b25660aa909fad0f87f0df2ebb6100027786ed1c1897aa875f6a5

See more details on using hashes here.

File details

Details for the file hanjadict-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: hanjadict-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 481.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for hanjadict-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5beaecdc8b57f4efc93cfc08c7814607d13db395dc2dcc6d702278dec6333ee
MD5 57a8e6f2b6efa0ed4669e0e78ac7828e
BLAKE2b-256 5ad6437dd3772e4881b4eb68c46d95212e5ea9b00675840f89d17faaa8f30e38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page