polm / cutlet

Japanese to romaji converter in Python
https://polm.github.io/cutlet/
MIT License
309 stars 21 forks source link

KeyError: 'ゖ' #17

Closed ykim closed 4 years ago

ykim commented 4 years ago

Here's another KeyError I found:

% cutlet
齋藤タヶオ
Traceback (most recent call last):
  File "/Users/ykim/.local/share/virtualenvs/sandbox-nIHPi2Hu/bin/cutlet", line 8, in <module>
    sys.exit(main())
  File "/Users/ykim/.local/share/virtualenvs/sandbox-nIHPi2Hu/lib/python3.8/site-packages/cutlet/cli.py", line 16, in main
    print(katsu.romaji(line.strip()))
  File "/Users/ykim/.local/share/virtualenvs/sandbox-nIHPi2Hu/lib/python3.8/site-packages/cutlet/cutlet.py", line 133, in romaji
    roma = self.romaji_word(word)
  File "/Users/ykim/.local/share/virtualenvs/sandbox-nIHPi2Hu/lib/python3.8/site-packages/cutlet/cutlet.py", line 198, in romaji_word
    return self.map_kana(kana)
  File "/Users/ykim/.local/share/virtualenvs/sandbox-nIHPi2Hu/lib/python3.8/site-packages/cutlet/cutlet.py", line 238, in map_kana
    out += self.get_single_mapping(pk, char, nk)
  File "/Users/ykim/.local/share/virtualenvs/sandbox-nIHPi2Hu/lib/python3.8/site-packages/cutlet/cutlet.py", line 271, in get_single_mapping
    return self.table[kk]
KeyError: 'ゖ'

It feels like we're slowly inching toward bullet proofing cutlet xD

polm commented 4 years ago

Gah, I thought I caught all these. Should be fixed in master now.

I'll look at testing a whole Unicode block or fuzzing cutlet so this doesn't happen any more.

polm commented 4 years ago

OK, I have gone over the relevant Unicode blocks and I think I have it all now. I will try fuzzing though.

polm commented 4 years ago

Ended up not trying fuzzing, but I went ahead and released the fix for this.