How to use the pykakasi.scripts.K2 function in pykakasi

To help you get started, we’ve selected a few pykakasi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github miurahr / pykakasi / tests / test_units.py View on Github external
def test_K2a():
    TESTS = [
        (u"カンタン", ("ka", 1)),
        (u"ニャ", ("nya", 2)),
        (u"ッキ", ("kki", 2)),
        (u"ッファ", ("ffa", 3)),
        (u"シツモン", ("shi", 1)),
        (u"チガイ", ("chi", 1)),
        (u"ジ", ("ji", 1)),
    ]
    h = pykakasi.scripts.K2("a")
    for case, result in TESTS:
        assert h.convert(case) == result
github miurahr / pykakasi / tests / test_units.py View on Github external
def test_K2H():
    TESTS = [
        (u"カンタン", (u"かんたん", 4)),
        (u"ニャ", (u"にゃ", 2)),
        (u"ッキ", (u"っき", 2)),
        (u"ッファ", (u"っふぁ", 3)),
        (u"シツモン", (u"しつもん", 4)),
        (u"チガイ", (u"ちがい", 3)),
    ]
    h = pykakasi.scripts.K2("H")
    for case, result in TESTS:
        assert h.convert(case) == result
github miurahr / pykakasi / tests / test_units.py View on Github external
(u"ファジー", ("fa", 2)),
        (u"ジー", ("zi", 1)),
        (u"ウォークマン", ("u", 1)),
        (u"キャ", ("kya", 2)), (u"キュ", ("kyu", 2)), (u"キョ", ("kyo", 2)),
        (u"シャ", ("sya", 2)), (u"シュ", ("syu", 2)), (u"ショ", ("syo", 2)),
        (u"チャ", ("tya", 2)), (u"チュ", ("tyu", 2)), (u"チョ", ("tyo", 2)),
        (u"ニャ", ("nya", 2)), (u"ニュ", ("nyu", 2)), (u"ニョ", ("nyo", 2)),
        (u"リャ", ("rya", 2)), (u"リュ", ("ryu", 2)), (u"リョ", ("ryo", 2)),
        (u"ザ", ("za", 1)), (u"ジ", ("zi", 1)), (u"ズ", ("zu", 1)),
        (u"ゼ", ("ze", 1)), (u"ゾ", ("zo", 1)),
        (u"ダ", ("da", 1)), (u"ヂ", ("zi", 1)), (u"ヅ", ("zu", 1)),
        (u"デ", ("de", 1)), (u"ド", ("do", 1)),
        (u"タ", ("ta", 1)), (u"チ", ("ti", 1)), (u"ツ", ("tu", 1)),
        (u"テ", ("te", 1)), (u"ト", ("to", 1))
    ]
    h = pykakasi.scripts.K2("a", method="Kunrei")
    for case, result in TESTS:
        assert h.convert(case) == result