Skip to main content

Overview

A simple package to help sort non-English names.

  • Free software: BSD 2-Clause License

Installation

pip install anglicize

You can also install the in-development version with:

pip install https://github.com/rciorba/python-anglicize/archive/master.zip

Documentation

This library provides one function, which takes a string and substitutes characters.

To use:

# call the function directly:
anglicize("Łukasz") == "Lukasz"

# or use it to sort a list:
sorted(["Ana", "Łukasz", "Zack"], key=anglicize) == ["Ana", "Łukasz", "Zack"]

# there we go, that's much better than this:
sorted(["Ana", "Łukasz", "Zack"]) == ["Ana", "Zack", "Łukasz"]

Rationale

The purpose of this library is to help you sort non-English names writen in Latin-based alphabets.

Different languages have wildly different rules for sorting, for example Ö comes after Z in Finnish but after O in Hungarian. The approach taken here is to treat visually similar letters the same, so basically ÖÔÓÒṌṎ (and others) should all become O.

Handling letters that have little similarity to A-Z

The German ß is the main issue here. I chose to handle it like an S, mostly because it’s different enough from B (the most similar visually) and because it’s well known as a version of S to most Europeans.

Languages covered

  • Albanian

  • Azerbaijani

  • Bosnian

  • Bulgarian transliteration

  • Croatian

  • Dutch

  • Estonian

  • Finnish

  • French

  • Gagauz

  • German

  • Hungarian

  • Icelandic

  • Latvian

  • Lithuanian

  • Luxembourgish

  • Montenegrin

  • Norwegian

  • Polish

  • Portuguese

  • Romanian

  • Serbian

  • Spanish

  • Swedish

  • Tatar

  • Turkish

  • Turkmen

Contributing

Do you know a language written in a Latin alphabet and want to check it’s correctly handled? Have a look in tests/test_anglicize.py. If the language is there please check all “special” letters are handled. This list has been mostly compiled off of Wikipedia, so I would not be surprised to hear about errors :)

You can either make the changes and submit a PR or just create an issue mentioning - language - characters which need handling

Development

To run tests for all Python environments run:

tox

Changelog

0.0.3 (2020-03-08)

  • Fix rationale example.

0.0.2 (2020-03-08)

  • Fix readme example.

0.0.1 (2020-03-07)

  • First release on PyPI.

Metadata

Release files for anglicize 0.0.3

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

Source distribution (sdist)

Source distribution for anglicize 0.0.3
File Size Uploaded Provenance Actions
anglicize-0.0.3.tar.gz 9.0 kB Without provenance Details for anglicize-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anglicize 0.0.3
File Interpreter ABI Platform Actions
anglicize-0.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details for anglicize-0.0.3-py2.py3-none-any.whl

Total release size: 13.4 kB

Release files / anglicize-0.0.3.tar.gz

Download URL anglicize-0.0.3.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7ef7d3790d9ac82816dfceb5ad8c861783175ee007036e297fea27451d8d400e
BLAKE2b-256 checksum
How to use checksums
064d16215fe29a176f4e05f970c851152e282b0851f36f328a6e2edf64911c91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

Release files / anglicize-0.0.3-py2.py3-none-any.whl

Download URL anglicize-0.0.3-py2.py3-none-any.whl
Size 4.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5165f141d3257bbd22b72b1e9847cfef7029e74b2a5bf0501e37111b2d2dc8cf
BLAKE2b-256 checksum
How to use checksums
f838f8370795f6c5d93d842b1eb5b4a94e1d7490d122e19d5292d19688fb035c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

Security for anglicize 0.0.3

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.

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