How to use the pykakasi.kanji.J2 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_J2H():

    TESTS = [
        (u"構成", (u"こうせい", 2)),
        (u"好き", (u"すき", 2)),
        (u"大きい", (u"おおきい", 3)),
        (u"日本国民は、", (u"にほんこくみん", 4))
    ]
    j = pykakasi.kanji.J2("H")
    for case, result in TESTS:
        assert j.convert(case) == result
github miurahr / pykakasi / tests / test_units.py View on Github external
def test_J2a():
    TESTS = [
        (u"構成", ("kousei", 2)),
        (u"好き", ("suki", 2)),
        (u"大きい", ("ookii", 3)),
        (u"日本国民は、", ("nihonkokumin", 4)),
        (u"\u31a0", ("", 0))  # non japanese character
    ]
    j = pykakasi.kanji.J2("a")
    for case, result in TESTS:
        assert j.convert(case) == result
github miurahr / pykakasi / tests / test_units.py View on Github external
def test_J2K():
    TESTS = [
        (u"構成", (u"コウセイ", 2)),
        (u"好き", (u"スキ", 2)),
        (u"大きい", (u"オオキイ", 3)),
        (u"日本国民は、", (u"ニホンコクミン", 4))
    ]
    j = pykakasi.kanji.J2("K")
    for case, result in TESTS:
        assert j.convert(case) == result
github miurahr / pykakasi / tests / test_units.py View on Github external
def test_itaiji():
    I_TEST = [
        (u"菟", u"兎"),
        (u"菟集", u"兎集"),
        (u"熙", u"煕"),
        (u"壱弍", u"一二"),
        (u"森鷗外", u"森鴎外"),
    ]
    j = pykakasi.kanji.J2("H")
    for case, result in I_TEST:
        assert j.itaiji_conv(case) == result