fold_to_ascii
A Python port of the Apache Lucene ASCII Folding Filter that converts alphabetic, numeric, and symbolic Unicode characters which are not in the first 127 ASCII characters (the "Basic Latin" Unicode block) into ASCII equivalents, if they exist.
Usage
> from fold_to_ascii import fold
> s = u'Astroturf® paté'
> fold(s)
u'Astroturf pate'
> fold(s, u'?')
u'Astroturf? pate'
Differences from JS fold-to-ascii
This library always removes astral characters, even when a replacement character is specified. PRs welcome if you want to fix this.
Differences from unidecode
There are a few Python unidecode libraries out there
(1,
2). They are based on a Perl program
that makes some interesting choices about what to replace, for example, £
(POUND SIGN) is replaced with the string PS. Also, they do not allow
specifying a replacement character to use other than the empty string for
unmapped characters.
Development environment
$ virtualenv -p python3 ~/.local/venvs/fold_to_ascii
$ source ~/.local/venvs/fold_to_ascii/bin/activate
$ pip install -r requirements.txt
Test
$ make lint && make test
Release
Requires a pypi account.
- Bump the version in setup.py.
- Build and upload:
$ python setup.py sdist bdist_wheel
$ twine upload dist/*
Metadata
Release files for fold-to-ascii 1.0.2.post1
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 |
|---|---|---|---|---|
| fold_to_ascii-1.0.2.post1.tar.gz | 22.7 kB | Without provenance | Details for fold_to_ascii-1.0.2.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fold_to_ascii-1.0.2.post1-py3-none-any.whl | Python 3 | none | any | Details for fold_to_ascii-1.0.2.post1-py3-none-any.whl |
Total release size: 45.3 kB
Release files / fold_to_ascii-1.0.2.post1.tar.gz
| Download URL | fold_to_ascii-1.0.2.post1.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7167a07fdc230bd5df5381e9221fe246d0eff3a86eb67e3935f91f5aeca3533a
|
|
BLAKE2b-256 checksum How to use checksums |
71c43d131637f5b728b01c3ebcc982709384b43e6ccc521dd419d89f95308e51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Release files / fold_to_ascii-1.0.2.post1-py3-none-any.whl
| Download URL | fold_to_ascii-1.0.2.post1-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a06640b0cd8cdd16b83ba72a098fb4b243987a50b2f8213b419b6de97787de6
|
|
BLAKE2b-256 checksum How to use checksums |
045709fd562dd7ca24cf764c58ef53b590fcd15f6ec982ed3282fe588e55e64f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Security for fold-to-ascii 1.0.2.post1
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.