Skip to main content

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


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)

Uploaded Source

Built Distribution

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

khmer_keyboard-0.1.1-py3-none-any.whl (21.6 MB view details)

Uploaded Python 3

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

Hashes for khmer_keyboard-0.1.1.tar.gz
Algorithm Hash digest
SHA256 75e914fbe7423a4343442b81410540af52c8201f7ed1f75b68b6da9367e5f66a
MD5 b0a53516dbc9787f6a752e625c24af25
BLAKE2b-256 e4ff219d127150c83c997d74b3de7ec82c1d22c37a826d91c7cb2cebe813482c

See more details on using hashes here.

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

Hashes for khmer_keyboard-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7bd31ce8bf6ad2f1cf70cfa0b5f45e750d66cbade6a8703176876929a0874eba
MD5 d304b8c1ff2e5fa313c3f68e0f89bc2c
BLAKE2b-256 03803a8309c080ed07808e654f5ece13746248bef4b6f4b721ac5488128ce2bf

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