I am attempting to use the pykakasi library in Python to convert Japanese text to Romaji. However, I am encountering issues with the conversion of sokuon (促音). Here is the code I am using:
import pykakasi
def japanese_to_romaji(text):
kks = pykakasi.kakasi()
result = kks.convert(text)
return ''.join([entry['hepburn'] for entry in result])
example_text = "振って もっと振って 内圧高めて放出寸前"
print(japanese_to_romaji(example_text))
The output is as follows:
futsute mottofutsute naiatsutakametehoushutsusunzen
As you can see, for the word もっと, pykakasi correctly translates it to motto. However, for the word 振って, pykakasi translates it to futsute.
I am uncertain if this is a bug in pykakasi or an issue with my code.
Should I be configuring pykakasi differently?
Or should I consider using a different library for Japanese morphological analysis for Romaji conversion?
How do Japanese developers typically handle such issues?