Skip to main content

Khmer Spelling or Unicode Character Reordering based on the [khmer character specification](https://github.com/sillsdev/khmer-character-specification/blob/master/specification.md).

Project description

Khmer Spelling

Khmer Spelling or Unicode Character Reordering which corrects the ordering of Khmer unicode character by following the rule / specification in the khmer character specification.

Features

  1. khnormal: Fixes Khmer Unicode Character ordering or incorrect spelling. This work is cloned from specification's python script.
  2. ...

Installation

pip install khmerspell

Usage

To correct the spelling khmer text.

from khmerspell import khnormal

text = "ខ្ញំុជាស្រ្តីខ្មែរ" # wrong encoding ordering

encoded_text = khnormal(text)

print(encoded_text) # correct encoding ordering, according to the specification

Further more, you can print out each unicode character to see what has been changed, as following:

def get_hex_code_points(sentence):
    """
    Get the Unicode code points of each character in the token.
    """
    return [f"U+{ord(char):04X}" for char in sentence]

text = "ខ្ញំុជាស្រ្តីខ្មែរ"
# Print the text
print(text)

# Print unicode code of each character
print(get_hex_code_points(text))

# Encode the text
encoded_text = khnormal(text)

# Print the encoded text
print(encoded_text)

# Print the unicode code of each encoded character
print(get_hex_code_points(encoded_text))

Contribution

You are welcomed to contribute to this project so long as you abide by the license below. You can either create issues for us to fix or a PR for us to review.

License

Creative Commons License
Khmer Character Specification/Usages by SIL is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

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

khmerspell-0.1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

khmerspell-0.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: khmerspell-0.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for khmerspell-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6cd3cc90da938264e1753b6936c0cccff5fd6cd10e03524730cb6fe7834ffaca
MD5 92d8acb23d7b2cb3a8c62b95c1684878
BLAKE2b-256 24d330d78a95ea092c1d33ca196e0684061a26f370ebcd1d32e21a1f98c63561

See more details on using hashes here.

File details

Details for the file khmerspell-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: khmerspell-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for khmerspell-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 207e0304279a7e46e74f2abb45f322db2865cd262ab83698a34c80254b96dbf6
MD5 beb25c893a066889c977a9f1589560f0
BLAKE2b-256 c5c0f7f32239bf40bf50fb6e8963d798f7d54efdb4661febcdcbd6980265afa2

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