rhoknp.processors.processor module

class rhoknp.processors.processor.Processor[source]

Bases: ABC

解析器の基底クラス.

apply(text: str, timeout: int = 10) Document[source]
apply(text: Sentence, timeout: int = 10) Sentence
apply(text: Document, timeout: int = 10) Document

テキストに解析器を適用する.

Parameters:
  • text – 解析するテキスト.

  • timeout – 最大処理時間.

Raises:

TypeError – textの型がstr, Sentence, Document以外の場合.

Note

このメソッドは引数の型に応じて apply_to_document または apply_to_sentence を呼び出す. 引数の型が str の場合は apply_to_document を呼び出す. 引数の型が Sentence の場合は apply_to_sentence を呼び出す. 引数の型が Document の場合は apply_to_document を呼び出す.

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

文書に解析器を適用する.

Parameters:
  • document – 文書.

  • timeout – 最大処理時間.

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

文に解析器を適用する.

Parameters:
  • sentence – 文.

  • timeout – 最大処理時間.