A shared Python package for character conversion utilities across multiple languages. This package provides functions to convert characters from various languages to English equivalents.
This software is provided for EDUCATIONAL and RESEARCH purposes only. It is NOT intended for use in critical applications without proper verification and professional review.
- The accuracy of character conversions depends entirely on the provided mapping tables
- Users are solely responsible for verifying all conversions and ensuring they meet their requirements
- The authors make no representations about the accuracy or completeness of character mappings
- Users should verify all conversions independently before using in production
- The software is provided "AS IS" without any warranty regarding conversion accuracy
- The authors disclaim all responsibility for any errors, omissions, or inaccuracies in character conversions
- Users assume all risks and responsibilities for their use of converted text
By using this software, you acknowledge that you have read and understood these disclaimers.
- Greek to English conversion: Convert Greek characters (including accented characters) to English equivalents
- Swedish to English conversion: Convert Swedish characters to English equivalents
- German to English conversion: Convert German characters to English equivalents
- French to English conversion: Convert French characters to English equivalents
- Spanish to English conversion: Convert Spanish characters to English equivalents
- Extensible design: Easy to add new language converters
- Type hints: Full type annotation support
- No dependencies: Pure Python with no external dependencies
Since this is a shared package for local development, install it in development mode:
cd E:\Python\text_converters
pip install -e .git clone <repository-url>
cd text_converters
pip install -e .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: "Athhna"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'])from text_converters import get_character_converter
# Get a converter by language name
converter = get_character_converter("greek")
result = converter("Καλησπέρα") # "Kalhspera"
# 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"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"| Language | Function | Example |
|---|---|---|
| Greek | convert_greek_characters_to_english |
"Αθήνα" → "Athhna" |
| 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" |
Convert Greek characters to English equivalents.
Parameters:
text(str): Text containing Greek characters
Returns:
str: Text with Greek characters converted to English equivalents
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
Dictionary mapping language names to their respective converter functions.
pip install -e ".[dev]"
pytestblack text_converters/mypy text_converters/MIT License
This package is designed to be shared between the SRU Generator and Mihalis projects. When adding new language converters:
- Add the conversion function following the existing pattern
- Add the function to the
CHARACTER_CONVERTERSdictionary - Update the
__all__list in__init__.py - Add tests for the new converter
- Update this README with examples
- 1.0.0: Initial release with Greek, Swedish, German, French, and Spanish converters