Skip to content

Commit

Permalink
fix: put prebase before postbase
Browse files Browse the repository at this point in the history
  • Loading branch information
asdofindia committed Feb 17, 2024
1 parent b14f7e9 commit 53ef775
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions libindic/payyans/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,8 @@ def ASCII2Unicode(self, ascii_text, font):
transposed_text += letter + prebase
prebase = ""
else:
transposed_text += letter
if ascii_text.peek_next() not in postbase_ascii_letters:
transposed_text += prebase
prebase = ""
transposed_text += letter + prebase
prebase = ""
if prebase != "":
transposed_text += prebase

Expand Down
4 changes: 2 additions & 2 deletions libindic/payyans/tests/test_payyans.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def test_unicode2ascii(self):
self.assertEqual(self.payyans.Unicode2ASCII("മലയാളം", "ML-TTAmbili"), "aebmfw")

def test_double_swaras(self):
inputs = ["ss{U", "t{]aw", "kvss{XWX"]
expected = ["ഡ്രൈ", "പ്രേമം", "സ്ത്രൈണത"]
inputs = ["ss{U", "t{]aw", "kvss{XWX", "{ZpXKXnbnÂ"]
expected = ["ഡ്രൈ", "പ്രേമം", "സ്ത്രൈണത", "ദ്രുതഗതിയില്‍"]
for i in range(len(inputs)):
actual = self.payyans.ASCII2Unicode(inputs[i], "ML-TTKarthika")
self.assertEqual(actual, expected[i])

0 comments on commit 53ef775

Please sign in to comment.