From c4b6240ff0e07f2365d0a4e7de3a879bd80dc01c Mon Sep 17 00:00:00 2001 From: Eevee Date: Thu, 15 Apr 2010 20:05:31 -0700 Subject: [PATCH] roomaji.py now handles "wu xe" and "shi xi" correctly. #132 --- pokedex/roomaji.py | 11 ++++++++++- pokedex/tests/test_roomaji.py | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pokedex/roomaji.py b/pokedex/roomaji.py index cdf30b5..95d559a 100644 --- a/pokedex/roomaji.py +++ b/pokedex/roomaji.py @@ -55,12 +55,21 @@ _roomaji_small_kana = { u'ァ': 'a', u'ィ': 'i', u'ゥ': 'u', u'ェ': 'e', u'ォ': 'o', } _roomaji_small_kana_combos = { - u'ウィ': 'wi', + # These are, by the way, fairly arbitrary. "shi xi" to mean "sy" is + # particularly weird, but it seems to be what GF intends + + # Simple vowel replacement + u'ウィ': 'wi', u'ウゥ': 'wu', u'ウェ': 'we', u'チェ': 'che', u'シェ': 'she', u'テァ': 'tha', u'ティ': 'ti', u'テゥ': 'thu', u'テェ': 'tye', u'テォ': 'tho', u'デァ': 'dha', u'ディ': 'di', u'デゥ': 'dhu', u'デェ': 'dye', u'デォ': 'dho', u'ファ': 'fa', u'フィ': 'fi', u'ホゥ': 'hu', u'フェ': 'fe', u'フォ': 'fo', + + # Not so much + u'シィ': 'sy', + u'ビィ': 'by', + u'ピィ': 'py', } def romanize(string): diff --git a/pokedex/tests/test_roomaji.py b/pokedex/tests/test_roomaji.py index 07a6aa7..09dfe71 100644 --- a/pokedex/tests/test_roomaji.py +++ b/pokedex/tests/test_roomaji.py @@ -17,10 +17,12 @@ def test_roomaji(): (u'ニャース', 'nyaasu'), (u'ジャ', 'ja'), (u'ぎゃくてん', 'gyakuten'), + (u'ウェザーボール', 'wezaabooru'), # Special katakana combinations (u'ラティアス', 'ratiasu'), (u'ウィー', 'wii'), + (u'セレビィ', 'sereby'), ] for kana, roomaji in tests: -- 2.7.4