/Fidel

A Python package that can transliterate Latin characters to Geez characters and vice versa.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Fidel / ፊደል

What is Fidel / ፊደል ?

Fidel is a Python package that can transliterate Latin characters to Geez characters and vice versa.

For example: abebe beso bela -> አበበ በሶ በላ

Dependencies

Installation

pip install fidel

Upgrade

pip install --upgrade fidel

Usage

Basic Usage

from fidel import Transliterate 
text = "bexam xru sew new"
transliterated = Transliterate(text).transliterate()
print(transliterated)

output

በጣም ጥሩ ሰው ነው

Autocorrect

from fidel import Transliterate 
text = "betam tiru sew nw"
transliterated = Transliterate(text=text, auto_correct=False).transliterate() # The default is False
corrected = Transliterate(text=text, auto_correct=True).transliterate()
print(f"Transliterated: {transliterated}")
print(f"Corrected: {corrected}")

output

Translated: በታም ቲሩ ሰው ንው
Corrected: በጣም ጥሩ ሰው ነው

Amharic Symbol

from fidel import Transliterate 
text = "abebe, kebede ena ayele bexam xru sew nachew."
symbol_true = Transliterate(text=text, symbol=True).transliterate() # The default is True
symbol_false = Transliterate(text=text, symbol=False).transliterate()
print(f"True symbol: {symbol_true}")
print(f"False symbol: {symbol_false}")

output

True symbol:  አበበ፣ ከበደ እና አየለ በጣም ጥሩ ሰው ናቸው።
False symbol: አበበ, ከበደ እና አየለ በጣም ጥሩ ሰው ናቸው.

Exclude words and Split words

Exclude words from being transliterated.

  • To prevent words from being transliterate, put the words inside "``"
from fidel import Transliterate
text = "`Alex` xru sew new"
transliterated = Transliterate(text).transliterate()
print(transliterated)

output

Alex ጥሩ ሰው ነው

Split words

  • To prevent words from being ዲቃላ (The eigth letters) we should put "|" between consonants.
from fidel import Transliterate
text = "ljtua t|sewer" # Without "|" the output is "ልጅቷ ጸወር"
transliterated = Transliterate(text).transliterate()
print(transliterated)

output

ልጅቷ ትሰወር

Reverse Translate

from fidel import Transliterate
text = "በጣም ጥሩ ሰው ነው።"
reversed = Transliterate(text, symbol=True).reverse_transliterate() # The default symbol value is True 
print(reversed)

output

betam xru sew new.

Rules

There are some rules that should be apply when writing a text.

  1. For 1st alphabets (ለግዕዝ) use "e" example: "le" - ለ
  2. For 2nd alphabets (ለካእብ) use "u" example: "lu" - ሉ
  3. For 3rd alphabets (ለሳልስ) use "i" example: "li" - ሊ
  4. For 4rh alphabets (ለራዕብ) use "a" example: "la" - ላ
  5. For 5th alphabets (ለሀምስ) use "ie" example: "lie" - ሌ
  6. For 6th alphabets (ለሳድስ) use only vowel example: "l" - ል
  7. For 7th alphabets (ለሳብዕ) use "o" example: "lo" - ሎ
  8. For 8th alphabets(ለዲቃላ ቃላት) use "ua" example: "ua" - ሏ

Note The above rules may be violated for some alphabets families. Check out ambiguous alphabets.

Ambiguous alphabets

ግዕዝ ካእብ ሳልስ ራዕብ ሀምስ ሳድስ ሳብዕ
ha hu hi ha hie h ho
a u i a ie e o
te tu ti ta tie t to
xe xu xi xa xie x xo
che chu chi cha chie ch cho
ce cu ci ca cie c co
phe phu phi pha phie ph pho
pe pu pi pa pie p po

Addition

Alphabets
Prefix sh gn zh ts