rhoknp: Yet another Python binding for Juman++/KNP/KWJA

Test Codecov CodeFactor PyPI PyPI - Python Version Documentation

rhoknp is a Python binding for Juman++, KNP, and KWJA.

import rhoknp

# Perform language analysis by Juman++
jumanpp = rhoknp.Jumanpp()
sentence = jumanpp.apply_to_sentence("電気抵抗率は電気の通しにくさを表す物性値である。")

# Dump language analysis by Juman++
with open("result.jumanpp", "wt") as f:
    f.write(sentence.to_jumanpp())

# Load language analysis by Juman++
with open("result.jumanpp", "rt") as f:
    sentence = rhoknp.Sentence.from_jumanpp(f.read())

Why not pyknp?

pyknp has been developed as the official Python binding for Juman++ and KNP. In rhoknp, we redesigned the API from the top-down, taking into account the current use cases of pyknp. The main differences from pyknp are as follows:

  • Support document-level language analysis: rhoknp can load and instantiate the result of document-level language analysis: i.e., cohesion analysis and discourse relation analysis.

  • Strictly type-aware: rhoknp is thoroughly annotated with type annotations. Efficient development is possible with the help of an IDE.

  • Extensive test suite: rhoknp is tested with an extensive test suite. See the code coverage at Codecov.

Indices and tables