rhoknp.processors.jumanpp module

class rhoknp.processors.jumanpp.Jumanpp(executable: str = 'jumanpp', options: list[str] | None = None, senter: Processor | None = None, skip_sanity_check: bool = False)[source]

Bases: Processor

Jumanpp クラス.

Parameters:
  • executable – Juman++ のパス.

  • options – Juman++ のオプション.

  • senter – 文分割器のインスタンス.文分割がまだなら,先にこのインスタンスを用いて文分割する. 未設定なら RegexSenter を使って文分割する.

  • skip_sanity_check – True なら,Juman++ の起動時に sanity check をスキップする.

Example

>>> from rhoknp import Jumanpp
>>> jumanpp = Jumanpp()
>>> document = jumanpp.apply("電気抵抗率は電気の通しにくさを表す物性値である。")

Note

使用するには Juman++ がインストールされている必要がある.

executable

Juman++ のパス.

options: list[str]

Juman++ のオプション.

start_process(skip_sanity_check: bool = False) None[source]

Juman++ を開始する.

Note

Juman++ が既に起動している場合は再起動する. skip_sanity_check: True なら,Juman++ の起動時に sanity check をスキップする.

is_available() bool[source]

Jumanpp が利用可能であれば True を返す.

apply_to_document(document: Document | str, timeout: int = 10) Document[source]

文書に Jumanpp を適用する.

Parameters:
  • document – 文書.

  • timeout – 最大処理時間.

Note

文分割がまだなら,先に初期化時に設定した senter で文分割する. 未設定なら RegexSenter で文分割する.

apply_to_sentence(sentence: Sentence | str, timeout: int = 10) Sentence[source]

文に Jumanpp を適用する.

Parameters:
  • sentence – 文.

  • timeout – 最大処理時間.

get_version() str[source]

Juman++ のバージョンを返す.

property run_command: list[str]

解析時に実行するコマンド.

property version_command: list[str]

バージョンを確認するコマンド.