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.0.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.0.tar.gz.
File metadata
- Download URL: hangul_keyboard-0.3.0.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 |
6274c5c01c88908b92e0993fc41b2814773418561400d48fa05ef79239e41138
|
|
| MD5 |
512add313d2f0ac7a9373bbfc2acdee2
|
|
| BLAKE2b-256 |
cdb000dcbc46d01f3908468465a834c0caada23abee2ff5fe0536bc6951b875b
|
File details
Details for the file hangul_keyboard-0.3.0-py3-none-any.whl.
File metadata
- Download URL: hangul_keyboard-0.3.0-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 |
db6af69f300fe051c53158ac256b2f1cd6833367750c66f3ff004aa63464b0cf
|
|
| MD5 |
08dcea85e063e8eb2234db1fd2d56f64
|
|
| BLAKE2b-256 |
8c33a04e6ecee9d0473291c0421eafd3a098b5318622a8e21558eb7ffee6ab66
|