segram.grammar.conjuncts module

class segram.grammar.conjuncts.PhraseGroup(iterable=(), /)[source]

Bases: DataTuple

Group of phrases.

property conjs: DataTuple[Conjuncts]

Phrases groups as conjuncts.

class segram.grammar.conjuncts.Conjuncts(members: Iterable[Phrase] = (), *, lead: int = 0, cconj: Token | None = None, preconj: Token | None = None)[source]

Bases: DataTuple

Group of conjoined phrases.

members

Conjoined phrases.

lead

Lead component.

cconj

Conjunction token.

preconj

Preconjunction token.

classmethod from_data(sent: Sent, data: dict[str, int | list[int] | None]) Self[source]

Construct from data dictionary.

Parameters:
  • sent – Sentence object.

  • data – Data dictionary.

  • cdict – Mapping from ordinal numbers to components.

to_data() dict[str, int | list[int] | None][source]

Dump to data dictionary.

Parameters:

odict – Mapping from components to their ordinal numbers within the sentence sequence.

Returns:

Dictionary with list of components ordinal numbers and and index of the conjunction token, or None.

Return type:

data

classmethod find_groups(phrases: Iterable[Phrase]) Iterable[Self][source]

Find conjuncts groups in phrases.

classmethod get_chain(phrases: Iterable[Phrase]) DataTuple[Conjuncts][source]

Get chain of conjuncts groups in phrases.