rhoknp.cohesion.discourse module

class rhoknp.cohesion.discourse.DiscourseRelationLabel(*values)[source]

Bases: Enum

談話関係ラベルを表す列挙体.

NO_RELATION = '談話関係なし'
CAUSE_REASON = '原因・理由'
PURPOSE = '目的'
CONDITION = '条件'
EVIDENCE = '根拠'
CONTRAST = '対比'
CONCESSION = '逆接'
class rhoknp.cohesion.discourse.DiscourseRelationTag(*values)[source]

Bases: Enum

談話関係タグを表す列挙体.

NO_RELATION = '談話関係なし'
CAUSE_REASON = '原因・理由'
CAUSE_REASON_FORWARD = '原因・理由(順方向)'
CAUSE_REASON_BACKWARD = '原因・理由(逆方向)'
CAUSE_REASON_BACKWARD2 = '原因・理由-逆'
PURPOSE = '目的'
PURPOSE_FORWARD = '目的(順方向)'
PURPOSE_BACKWARD = '目的(逆方向)'
CONDITION = '条件'
CONDITION_FORWARD = '条件(順方向)'
CONDITION_BACKWARD = '条件(逆方向)'
NEGATIVE_CONDITION = '否定条件'
CONTRAST = '対比'
CONTRAST_NO_DIRECTION = '対比(方向なし)'
CONCESSION = '逆接'
CONCESSION_FORWARD = '逆接・譲歩(順方向)'
CONCESSION_BACKWARD = '逆接・譲歩(逆方向)'
CONCESSIVE_CONDITION = '条件-逆条件'
EVIDENCE = '根拠'
EVIDENCE_FORWARD = 'その他根拠(順方向)'
EVIDENCE_BACKWARD = 'その他根拠(逆方向)'
classmethod has_value(value: str) bool[source]

指定された値が存在すれば True.

Parameters:

value – 談話関係タグ.

property label: DiscourseRelationLabel

タグに対応する談話関係のラベルを返却.

is_swap_needed() bool[source]

談話関係が逆方向であれば True.

class rhoknp.cohesion.discourse.DiscourseRelation(sid: str, base_phrase_index: int, label: DiscourseRelationLabel, tag: DiscourseRelationTag, modifier: Clause, head: Clause, is_explicit: bool = False)[source]

Bases: object

談話関係クラス

CLAUSE_FUNCTION_PAT: ClassVar[Pattern] = re.compile('節-機能-(?P<label>.+)')
BACKWARD_CLAUSE_FUNCTION_PAT: ClassVar[Pattern] = re.compile('節-前向き機能-(?P<label>.+)')
DISCOURSE_RELATION_PAT: ClassVar[Pattern] = re.compile('(?P<sid>[^/]+)/(?P<base_phrase_index>\\d+)/(?P<tag>[^/]+)')
sid: str

主辞の文ID.

base_phrase_index: int

主辞の基本句インデックス.

label: DiscourseRelationLabel

談話関係ラベル.

tag: DiscourseRelationTag

談話関係タグ.

modifier: Clause

修飾節.

head: Clause

主辞節.

is_explicit: bool = False

明示的な談話関係ならTrue..

classmethod from_clause_function_fstring(fstring: str, modifier: Clause) DiscourseRelation | None[source]

節機能を表す素性文字列から初期化.

Parameters:
  • fstring – 節機能を表す素性文字列.

  • modifier – 修飾節.

Note

節機能由来で認定された談話関係は明示的 (explicit) とみなす.

classmethod from_backward_clause_function_fstring(fstring: str, head: Clause) DiscourseRelation | None[source]

前向き節機能を表す素性文字列から初期化.

Parameters:
  • fstring – 前向き節機能を表す素性文字列.

  • head – 主節.

Note

前向き節機能由来で認定された談話関係は明示的 (explicit) とみなす.

classmethod from_discourse_relation_fstring(fstring: str, modifier: Clause) DiscourseRelation | None[source]

談話関係を表す素性文字列から初期化.

Parameters:
  • fstring – 談話関係を表す素性文字列.

  • modifier – 修飾節.

to_fstring() str[source]

談話関係を素性文字列に変換する.