Package Exports
- @seyoungsong/hanjadict
- @seyoungsong/hanjadict/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@seyoungsong/hanjadict) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
HanjaDict (한자사전)
A lightweight JavaScript/TypeScript package for looking up Hanja (Chinese characters used in Korea) information, specifically focusing on 훈음 (hun-eum).
Installation
npm install hanjadict
# or
yarn add hanjadict
Usage
import { lookup, isHanja, pronunciation, tableData } from "hanjadict"
// Look up a Hanja character
const result = lookup("雪")
console.log(result)
// Output: '눈 설'
// Check if a character is Hanja
const isHanjaChar = isHanja("雪")
console.log(isHanjaChar)
// Output: true
// Get only the pronunciation (음/音) part
const pron = pronunciation("雪")
console.log(pron)
// Output: '설'
// Access the raw dictionary data
console.log(Object.keys(tableData).length)
// Output: 53458
// If the character is not found, returns null
const notFound = lookup("xyz")
console.log(notFound) // Output: null
Features
- Fast lookups using a pre-compiled dictionary
- Simple API with intuitive functions
- Comprehensive dictionary of 53,458 characters
- Lightweight with no external dependencies
- TypeScript support
- Access to raw dictionary data for advanced usage
Available Functions
lookup(c)
: Get the full 훈음 information for a characterisHanja(c)
: Check if a character is a valid Hanja in the dictionarypronunciation(c)
: Extract only the Sino-Korean pronunciation (음/音) parttableData
: Access the raw dictionary data (as a JavaScript object)
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 "령"