sinaahmadi / klpt

The Kurdish Language Processing Toolkit
https://sinaahmadi.github.io/klpt/
Other
91 stars 11 forks source link

Error when trying example #11

Closed lancioni closed 3 years ago

lancioni commented 3 years ago

When trying one of the transliteration examples in the main project page,

transliterate = Transliterate("Kurmanji", "Latin", target_script="Arabic" transliterate.transliterate("rojhilata navîn")

I get the following error: Traceback (most recent call last): File "", line 1, in File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\klpt\transliterate.py", line 162, in transliterate tokens_dict = self.to_pieces(token) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\klpt\transliterate.py", line 131, in to_pieces tokens_dict[char_index-i] = tokens_dict[char_index-i] + token[char_index] KeyError: 1

I am using Python 3.6.3 under Windows 10.

Thanks for support!

Giuliano

sinaahmadi commented 3 years ago

Thanks for raising the issue, Giuliano.

It is weird, as I cannot reproduce the same bug with your code. Would you please try the following code or provide your entire code here?

>>> from klpt.transliterate import Transliterate
>>> transliterate = Transliterate("Kurmanji", "Latin", target_script="Arabic")
>>> transliterate.transliterate("rojhilata navîn")
'رۆژهلاتا ناڤین'
lancioni commented 3 years ago

Strangely enough, it gave the error by writing exactly what you wrote:

immagine

lancioni commented 3 years ago

On the other hand, it works in Linux Subsystem for Windows:

immagine

So, it seems to be a Windows issue, although the library was installed through pip with no complain. Strange!

sinaahmadi commented 3 years ago

This is really weird. I, unluckily, have not tested the library on Windows yet. Thanks so much again for reporting it. I'll find a way to test it on Windows soon.