segram.nlp.backend.rulebased.lang.en.grammar.components module

class segram.nlp.backend.rulebased.lang.en.grammar.components.RulebasedEnglishComponent(*args: Any, **kwds: Any)[source]

Bases: RulebasedEnglishGrammar, EnglishComponent, ComponentNLP

Rule-based English spacy grammar component.

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.

get_dep(parent: EnglishComponent) Dep | None[source]

Get dependency between self and parent.

class segram.nlp.backend.rulebased.lang.en.grammar.components.RulebasedEnglishVerb(*args: Any, **kwds: Any)[source]

Bases: RulebasedEnglishComponent, EnglishVerb

Rule-based English spacy verb component.

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.

classmethod is_head(tok: Token) bool[source]

Test for head token.

classmethod get_tense(verb: EnglishVerb) Tense[source]

Get tense of verb.

classmethod get_modal(verb: EnglishVerb) Tense[source]

Get modality of verb.

classmethod get_mood(verb: EnglishVerb) Mood[source]

Get mood of verb.

classmethod find_part(tok: Token) Token | None[source]

Find particle token.

classmethod find_aux(tok: Token) tuple[Token, ...][source]

Find (verb) auxiliary tokens.

classmethod find_expl(tok: Token) Token | None[source]

Find expletive token.

class segram.nlp.backend.rulebased.lang.en.grammar.components.RulebasedEnglishNoun(*args: Any, **kwds: Any)[source]

Bases: RulebasedEnglishComponent, EnglishNoun

Rule-based English spacy noun component.

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.

classmethod is_head(tok: Token) bool[source]

Test for head token.

class segram.nlp.backend.rulebased.lang.en.grammar.components.RulebasedEnglishPrep(*args: Any, **kwds: Any)[source]

Bases: RulebasedEnglishComponent, EnglishPrep

Rule-based English spacy preposition component.

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.

classmethod is_head(tok: Token) bool[source]

Test for head token.

classmethod find_preps(tok: Token) Iterable[Token][source]

Find preposition chain.

class segram.nlp.backend.rulebased.lang.en.grammar.components.RulebasedEnglishDesc(*args: Any, **kwds: Any)[source]

Bases: RulebasedEnglishComponent, EnglishDesc

Rule-based English spacy description component.

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.

classmethod is_head(tok: Token) bool[source]

Test for head token.

classmethod find_mod(tok: Token) Iterable[Token][source]

Find modifier tokens.

classmethod find_det(tok: EnglishDesc) Token | None[source]

Find determiner token.