Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fold-to-ascii

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

  • 1.0.2.post1
  • PyPI
  • Socket score

Maintainers
1

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.

  1. Bump the version in setup.py.
  2. Build and upload:
$ python setup.py sdist bdist_wheel
$ twine upload dist/*

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc