Skip to main content

Text Converters

License: MIT Python 3.11+ Status: Beta

Small, dependency-free Python functions that replace Greek letters and accented Swedish, German, French and Spanish letters with plain Latin (mostly ASCII) equivalents, using one fixed character map per language.

Scope and limitations

Released under the MIT License and provided "as is", without warranty of any kind. Each converter is a simple character-by-character lookup. Known limits:

  • Greek is close to ELOT 743 for single letters, but it is not a full implementation of ELOT 743 or ISO 843. η → i (Θεσσαλονίκη → Thessaloniki), ου → ou (Παπαδόπουλος → Papadopoulos), and Θ, Χ, Ψ give Th, Ch, Ps, or TH, CH, PS inside an all-capitals word (ΑΘΗΝΑ → ATHINA).
  • Other Greek letter pairs that ELOT 743 treats specially (αυ, ευ, μπ, ντ, γγ, ...) are converted letter by letter (Ευρώ → Eyro, Μπαμπάς → Mpampas).
  • German writes umlauts as ae/oe/ue and ß as ss. The other converters simply drop the accent (Swedish ä → a).
  • French writes the ligatures œ and æ as oe and ae; like the German umlauts, their capitals become Oe and Ae even in an all-capitals word.
  • Characters missing from a language's map are returned unchanged, so the output is not guaranteed to be ASCII (for example ¿, € or Cyrillic letters).
  • Conversion is one-way and loses information.

Installation

pip install text-converters

Or the latest development version from GitHub:

pip install git+https://github.com/Nikolaos-Paximadakis/text-converters.git

For development:

git clone https://github.com/Nikolaos-Paximadakis/text-converters.git
cd text-converters
pip install -e ".[dev]"

Usage

Basic Usage

from text_converters import convert_greek_characters_to_english

# Convert Greek text to English
greek_text = "Αθήνα"
english_text = convert_greek_characters_to_english(greek_text)
print(english_text)  # Output: "Athina"

Using the Character Converter Dictionary

from text_converters import CHARACTER_CONVERTERS

# Get a specific converter
greek_converter = CHARACTER_CONVERTERS["greek"]
result = greek_converter("Γεια σας")  # "Geia sas"

# Available converters
print(CHARACTER_CONVERTERS.keys())
# dict_keys(['greek', 'swedish', 'german', 'french', 'spanish', 'none'])

Using the Getter Function

from text_converters import get_character_converter

# Get a converter by language name
converter = get_character_converter("greek")
result = converter("Καλησπέρα")  # "Kalispera"

# Handle unsupported languages
try:
    converter = get_character_converter("unsupported")
except ValueError as e:
    print(e)  # "Unsupported language 'unsupported'. Available: greek, swedish, german, french, spanish, none"

Multiple Language Support

from text_converters import (
    convert_greek_characters_to_english,
    convert_german_characters_to_english,
    convert_french_characters_to_english,
)

# Greek
greek_result = convert_greek_characters_to_english("Γεια σας")  # "Geia sas"

# German
german_result = convert_german_characters_to_english("Grüße")  # "Gruesse"

# French
french_result = convert_french_characters_to_english("Bonjour")  # "Bonjour"

Supported Languages

Language Function Example
Greek convert_greek_characters_to_english "Αθήνα" → "Athina"
Swedish convert_swedish_characters_to_english "Göteborg" → "Goteborg"
German convert_german_characters_to_english "Grüße" → "Gruesse"
French convert_french_characters_to_english "Café" → "Cafe"
Spanish convert_spanish_characters_to_english "España" → "Espana"
None no_conversion "Hello" → "Hello"

API Reference

Functions

convert_greek_characters_to_english(text: str) -> str

Convert Greek characters to English equivalents.

Parameters:

  • text (str): Text containing Greek characters

Returns:

  • str: Text with Greek characters converted to English equivalents

get_character_converter(language: str = "none")

Get a character converter function by language name.

Parameters:

  • language (str): Language name ('greek', 'swedish', 'german', 'french', 'spanish', 'none')

Returns:

  • Function: Character converter function

Raises:

  • ValueError: If language is not supported

Constants

CHARACTER_CONVERTERS

Dictionary mapping language names to their respective converter functions.

Development

Running Tests

pip install -e ".[dev]"
pytest

Lint, Format and Type Checks

ruff check .
ruff format --check .
mypy
pyright

License

MIT License. See LICENSE.

Contributing

When adding new language converters:

  1. Add the conversion function following the existing pattern
  2. Add the function to the CHARACTER_CONVERTERS dictionary
  3. Update the __all__ list in __init__.py
  4. Add tests for the new converter
  5. Update this README with examples

Changes

See the changelog.

Metadata

Release files for text-converters 0.2.1

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

Source distribution (sdist)

Source distribution for text-converters 0.2.1
File Size Uploaded Provenance Actions
text_converters-0.2.1.tar.gz 14.4 kB With provenance Details for text_converters-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for text-converters 0.2.1
File Interpreter ABI Platform Actions
text_converters-0.2.1-py3-none-any.whl Python 3 none any Details for text_converters-0.2.1-py3-none-any.whl

Total release size: 22.2 kB

Release files / text_converters-0.2.1.tar.gz

Download URL text_converters-0.2.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a00f61ba0dce65a021eeeeec2e7f701c3edea59b82fda649d52b0eb235ff2b0b
BLAKE2b-256 checksum
How to use checksums
01f3a4afe6918fd8e681e0f0b6ef6bb9ae31bc823d2dc90169343e40f0108064
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / text_converters-0.2.1-py3-none-any.whl

Download URL text_converters-0.2.1-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5abb4332a75dc02e609d9674cb90c1956ae9e3ef7d38c70a5a0492f60f20abe6
BLAKE2b-256 checksum
How to use checksums
fd362de66d859d72a5bf04419bd85f2648da37df9dca5c1f14dc709deb37780f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for text-converters 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for text_converters-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

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