Exemple #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
Exemple #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)
Exemple #3
0
def test_naughty(text):
    # Goal here is just to not have an exception
    cut = Cutlet()
    cut.romaji(text)
Exemple #4
0
def test_empty_string(ja, roma):
    cut = Cutlet()
    assert cut.romaji(ja) == roma
Exemple #5
0
def test_romaji_title(ja, roma):
    cut = Cutlet()
    assert cut.romaji(ja, title=True) == roma
Exemple #6
0
def test_romaji_non_foreign(ja, roma):
    cut = Cutlet()
    cut.use_foreign_spelling = False
    assert cut.romaji(ja) == roma
Exemple #7
0
def test_romaji_kunrei(ja, roma):
    cut = Cutlet('kunrei')
    assert cut.romaji(ja) == roma
Exemple #8
0
def test_romaji(ja, roma):
    cut = Cutlet()
    assert cut.romaji(ja) == roma