Skip to main content

A simple package to help sort non-English names.

Project description

A simple package to help sort non-English names.

  • Free software: BSD 2-Clause License


pip install anglicize

You can also install the in-development version with:

pip install


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"]


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


Do you know a language written in a Latin alphabet and want to check it’s correctly handled? Have a look in tests/ 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


To run tests for all Python environments run:



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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anglicize-0.0.3.tar.gz (9.0 kB view hashes)

Uploaded source

Built Distribution

anglicize-0.0.3-py2.py3-none-any.whl (4.4 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page