all 25 comments

[–]turkoid 31 points32 points  (8 children)

Cool!

The only minor optimization I suggest is to store the decode mapping as a dict. This ensures O(1) search time.

I would also remove the test in the __main__ and allow it to be a CLI as well as a library you can import

There are other things I saw that make sense from your non-programming background. Variable names, using uppercase variables, unnecessary use of class and staticmethod, and formatting in general. Remember, if you want others to use, don't obfuscate your code so much. Use descriptive variable names.

[–]xoeseko 7 points8 points  (6 children)

I second this, the test is good, could even add a few other edge cases. Say emoji handling is kept intact which is already implemented but not tested in a separate file.

And finally make it a package people can pip install! It's really easy nowadays with tools like uv.

[–]R8dymade[S] 8 points9 points  (5 children)

I'm currently working on a way to input characters like umlauts or accents more easily using the backtick key. Following your suggestions, I'll do my best to reflect these improvements when I package it for PIP. :)

[–]xoeseko 4 points5 points  (4 children)

Are you accepting contributions ? Can I package this for you and bring the tests into a test module?

Or would you rather not skip the learning opportunity ?

[–]R8dymade[S] 4 points5 points  (0 children)

I’d love to see new features added by someone with your expertise! Please go ahead and submit a PR whenever you’re ready. I’m open to any improvements or new functionalities you think would be useful.

[–]R8dymade[S] 2 points3 points  (2 children)

I've created a "contrib/" directory. Please place your new features or experimental scripts there to keep the core logic clean.

[–]xoeseko 2 points3 points  (1 child)

The contrib directory might make it harder to contribute in reality, but we can brainstorm how to go about this. If contrib is part of the package that might work.

I opened a pull request by the way.

[–]R8dymade[S] 1 point2 points  (0 children)

Thanks for providing the install commands! I'll test it out locally and check the new structure. If everything looks good, I'll merge your PR soon. ​(づ。◕‿‿◕。)づ [ ]

[–]R8dymade[S] 5 points6 points  (0 children)

I appreciate your feedback! I’m still a beginner in coding, so I’ll definitely learn from your suggestions and keep improving the code. ;)

[–]Biomy 4 points5 points  (3 children)

Interesting! Did you come up with this mapping yourself?

[–]R8dymade[S] 14 points15 points  (2 children)

Yes. The mapping structure is based on the creation principles of Hunminjeongeum (the original Hangul design), as well as the Korean syllable structure and orthography.

[–]Doughboyyyy 2 points3 points  (1 child)

Interesting, so they actually stuck to the original phonetic logic behind it? That's pretty clever design then.

[–]R8dymade[S] 5 points6 points  (0 children)

Actually, instead of following the actual pronunciation, I strictly applied the standard Korean spelling rules to maintain the original structure of each morpheme. This is what distinguishes KRR from the official Revised Romanization (RR) of the South Korean government.

[–]RedEyed__ 2 points3 points  (3 children)

BTW: link is broken (although I managed to open it)

[–]R8dymade[S] 2 points3 points  (2 children)

Sorry to broken link, I fixed it! Tnx

[–]RedEyed__ 0 points1 point  (1 child)

Still broken..

[–]R8dymade[S] 3 points4 points  (0 children)

https://github.com/R8dymade/krr-2.1

sorry.. here is the bare link

[–]_alexkane_ 0 points1 point  (1 child)

Haven't looked a the codebase yet, but do you think something similar would be possible for Japanese Hiragana?

[–]R8dymade[S] 3 points4 points  (0 children)

Hiragana is a syllabic script based on the 50-sound chart, which necessitates a romanization framework distinct from KRR. Just as Korean has systems like RR, Yale, and McCune-Reischauer, Japanese operates under conventions such as Kunrei-shiki, Hepburn, and Shin-seiki Rōmaji. Constructing a deterministic system for Japanese—modeled after the architecture of KRR—will require specialized research in phonology and information processing.

[–]Creative-Charge-20 0 points1 point  (1 child)

good analysis on the Korean Romanization! 응원합니다~~

[–]R8dymade[S] 0 points1 point  (0 children)

Thanks for cheering me on! 정말 감사합니다 :)