Spaces:
Running
Running
Update translit.py
Browse files- translit.py +4 -3
translit.py
CHANGED
|
@@ -176,14 +176,15 @@ def to_taatik(arabic):
|
|
| 176 |
|
| 177 |
|
| 178 |
def postprocess_arabic_transliteration(text):
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
text = re.sub(r'ᵃ(ā)(?!ā)', r'\1', text)
|
| 182 |
text = re.sub(r'ⁱy(?!y)', 'ī', text)
|
| 183 |
text = re.sub(r'ᵒw(?!w)', 'ō', text)
|
| 184 |
text = re.sub(r'ᵘw(?!w)', 'ū', text)
|
| 185 |
text = re.sub(r'ᵃy(?!y)', 'ē', text)
|
| 186 |
text = re.sub(r'ᵃw(?!w)', 'ō', text)
|
|
|
|
|
|
|
| 187 |
|
| 188 |
return text
|
| 189 |
|
|
|
|
| 176 |
|
| 177 |
|
| 178 |
def postprocess_arabic_transliteration(text):
|
| 179 |
+
|
| 180 |
+
text = re.sub(r'ᵃ(ā)(?!ā)', 'ā', text)
|
|
|
|
| 181 |
text = re.sub(r'ⁱy(?!y)', 'ī', text)
|
| 182 |
text = re.sub(r'ᵒw(?!w)', 'ō', text)
|
| 183 |
text = re.sub(r'ᵘw(?!w)', 'ū', text)
|
| 184 |
text = re.sub(r'ᵃy(?!y)', 'ē', text)
|
| 185 |
text = re.sub(r'ᵃw(?!w)', 'ō', text)
|
| 186 |
+
text = re.sub(r'([āīēūō])(\W*$|\W+)', lambda m: m.group(1).translate(str.maketrans('āīēūō', 'aieuo')) + m.group(2), text)
|
| 187 |
+
|
| 188 |
|
| 189 |
return text
|
| 190 |
|