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

Freeze when passing certain characters to jaconv.kana2alphabet #21

Closed
nicoyou opened this issue Jun 18, 2022 · 9 comments
Closed

Freeze when passing certain characters to jaconv.kana2alphabet #21

nicoyou opened this issue Jun 18, 2022 · 9 comments

Comments

@nicoyou
Copy link

nicoyou commented Jun 18, 2022

Nice to get started.
Thank you for providing a great library.
In ver.0.3, when I pass "えっっ" to a function as follows, the function freezes.
jaconv.kana2alphabet("えっっ")

@frog42
Copy link
Contributor

frog42 commented Dec 5, 2022

どうやって訳すでしょうか?
"E,e,e"?
"Eee"?

@nicoyou
Copy link
Author

nicoyou commented Dec 5, 2022

The small "つ" can be expressed with "ltu".
example:
"Eltultu"

@frog42
Copy link
Contributor

frog42 commented Dec 5, 2022

That's how you would input it on a keyboard, but it's not really an accurate romaji representation.

@frog42
Copy link
Contributor

frog42 commented Dec 5, 2022

でも仕方ないかな?
「ぜんっっっぜん」は"zenzzzzen"になったら分かるけど
「っ」の後は何もない場合、実は日本語じゃないじゃない?
勿論エラーが出ない方がいいけどカタカナに変えた言葉そのままひらがなに戻せないとおかしいね。
"ltu"を「っ」に変えると問題になる可能性あるかな?

@nicoyou
Copy link
Author

nicoyou commented Dec 5, 2022

I see.
I understand why it is difficult to convert, but it is a fatal problem when a program using this library becomes unresponsive when it enters an infinite loop in the library.
I think it needs to either raise an exception or leave the "っ" as it is without conversion, etc.

@nicoyou
Copy link
Author

nicoyou commented Dec 5, 2022

I couldn't think of any particular problem caused by converting "ltu" to "っ".

@frog42
Copy link
Contributor

frog42 commented Dec 5, 2022

I found the problem and submitted a pull request that should fix it. The program currently changes 「えっ」 to "extsu", so for your stated error with 「えっっ」I made it so the program would convert to "extsuxtsu". This should also fix any issues such as 「えっっっ」, etc.

Ultimately, the code would be safer using a FOR loop instead of a WHILE loop, but I wanted to make as few changes as possible and I couldn't think of any other case where this might create an infinite loop.

Hopefully @ikegami-yukino can accept the changes for us.

@nicoyou nicoyou changed the title jaconv.kana2alphabetに特定の文字を渡すとフリーズします Freeze when passing certain characters to jaconv.kana2alphabet Dec 10, 2022
@nicoyou
Copy link
Author

nicoyou commented Dec 10, 2022

Thank you.
I think this is a good change.

@ikegami-yukino
Copy link
Owner

@nicoyou @frog42
I uploaded the bug-fix version to PyPI.
Thanks a lot!

$ pip install jaconv

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

3 participants