Skip to main content

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

There's also the abillity to convert a word from latin to it's intended accentuated once in Greek:

>>> greek_transliteration("P;ita soybl;aki")
Πίτα σουβλάκι

>>> greek_transliteration("kaWiki")
καΐκι

>>> greek_transliteration("pro:yp;ouesh")
προϋπόθεση

>>> greek_transliteration("GA:IDAROS")
ΓΑΪΔΑΡΟΣ

Note: The function takes as given that the user intended to write the work in Greek using the correct key sequence but just didn't switch their keyboard to Greek. It doesn't convert from Greeklish!

# Wrong key sequence by user.
# They're supposed to press SHIFT + W and not just w for the ΅ character to appear.
>>> greek_transliteration("kawiki")
καςικι

Metadata

Release files for greek-language-tools 1.1.0

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

Source distribution (sdist)

Source distribution for greek-language-tools 1.1.0
File Size Uploaded
greek-language-tools-1.1.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for greek-language-tools 1.1.0
File Interpreter ABI Platform
greek_language_tools-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / greek-language-tools-1.1.0.tar.gz

Download URL greek-language-tools-1.1.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b736f066253f7b05985f77665cd33f20c592ace5713c6a280a6a8a12e5bbb7c6
BLAKE2b-256 checksum
How to use checksums
6e91459bb3c10553f9cd19be018d10465094678684a8979107b8e363e4afcd5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / greek_language_tools-1.1.0-py3-none-any.whl

Download URL greek_language_tools-1.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80b486e215860027f1f229ceb2f283fb0b836e290d9ac564040b956d112efbcf
BLAKE2b-256 checksum
How to use checksums
bb91fa44c593ea978b2ae906ec134fac4450a597ffc21698cf966ed9f41f262b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

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