segram.nlp.grammar.sent module

class segram.nlp.grammar.sent.SentNLP(*args: Any, **kwds: Any)[source]

Bases: GrammarNLP, Sent

Abstract base class for sentence elements with NLP backend methods.

All grammar classes must be defined as slots classes. This is necessary for ensuring low-memory footprint and better computational efficiency. Even classes with no new slots need to declare __slots__ = (). This requirement is checked during class construction. Other class-specific requirements of this sort as well as their related validation checks may be implemented on specialized grammar classes using the standard __init_subclass__ interface. This allows abstract base classes further down the inheritance chain to check for more complex requirements as well as apply dynamic class customizations.

Find phrase links.

abstract find_conjs() Iterable[Conjuncts][source]

Iterate over groups of conjoined components.

abstract add_subs() None[source]

Add free subtree tokens to components.

classmethod from_sent(sent: Span) Sent[source]

Construct from a sentence span object.

make_mutable_children() None[source]

Make children lists in self.graph mutable sets.

Destroy original conjunct links.

propagate_children_conjuncts() None[source]

Propagate conjuncts of children to their parents.

propagate_subjects() None[source]

Propagete subjects to subject-free conjuncts.

propagate_descriptions() None[source]

Propagate descriptions to description-free conjuncts.

propagate_cdesc_subclauses() None[source]

Propagate subclauses between clausal descriptions.

freeze_children() None[source]

Freeze children lists.