Khmer Keyboard Prediction Engine
Project description
Khmer Keyboard Prediction Engine
Lightweight Khmer keyboard prediction engine for offline/mobile usage.
Features
- Next-word prediction (trigram + bigram fallback)
- Prefix suggestion
- Spell correction (Levenshtein + unigram frequency)
- Bundled Khmer model (
model.msgpack) in package
Installation
From PyPI:
pip install khmer-keyboard
From local source:
pip install .
Quick Usage
from khmer_keyboard import KhmerKeyboardEngine
# Uses bundled khmer_keyboard/data/model.msgpack
engine = KhmerKeyboardEngine()
# 1) Unified API while typing
print(engine.predict(current_prefix="ស"))
# 2) Unified API after finishing words (context-based next word)
print(engine.predict(context_words=["ខ្ញុំ", "ចង់"]))
# 3) Direct next-word prediction
print(engine.predict_next("ខ្ញុំ", "ចង់", top_n=5))
# 4) Prefix suggestions
print(engine.suggest_prefix("ស", top_n=5))
# 5) Spell correction candidates
print(engine.correct_word("ក្មុពជា", top_n=3))
Load External Model (Optional)
If you want to use your own .msgpack model:
from khmer_keyboard import KhmerKeyboardEngine
engine = KhmerKeyboardEngine(model_path="path/to/model.msgpack")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
khmer_keyboard-0.1.1.tar.gz
(21.2 MB
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 khmer_keyboard-0.1.1.tar.gz.
File metadata
- Download URL: khmer_keyboard-0.1.1.tar.gz
- Upload date:
- Size: 21.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75e914fbe7423a4343442b81410540af52c8201f7ed1f75b68b6da9367e5f66a
|
|
| MD5 |
b0a53516dbc9787f6a752e625c24af25
|
|
| BLAKE2b-256 |
e4ff219d127150c83c997d74b3de7ec82c1d22c37a826d91c7cb2cebe813482c
|
File details
Details for the file khmer_keyboard-0.1.1-py3-none-any.whl.
File metadata
- Download URL: khmer_keyboard-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd31ce8bf6ad2f1cf70cfa0b5f45e750d66cbade6a8703176876929a0874eba
|
|
| MD5 |
d304b8c1ff2e5fa313c3f68e0f89bc2c
|
|
| BLAKE2b-256 |
03803a8309c080ed07808e654f5ece13746248bef4b6f4b721ac5488128ce2bf
|