This release is a pre-release and may not be stable for production use.
pyuegc
An implementation of the Unicode algorithm for breaking strings of text (i.e., code point sequences) into extended grapheme clusters (“user-perceived characters”) as specified in UAX #29, “Unicode Text Segmentation”. This package supports version 14.0 of the Unicode Standard (released September 14, 2021). It has been successfully tested against the Unicode test file.
Installation
pip install pyuegc
UCD version
To get the version of the Unicode character database currently used:
>>> from pyuegc import UCD_VERSION
>>> UCD_VERSION
'14.0.0'
Example usage
from pyuegc import EGC
for s in ["e\u0301le\u0300ve", "Z̷̳̎a̸̛ͅl̷̻̇g̵͉̉o̸̰͒", "기운찰만하다"]:
egc = EGC(s)
print(f"{len(s):>2}, {len(egc)}: {egc}")
# 7, 5: ['é', 'l', 'è', 'v', 'e']
# 20, 5: ['Z̷̳̎', 'a̸̛ͅ', 'l̷̻̇', 'g̵͉̉', 'o̸̰͒']
# 15, 6: ['기', '운', '찰', '만', '하', '다']
s = "ai\u0302ne\u0301e" # aînée
print("".join(reversed(s)))
print("".join(reversed(EGC(s))))
# éen̂ia -> wrong (diacritics are messed up)
# eénîa -> right (regardless of the Unicode normalization form)
References
- https://www.unicode.org/versions/Unicode14.0.0/ch03.pdf#G52443
- https://unicode.org/reports/tr29/
- https://www.unicode.org/Public/14.0.0/ucd/auxiliary/GraphemeBreakProperty.txt
- https://www.unicode.org/Public/14.0.0/ucd/emoji/emoji-data.txt
- https://www.unicode.org/Public/14.0.0/ucd/auxiliary/GraphemeBreakTest.html
- https://www.unicode.org/Public/14.0.0/ucd/auxiliary/GraphemeBreakTest.txt
Licenses
The pyuegc library is released under an MIT license.
Usage of Unicode data files is governed by the Unicode Terms of Use, a copy of which is included as UNICODE-LICENSE.
Metadata
Release files for pyuegc 14.0.0rc2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyuegc-14.0.0rc2.tar.gz | 58.8 kB | Without provenance | Details for pyuegc-14.0.0rc2.tar.gz |
Release files / pyuegc-14.0.0rc2.tar.gz
| Download URL | pyuegc-14.0.0rc2.tar.gz |
|---|---|
| Size | 58.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
309a2f2ff17461a48a68caf432b8e399b5c15fba7ff320023555d310554cfd4c
|
|
BLAKE2b-256 checksum How to use checksums |
896b7b2946d2a2c50bf090f810c71d1b252dfead7238ce4b62e32b2bf1457889
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Security for pyuegc 14.0.0rc2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.