Korean Hangul keyboard-based English to Korean converter
Project description
hangul-keyboard
A Python package for converting Roman keyboard input to Korean Hangul automatically.
Features
- Automatic Roman → Hangul conversion
- Korean input auto-detection (returns as-is if already Hangul)
- 2-Set Korean keyboard layout support
- Double consonants/vowels support (ㄲ, ㅃ, ㄳ, etc.)
- Decompose Hangul into jamo sequences (list or string) for search and LLM preprocessing
- Perfect for search systems, autocomplete, and text analysis
Installation
pip install hangul-keyboard
Project Structure
hangul-keyboard/
├── hangul_keyboard/
│ ├── __init__.py
│ ├── core.py # Core conversion logic
│ └── mapping.py # Roman-to-Jamo mapping tables
├── tests/
│ ├── __init__.py
│ ├── test_core.py # Unit tests for core.py
│ ├── test_mapping.py # Unit tests for mapping.py
│ └── test_integration.py # Integration tests
├── README.md
├── setup.py (or pyproject.toml)
└── requirements.txt
Quick Start
from hangul_keyboard import convert_roman_to_hangul, decompose_hangul_full, decompose_hangul_str
# Basic usage
result = convert_roman_to_hangul("dkssud")
print(result) # Output: "한글"
# Already Hangul - returns as-is
result = convert_roman_to_hangul("한글")
print(result) # Output: "한글"
# Mixed with numbers and special characters
result = convert_roman_to_hangul("rk123!")
print(result) # Output: "가123!"
# Decompose into jamo list (full)
jamo_list = decompose_hangul_full("한글")
print(jamo_list) # Output: ['ㅎ', 'ㅏ', 'ㄴ', 'ㄱ', 'ㅡ', 'ㄹ']
# Decompose into jamo string
jamo_str = decompose_hangul_str("한글")
print(jamo_str) # Output: "ㅎㅏㄴㄱㅡㄹ"
Testing
# Run all tests
python -m pytest tests/ -v
# Run specific test file
python -m pytest tests/test_core.py -v
python -m pytest tests/test_mapping.py -v
python -m pytest tests/test_integration.py -v
# Or use unittest
python -m unittest tests.test_core -v
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
hangul_keyboard-0.3.1.tar.gz
(6.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hangul_keyboard-0.3.1.tar.gz.
File metadata
- Download URL: hangul_keyboard-0.3.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3eab6bb5a01815efa8b5c732438111d2d708cd257f66f4f22b48630e8959366
|
|
| MD5 |
5a1ec5a644b317ba4b57d49429916e90
|
|
| BLAKE2b-256 |
255bfd42af1989f597fdafd5f6b968e6f23a71ddb0838fe0f92a9df4b8c49a78
|
File details
Details for the file hangul_keyboard-0.3.1-py3-none-any.whl.
File metadata
- Download URL: hangul_keyboard-0.3.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77a6a312749a7350ec413e4cb1cddf8cc8d03cb5a6d466d0fbd5f9c29579c339
|
|
| MD5 |
27a9f291625a74903465595e3ad757f8
|
|
| BLAKE2b-256 |
2889767d5d1113acf8d82bf922969d3bc85f455760e8abbc163619c8e6721460
|