Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing aaransia.exceptions.SourceLanguageError when tried for transliterating Arabic to Tunusian. #74

Open
suhaneshivam opened this issue Feb 19, 2022 · 0 comments

Comments

@suhaneshivam
Copy link

I am trying to transliterate Arabic to Tunisian and getting the aaransia.exceptions.SourceLanguageError exception with almost every single sentence. This is what I have tried.

>>> from aaransia import transliterate, SourceLanguageError
>>> ar = "ﺎﻨﻫ ﻒﻋﻻ ﺵﺮﻓ ﻊﻈﻴﻣ ﻞﻳ ﺎﻧ ﺄﺼﻋﺩ ﺎﻠﻤﻨﺻﺓ ﻞﻠﻣﺭﺓ ﺎﻠﺛﺎﻨﻳﺓ. ﺄﻧﺍ ﻒﻳ ﻍﺎﻳﺓ ﺍﻼﻤﺘﻧﺎﻧ"
>>> transliterate(ar, source = "ar", target = "tn")
Traceback (most recent call last):
  File "/home/centos/.local/lib/python3.6/site-packages/aaransia/transliteration.py", line 103, in transliterate
    text.split())))
  File "/home/centos/.local/lib/python3.6/site-packages/aaransia/transliteration.py", line 102, in <lambda>
    return ' '.join(list(map(lambda word: _transliterate_word(word, source, target, universal),
  File "/home/centos/.local/lib/python3.6/site-packages/aaransia/transliteration.py", line 90, in _transliterate_word
    return u''.join(result).replace(u'\u200e', '')
TypeError: sequence item 0: expected str instance, NoneType found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/centos/.local/lib/python3.6/site-packages/aaransia/transliteration.py", line 105, in transliterate
    raise SourceLanguageError(f'{SOURCE_LANGUAGE_EXCEPTION_MESSAGE}: {source}')
aaransia.exceptions.SourceLanguageError: Source alphabet language doesn't match the input text: ar

However, when tried with universal = True , I got the same sentence back. What is wrong?

>>> ar = "ﺎﻨﻫ ﻒﻋﻻ ﺵﺮﻓ ﻊﻈﻴﻣ ﻞﻳ ﺎﻧ ﺄﺼﻋﺩ ﺎﻠﻤﻨﺻﺓ ﻞﻠﻣﺭﺓ ﺎﻠﺛﺎﻨﻳﺓ. ﺄﻧﺍ ﻒﻳ ﻍﺎﻳﺓ ﺍﻼﻤﺘﻧﺎﻧ"
>>> transliterate(ar, source = "ar", target = "tn", universal = True)
'ﺎﻨﻫ ﻒﻋﻻ ﺵﺮﻓ ﻊﻈﻴﻣ ﻞﻳ ﺎﻧ ﺄﺼﻋﺩ ﺎﻠﻤﻨﺻﺓ ﻞﻠﻣﺭﺓ ﺎﻠﺛﺎﻨﻳﺓ. ﺄﻧﺍ ﻒﻳ ﻍﺎﻳﺓ ﺍﻼﻤﺘﻧﺎﻧ'

I think some Arabic alphabets are missing. What is the fix? Or I am doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant