A library with tools for easy Greek word transformations.
Project description
Greek Language Tools
Greek Language Tools is a set of tools that will help you make easy transformations to Greek words.
Installation
pip install greek-language-tools
Usage
Import as any other module using the name greeklt
from greeklt import *
- capitalize(word)
Makes a word all caps without accentuation but adds dieresis when necessary:
word = "γάιδαρος"
>>> word.upper()
ΓΆΙΔΑΡΟΣ
>>> capitalize(word)
ΓΑΪΔΑΡΟΣ
- remove_accentuation(word)
Removes accentuation but adds dieresis when necessary, without capitalizing:
word = "γάιδαρος"
>>> remove_accentuation(word)
γαϊδαρος
Works exceptionally well when you want to sort a list aphabetically and not based on unicode:
cities = ["Όσλο", "Λευκωσία", "Άκαμπα", "Ζυρίχη", "Ρώμη"]
>>> sorted(cities)
["Άκαμπα", "Όσλο", "Ζυρίχη", "Λευκωσία", "Ρώμη"]
>>> sorted(cities, key=remove_accentuation)
["Άκαμπα", "Ζυρίχη", "Λευκωσία", "Όσλο", "Ρώμη"]
- convert_final_s(word)
Checks last letter of each word in a string. If it is a σ
it is converted into a ς
(final σ
):
>>> convert_final_s("Φάροσ φάρος ΦΑΡΟΣ")
Φάρος φάρος ΦΑΡΟΣ
- greek_transliteration(word)
Transliterates a string written with latin characters into it's equivalent Greek (based on the keys of a QWERTY keyboard):
>>> greek_transliteration("fvtia")
φωτια
This can come quite in handy when a user forgets to change the language and the word looks the same both in latin and Greek:
# ANNA written in latin (Anna)
name = "ANNA"
>>> name == greek_transliteration(name)
False
# Both look the same but are different unnicode characters
>>> ANNA == ΑΝΝΑ
False
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for greek-language-tools-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8710034c6acfdf2bbf27f44a2e714d276775a51a73aba9fd9a7b5a9a24bd64e2 |
|
MD5 | 88047e14113f40cf6aac8571b22b7eb7 |
|
BLAKE2b-256 | ed06f4eb522ff86aa5ba7578094f81f17a5bcd60cc7a106fecf0bb417c780e7a |
Hashes for greek_language_tools-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86f5967448a0954f14a1419bbfe1fdad185573e8e40599acf02e364ddb531cb2 |
|
MD5 | c6cc33428817ed7c78710894a54c7a36 |
|
BLAKE2b-256 | 584e4ee8e37806ed1c1fe0228cc2bc9a714dd574d4e611a24d9e32ff9a9b8b5e |