Skip to main content

khmercut

A (fast) Khmer word segmentation toolkit.

pip install khmercut

Python

from khmercut import tokenize

tokenize("ឃាត់ខ្លួនជនសង្ស័យ០៤នាក់ ករណីលួចខ្សែភ្លើង នៅស្រុកព្រៃនប់")
# => ['ឃាត់ខ្លួន', 'ជនសង្ស័យ', '០៤', 'នាក់', ' ', 'ករណី', 'លួច', 'ខ្សែភ្លើង', ' ', 'នៅ', 'ស្រុក', 'ព្រៃនប់']

Neural model

A distilled neural segmenter. More accurate, and it can split compound words.

pip install khmercut[nn]
from khmercut.nn import tokenize

tokenize("ឃាត់ខ្លួនជនសង្ស័យ០៤នាក់")
# => ['ឃាត់ខ្លួន', 'ជនសង្ស័យ', '០៤', 'នាក់']

tokenize("ឃាត់ខ្លួនជនសង្ស័យ០៤នាក់", deep=True)
# => [['ឃាត់', 'ខ្លួន'], ['ជន', 'សង្ស័យ'], ['០៤'], ['នាក់']]

With deep=True each word becomes a list of its sub-words. Spaces are returned as ' ' and newlines as '\n'.

Both backends load lazily, so importing one does not pull in the other.

Reference

Metadata

Release files for khmercut 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for khmercut 0.2.0
File Size Uploaded
khmercut-0.2.0.tar.gz 7.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for khmercut 0.2.0
File Interpreter ABI Platform
khmercut-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 MB

Release files / khmercut-0.2.0.tar.gz

Download URL khmercut-0.2.0.tar.gz
Size 7.8 MB
Tags Source
SHA-256 checksum
How to use checksums
6b0f07b898559ce74fd4e8adc12092c80cabe4d9fb69d7a52c01a5b84465daf6
BLAKE2b-256 checksum
How to use checksums
090ae1f08e2fc39586b67bed0c5776caccf31e184c25e11e6f794e943cc7ee5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / khmercut-0.2.0-py3-none-any.whl

Download URL khmercut-0.2.0-py3-none-any.whl
Size 7.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d92123f4d682ed976d3b5cb4491af8d753ded4f404493166cdd5f527771eac80
BLAKE2b-256 checksum
How to use checksums
1d51a999684cb54951c7798f2ac863940b31c2a1989ebc8105ef9bd38ebb3245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

1 release file

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page