guymorlan commited on
Commit
719cfda
·
verified ·
1 Parent(s): 81a260a

Update translit.py

Browse files
Files changed (1) hide show
  1. translit.py +4 -0
translit.py CHANGED
@@ -176,6 +176,9 @@ def to_taatik(arabic):
176
 
177
 
178
  def postprocess_arabic_transliteration(text):
 
 
 
179
  # Step 1: Replace long vowels at the end of words
180
  text = re.sub(r'([āīēūō])(\W*$|\W+)', lambda m: m.group(1).translate(str.maketrans('āīēūō', 'aieuo')) + m.group(2), text)
181
 
@@ -193,6 +196,7 @@ def postprocess_arabic_transliteration(text):
193
 
194
  return text
195
 
 
196
  def to_translit(arabic):
197
  translit = []
198
  for letter in arabic:
 
176
 
177
 
178
  def postprocess_arabic_transliteration(text):
179
+ # New step: Convert 'aā' to 'ā', but keep 'aaā'
180
+ text = re.sub(r'a(ā)(?!ā)', r'\1', text)
181
+
182
  # Step 1: Replace long vowels at the end of words
183
  text = re.sub(r'([āīēūō])(\W*$|\W+)', lambda m: m.group(1).translate(str.maketrans('āīēūō', 'aieuo')) + m.group(2), text)
184
 
 
196
 
197
  return text
198
 
199
+
200
  def to_translit(arabic):
201
  translit = []
202
  for letter in arabic: