Skip to main content

A high-performance Korean Hangul syllable and jamo manipulation library with Rust backend

Project description

hangeul_jamo_rs

A high-performance Korean Hangul syllable and jamo manipulation library written in Rust with Python bindings.

Features

  • Fast decomposition/composition using pre-computed lookup tables
  • Dual API support: Both Rust and Python
  • Two jamo formats: HCJ (U+31xx) and U+11xx jamo
  • Compound jamo handling: Decompose/compose complex jamo characters

Installation

Rust

[dependencies]
hangeul_jamo = "0.1"

Usage

Rust

use hangeul_jamo::hcj::{decompose_hcj, compose_hcj};

// HCJ decomposition/composition
assert_eq!(decompose_hcj("한글"), "ㅎㅏㄴㄱㅡㄹ");
assert_eq!(compose_hcj("ㅎㅏㄴㄱㅡㄹ"), "한글");

// U+11xx jamo
use hangeul_jamo::jamo::{decompose_jamo, compose_jamo};
let jamo = decompose_jamo("한글");
assert_eq!(compose_jamo(&jamo), "한글");

// Compound jamo
use hangeul_jamo::core::{decompose_compound, compose_compound};
assert_eq!(decompose_compound('ㄲ'), Some(vec!['ㄱ', 'ㄱ']));
assert_eq!(compose_compound(&['ㄱ', 'ㄱ']), Some('ㄲ'));

API Reference

Core Functions

HCJ (Hangul Compatibility Jamo - U+31xx)

  • decompose_hcj(text) - Decompose syllables into HCJ jamo (한 → ㅎㅏㄴ)
  • compose_hcj(text) - Compose HCJ jamo into syllables (ㅎㅏㄴ → 한)

U+11xx Jamo

  • decompose_jamo(text) - Decompose syllables into U+11xx jamo
  • compose_jamo(text) - Compose U+11xx jamo into syllables

Character Checks

  • is_hangul_syllable(ch) - Check if character is Hangul syllable (U+AC00-U+D7A3)
  • is_hcj(ch) - Check if character is HCJ (U+31xx)
  • is_jamo(ch) - Check if character is U+11xx jamo
  • is_jamo_lead(ch) - Check if leading consonant
  • is_jamo_vowel(ch) - Check if vowel
  • is_jamo_tail(ch) - Check if trailing consonant
  • is_jamo_compound(ch) - Check if compound jamo (ㄲ, ㅘ, etc.)

Compound Jamo

  • decompose_compound(jamo) - Decompose compound jamo (ㄲ → [ㄱ, ㄱ])
  • compose_compound(components) - Compose into compound ([ㄱ, ㄱ] → ㄲ)

Conversion

  • jamo_to_hcj(ch) - Convert U+11xx jamo to HCJ (ᄀ → ㄱ)
  • hcj_to_jamo(ch, position) - Convert HCJ to U+11xx jamo (ㄱ → ᄀ)
    • position: "lead", "vowel", or "tail"

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

hangeul_jamo_rs-0.1.1.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

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

hangeul_jamo_rs-0.1.1-cp313-cp313-win_amd64.whl (158.7 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file hangeul_jamo_rs-0.1.1.tar.gz.

File metadata

  • Download URL: hangeul_jamo_rs-0.1.1.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hangeul_jamo_rs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 feef0cb74fd550536a83d5c72e33ca7616b369ad4a0dd8e48551b40105d21eb0
MD5 2a1090e7cbf4f77725b68a67ccdecaf5
BLAKE2b-256 dd886f5a1a89f39fc4941b2422733524685e46f817e29e07861b6cf3e2b9fed0

See more details on using hashes here.

File details

Details for the file hangeul_jamo_rs-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: hangeul_jamo_rs-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 158.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hangeul_jamo_rs-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 832714f597a91649535be8b51474d3e72e1604157218d25d65bbdc3feda2c589
MD5 15121aeb672d56e02409534904d67e95
BLAKE2b-256 8bc4ffe723840ab34576acbbf874dfe57355d82cfe9b071b6f4c09d525dfe9d9

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