cldr-language-helpers
Basically this projects was designed to provide a map of UTF8 Block Ranges to the locale/language code.
It uses cldr.unicode.org project as its reference.
Build
Clone the latest cldr release:
svn co http://www.unicode.org/repos/cldr/tags/release-34/ ./cldr-release-34
Tests
pip install -r requirements/dev.txt
Then run test:
pytest
Tests will also populate the cldr_language_helpers/data directory. Or you can use just run populate tests:
pytest -sm generate
API
from cldr_language_helpers.annotator import StringAnnotator
assert StringAnnotator('123').char_types_by_index == [{'numbers'}, {'numbers'}, {'numbers'}]
assert 'ru_RU' in StringAnnotator('ф').langs_by_index[0]
assert {'ru_RU', 'en_US', 'en', 'ru'}.issubset(StringAnnotator('йцу 123 qwe LOL').all_langs)
stats = StringAnnotator('qwe йцу').lang_stats
assert stats['ru_RU'] == 3
assert stats['ru'] == 3
assert stats['en'] == 3
assert stats['space'] == 1
assert 'en' in StringAnnotator('somesortof123').langs_intersection
assert StringAnnotator('somesortof123').char_types_intersection == set()
assert StringAnnotator('somesortof').char_types_intersection == {'auxiliary', 'main'}
assert StringAnnotator(' ').char_types_intersection == {'space'}
assert StringAnnotator('что-то everything как-то lol !').split_by_lang_intersection() == \
['что-то', ' ', 'everything', ' ', 'как-то', ' ', 'lol', ' ', '!']
assert StringAnnotator('somesortof123').split_by_lang_intersection() == ['somesortof123']
assert StringAnnotator('qwe, 123!!!').split_by_char_type() == \
['qwe', ',', ' ', '123', '!!!']
assert StringAnnotator('йцу 123 qwe LOL').has_langs('ru', 'en')
assert StringAnnotator().has_langs_throughout('ru') is False
assert StringAnnotator('йцу 123').has_langs_throughout('ru') is True
assert StringAnnotator('йцу 123').has_langs_throughout('ru_RU') is True
Metadata
Release files for cldr-language-helpers 1.2.0
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 |
|---|---|---|---|---|
| cldr-language-helpers-1.2.0.tar.gz | 314.2 kB | Without provenance | Details for cldr-language-helpers-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cldr_language_helpers-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for cldr_language_helpers-1.2.0-py3-none-any.whl |
Total release size: 641.5 kB
Release files / cldr-language-helpers-1.2.0.tar.gz
| Download URL | cldr-language-helpers-1.2.0.tar.gz |
|---|---|
| Size | 314.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14be0c35c6b5d5934635aa429fc60e9bb0fde3259838ace751429feed8d53578
|
|
BLAKE2b-256 checksum How to use checksums |
7c9f7dcfdcfe9ab7232d3e7c5b0575806182c00c4a76499e8f05c2a0e41ed948
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|
Release files / cldr_language_helpers-1.2.0-py3-none-any.whl
| Download URL | cldr_language_helpers-1.2.0-py3-none-any.whl |
|---|---|
| Size | 327.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f181ec1412fe67290420680274aadb4f264c84beb2bfc20c86fb485888d3cf73
|
|
BLAKE2b-256 checksum How to use checksums |
ee0e2423b2cb6a5eec77fc65dec952455ec4a4ede749886f395e19af1ffa6bc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|
Security for cldr-language-helpers 1.2.0
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.