From a91a7d95b32915751985c8ddac25ff7211c3809e Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Sun, 7 Mar 2021 11:16:57 -0800 Subject: [PATCH] =?UTF-8?q?Allow=20small=20=E3=83=83=20before=20a=20vowel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a nonstandard use of ッ and it doesn't really have a defined romanization, but we need to support it for Cramorant (ウッウ, U'u). --- pokedex/roomaji.py | 6 +++--- pokedex/tests/test_roomaji.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pokedex/roomaji.py b/pokedex/roomaji.py index 5844a36..bb722b7 100644 --- a/pokedex/roomaji.py +++ b/pokedex/roomaji.py @@ -98,9 +98,9 @@ class Romanizer(object): if last_kana == 'sokuon': if kana[0] in vowels: - raise ValueError("Sokuon cannot precede a vowel.") - - characters.append(kana[0]) + characters.append("'") + else: + characters.append(kana[0]) elif last_kana == 'n' and kana[0] in vowels: characters.append("'") diff --git a/pokedex/tests/test_roomaji.py b/pokedex/tests/test_roomaji.py index 2ac08c1..c4c952a 100644 --- a/pokedex/tests/test_roomaji.py +++ b/pokedex/tests/test_roomaji.py @@ -25,6 +25,7 @@ import pokedex.roomaji (u'ラティアス', 'ratiasu'), (u'ウィー', 'wii'), (u'セレビィ', 'sereby'), + (u'ウッウ', u"u'u"), ] ) def test_roomaji(kana, roomaji): @@ -52,6 +53,7 @@ def test_roomaji(kana, roomaji): (u'ラティアス', u'ratiasu'), (u'ウィー', u'wí'), (u'セレビィ', u'serebí'), + (u'ウッウ', u"u'u"), ] ) def test_roomaji_cs(kana, roomaji):