Example #1
0
def romajify(text, system="hepburn"):
    out = ""
    katsu = Cutlet(system)
    for line in text.split("\n"):
        for chunk in line.split(ZKS):
            for sent in senter.segment(chunk):
                out += katsu.romaji(sent) + " "
            out += ZKS
        out += "\n"

    return out
Example #2
0
def main():
    signal(SIGPIPE, SIG_DFL)
    system = sys.argv[1] if len(sys.argv) > 1 else 'hepburn'

    katsu = Cutlet(system)

    try:
        for line in fileinput.input([]):
            print(katsu.romaji(line.strip()))
    except KeyboardInterrupt:
        sys.exit(0)
Example #3
0
def test_naughty(text):
    # Goal here is just to not have an exception
    cut = Cutlet()
    cut.romaji(text)
Example #4
0
def test_empty_string(ja, roma):
    cut = Cutlet()
    assert cut.romaji(ja) == roma
Example #5
0
def test_romaji_title(ja, roma):
    cut = Cutlet()
    assert cut.romaji(ja, title=True) == roma
Example #6
0
def test_romaji_non_foreign(ja, roma):
    cut = Cutlet()
    cut.use_foreign_spelling = False
    assert cut.romaji(ja) == roma
Example #7
0
def test_romaji_slugs(ja, roma):
    cut = Cutlet()
    assert cut.slug(ja) == roma
Example #8
0
def test_romaji_kunrei(ja, roma):
    cut = Cutlet('kunrei')
    assert cut.romaji(ja) == roma
Example #9
0
def test_romaji(ja, roma):
    cut = Cutlet()
    assert cut.romaji(ja) == roma
Example #10
0
def test_words_kunrei(ja, roma):
    cut = Cutlet('kunrei')
    word = cut.tagger.parseToNodeList(ja)[0]
    assert cut.romaji_word(word) == roma