decomp.semantics.predpatt.rules¶
Linguistic rules for identifying predicates and extracting their arguments from dependency parse structures.
Linguistic rules for predicate-argument extraction in PredPatt.
This module implements the rule system that drives PredPatt’s extraction of predicates and arguments from Universal Dependencies parses. Rules are organized into categories based on their linguistic function.
The rule system consists of:
Predicate rules: Identify verbal and non-verbal predicates
Argument rules: Extract syntactic arguments of predicates
Resolution rules: Handle complex phenomena like coordination
Simplification rules: Optional rules for simplified extraction
Classes¶
- Rule
Abstract base class for all extraction rules.
- PredicateRootRule
Rules for identifying predicate root tokens.
- ArgumentRootRule
Rules for extracting argument root tokens.
- PredPhraseRule
Rules for building predicate phrases.
- ArgPhraseRule
Rules for building argument phrases.
- ArgumentResolution
Rules for resolving complex argument structures.
- ConjunctionResolution
Rules for handling coordinated structures.
- SimplifyRule
Rules for simplified extraction mode.
- LanguageSpecific
Base class for language-specific rules.
- EnglishSpecific
Rules specific to English syntax.
Functions¶
- gov_looks_like_predicate
Helper to check if a governor token is predicate-like.
Notes
Rules are identified by single letters (A-W) or letter-number combinations (A1, N2). Lowercase aliases are provided for backward compatibility.
- class A1[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of clausal relation {ccomp, csub, csubjpass}.
- class A2[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of clausal complement ‘xcomp’.
- class G1[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the dependent of the following relations.
Relations: {nsubj, nsubjpass, dobj, iobj}.
- class H1[source]¶
Bases:
ArgumentRootRuleExtract an argument token, which directly depends on the predicate token.
Extracts from the dependent of the relations {nmod, nmod:npmod, nmod:tmod}.
- class H2[source]¶
Bases:
ArgumentRootRuleExtract an argument token, which indirectly depends on the predicate token.
Extracts from the dependent of the relations {nmod, nmod:npmod, nmod:tmod}.
- class N1[source]¶
Bases:
PredPhraseRuleExtract a token from the subtree of the predicate root token.
Adds the token to the predicate phrase.
- class N2[source]¶
Bases:
PredPhraseRuleDrop a token, which is an argument root token, from the predicate subtree.
- class N3[source]¶
Bases:
PredPhraseRuleDrop a token, which is another predicate root token, from the predicate subtree.
- class N4[source]¶
Bases:
PredPhraseRuleDrop a token which is a dependent of specific relations from the predicate subtree.
Relations: {ccomp, csubj, advcl, acl, acl:relcl, nmod:tmod, parataxis, appos, dep}.
- class N5[source]¶
Bases:
PredPhraseRuleDrop a conjunct token from the predicate subtree.
Drops conjuncts of the predicate root token or conjuncts of a xcomp’s dependent token.
- class N6[source]¶
Bases:
PredPhraseRuleAdd a case phrase to the predicate phrase.
- class P1[source]¶
Bases:
SimplifyRuleRemove a non-core argument, a nominal modifier, from the predpatt.
- class P2[source]¶
Bases:
SimplifyRuleRemove an argument of other type from the predpatt.
- class W1[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the governor of ‘nmod:poss’ (English specific).
- class W2[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the dependent of ‘nmod:poss’ (English specific).
- class ArgPhraseRule[source]¶
Bases:
RuleBase class for rules that build argument phrases.
These rules determine which tokens from the dependency subtree should be included in the argument phrase.
- class ArgResolveRelcl[source]¶
Bases:
ArgumentResolutionResolve argument of a predicate inside a relative clause.
The missing argument that we take is rooted at the governor of the acl dependency relation (type
acl:*) pointing at the embedded predicate.
- class ArgumentResolution[source]¶
Bases:
RuleBase class for rules that resolve missing or borrowed arguments.
These rules handle cases where predicates need to borrow arguments from other predicates or resolve missing arguments.
- class ArgumentRootRule[source]¶
Bases:
RuleBase class for rules that identify argument root tokens.
These rules are applied during the argument extraction phase to identify which tokens should be considered argument roots.
- class B[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of clausal modifier.
- class BorrowObj[source]¶
Bases:
ArgumentResolutionBorrow object from governor in (conj, xcomp of conj root, and advcl).
if gov_rel==’conj’ and missing a subject, try to borrow the subject from the other event. Still no subject. Try looking at xcomp of conjunction root.
if gov_rel==advcl and not event.has_subj() then borrow from governor.
- class BorrowSubj[source]¶
Bases:
ArgumentResolutionBorrow subject from governor in (conj, xcomp of conj root, and advcl).
if gov_rel==’conj’ and missing a subject, try to borrow the subject from the other event. Still no subject. Try looking at xcomp of conjunction root.
if gov_rel==advcl and not event.has_subj() then borrow from governor.
- class C[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the governor of predicate-indicating relations.
Relations: {nsubj, nsubjpass, dobj, iobj, ccomp, xcomp, advcl}.
- __init__(e)[source]¶
Initialize with the dependency edge that triggered this rule.
- Parameters:
e (DepTriple) – The dependency edge with a predicate-indicating relation.
- class CleanArgToken[source]¶
Bases:
ArgPhraseRuleExtract a token from the subtree of the argument root token.
Adds the token to the argument phrase.
- class ConjunctionResolution[source]¶
Bases:
RuleBase class for rules handling argument conjunctions.
These rules manage how conjoined arguments are processed and expanded.
- class CutBorrowObj[source]¶
Bases:
ArgumentResolutionBorrow object from another predicate in a cut structure.
- class CutBorrowOther[source]¶
Bases:
ArgumentResolutionBorrow an argument from another predicate in a cut structure.
- class CutBorrowSubj[source]¶
Bases:
ArgumentResolutionBorrow subject from another predicate in a cut structure.
- class D[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of apposition.
- class DropAppos[source]¶
Bases:
ArgPhraseRuleDrop apposition from argument phrase.
- class DropCc[source]¶
Bases:
ArgPhraseRuleDrop the argument’s cc (coordinating conjunction) from the argument subtree.
- class DropConj[source]¶
Bases:
ArgPhraseRuleDrop the argument’s conjuct from the subtree of the argument root token.
- class DropUnknown[source]¶
Bases:
ArgPhraseRuleDrop unknown dependency from argument phrase.
- class E[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of an adjectival modifier.
- class EmbeddedAdvcl[source]¶
Bases:
ArgPhraseRuleDrop embedded adverbial clause from argument phrase.
- class EmbeddedCcomp[source]¶
Bases:
ArgPhraseRuleDrop embedded clausal complement from argument phrase.
- class EmbeddedUnknown[source]¶
Bases:
ArgPhraseRuleDrop embedded unknown structure from argument phrase.
- EnRelclDummyArgFilterArg¶
alias of
EnRelclDummyArgFilter
- EnRelclDummyArgFilterPred¶
alias of
EnRelclDummyArgFilter
- class EnglishSpecific[source]¶
Bases:
LanguageSpecificBase class for English-specific rules.
These rules handle English-specific phenomena like possessives and certain syntactic constructions.
- class F[source]¶
Bases:
PredicateRootRuleExtract a conjunct token of a predicate token.
- class J[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the governor of apposition.
- class K[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the dependent of clausal complement ‘ccomp’.
- class L[source]¶
Bases:
ArgumentResolutionMerge the argument token set of xcomp’s dependent to the real predicate token.
- class LanguageSpecific[source]¶
Bases:
RuleBase class for language-specific rules.
These rules apply only to specific languages and handle language-specific phenomena.
- class M[source]¶
Bases:
ConjunctionResolutionExtract a conjunct token of the argument root token.
- class MoveCaseTokenToPred[source]¶
Bases:
ArgPhraseRuleExtract a case token from the subtree of the argument root token.
- class PredConjBorrowAuxNeg[source]¶
Bases:
PredConjRuleBorrow aux and neg tokens from conjoined predicate’s name.
- class PredConjBorrowTokensXcomp[source]¶
Bases:
PredConjRuleBorrow tokens from xcomp in a conjunction or predicates.
- class PredConjRule[source]¶
Bases:
RuleBase class for rules handling predicate conjunctions.
These rules manage how conjoined predicates share or borrow elements like auxiliaries and negations.
- class PredPhraseRule[source]¶
Bases:
RuleBase class for rules that build predicate phrases.
These rules determine which tokens from the dependency subtree should be included in the predicate phrase.
- class PredResolveRelcl[source]¶
Bases:
ArgumentResolutionPredicate has an argument from relcl resolution (arg_resolve_relcl).
- class PredicateHas[source]¶
Bases:
ArgPhraseRuleDrop a token, which is a predicate root token, from the argument subtree.
- class PredicateRootRule[source]¶
Bases:
RuleBase class for rules that identify predicate root tokens.
These rules are applied during the predicate extraction phase to identify which tokens should be considered predicate roots.
- class Q[source]¶
Bases:
SimplifyRuleRemove an adverbial modifier in the predicate phrase.
- class R[source]¶
Bases:
SimplifyRuleRemove auxiliary in the predicate phrase.
- class Rule[source]¶
Bases:
objectAbstract base class for all PredPatt rules.
Rules are used to track extraction logic and provide explanations for why certain tokens were identified as predicates or arguments.
- __hash__()[source]¶
Get hash of rule for use in sets/dicts.
- Returns:
Hash based on class name.
- Return type:
- __repr__()[source]¶
Return string representation of the rule.
- Returns:
The rule’s name by default.
- Return type:
Bases:
ArgumentResolutionCreate an argument sharing tokens with another argument.
- class SimplifyRule[source]¶
Bases:
RuleBase class for rules that simplify patterns.
These rules are applied when options.simple=True to create simpler predicate-argument patterns.
- class SpecialArgDropDirectDep[source]¶
Bases:
ArgPhraseRuleDrop special direct dependencies from argument phrase.
- class U[source]¶
Bases:
SimplifyRuleStrip the punct in the phrase.
- class V[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of ‘nmod:poss’ (English specific).
- arg_resolve_relcl¶
alias of
ArgResolveRelcl
- borrow_subj¶
alias of
BorrowSubj
- clean_arg_token¶
alias of
CleanArgToken
- cut_borrow_obj¶
alias of
CutBorrowObj
- cut_borrow_other¶
alias of
CutBorrowOther
- cut_borrow_subj¶
alias of
CutBorrowSubj
- drop_unknown¶
alias of
DropUnknown
- embedded_advcl¶
alias of
EmbeddedAdvcl
- embedded_ccomp¶
alias of
EmbeddedCcomp
- embedded_unknown¶
alias of
EmbeddedUnknown
- en_relcl_dummy_arg_filter¶
alias of
EnRelclDummyArgFilter
- gov_looks_like_predicate(e, ud)[source]¶
Check if the governor of an edge looks like a predicate.
A token “looks like” a predicate if it has potential arguments based on its POS tag and the dependency relations it participates in.
- move_case_token_to_pred¶
alias of
MoveCaseTokenToPred
- pred_conj_borrow_aux_neg¶
alias of
PredConjBorrowAuxNeg
- pred_conj_borrow_tokens_xcomp¶
alias of
PredConjBorrowTokensXcomp
- pred_resolve_relcl¶
alias of
PredResolveRelcl
- predicate_has¶
alias of
PredicateHas
alias of
ShareArgument
- special_arg_drop_direct_dep¶
alias of
SpecialArgDropDirectDep
Submodules¶
decomp.semantics.predpatt.rules.base¶
Base rule classes for PredPatt extraction system.
This module defines the abstract base classes for all rules used in PredPatt. Rules track the logic behind extraction decisions and provide explanations.
- class Rule[source]¶
Bases:
objectAbstract base class for all PredPatt rules.
Rules are used to track extraction logic and provide explanations for why certain tokens were identified as predicates or arguments.
- __repr__()[source]¶
Return string representation of the rule.
- Returns:
The rule’s name by default.
- Return type:
- classmethod name()[source]¶
Get the rule’s name.
- Returns:
The class name without module prefix, converted to lowercase for backward compatibility with expected outputs.
- Return type:
- classmethod explain()[source]¶
Get explanation of what this rule does.
- Returns:
The rule’s docstring explaining its purpose.
- Return type:
- class PredicateRootRule[source]¶
Bases:
RuleBase class for rules that identify predicate root tokens.
These rules are applied during the predicate extraction phase to identify which tokens should be considered predicate roots.
- class ArgumentRootRule[source]¶
Bases:
RuleBase class for rules that identify argument root tokens.
These rules are applied during the argument extraction phase to identify which tokens should be considered argument roots.
- class PredConjRule[source]¶
Bases:
RuleBase class for rules handling predicate conjunctions.
These rules manage how conjoined predicates share or borrow elements like auxiliaries and negations.
- class ArgumentResolution[source]¶
Bases:
RuleBase class for rules that resolve missing or borrowed arguments.
These rules handle cases where predicates need to borrow arguments from other predicates or resolve missing arguments.
- class ConjunctionResolution[source]¶
Bases:
RuleBase class for rules handling argument conjunctions.
These rules manage how conjoined arguments are processed and expanded.
- class SimplifyRule[source]¶
Bases:
RuleBase class for rules that simplify patterns.
These rules are applied when options.simple=True to create simpler predicate-argument patterns.
- class PredPhraseRule[source]¶
Bases:
RuleBase class for rules that build predicate phrases.
These rules determine which tokens from the dependency subtree should be included in the predicate phrase.
- class ArgPhraseRule[source]¶
Bases:
RuleBase class for rules that build argument phrases.
These rules determine which tokens from the dependency subtree should be included in the argument phrase.
- class LanguageSpecific[source]¶
Bases:
RuleBase class for language-specific rules.
These rules apply only to specific languages and handle language-specific phenomena.
- class EnglishSpecific[source]¶
Bases:
LanguageSpecificBase class for English-specific rules.
These rules handle English-specific phenomena like possessives and certain syntactic constructions.
decomp.semantics.predpatt.rules.predicate_rules¶
Predicate extraction rules for PredPatt.
This module contains rules for identifying predicate root tokens, building predicate phrases, and handling predicate-specific phenomena.
- class A1[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of clausal relation {ccomp, csub, csubjpass}.
- class A2[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of clausal complement ‘xcomp’.
- class B[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of clausal modifier.
- class C[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the governor of predicate-indicating relations.
Relations: {nsubj, nsubjpass, dobj, iobj, ccomp, xcomp, advcl}.
- class D[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of apposition.
- class E[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of an adjectival modifier.
- class V[source]¶
Bases:
PredicateRootRuleExtract a predicate token from the dependent of ‘nmod:poss’ (English specific).
- class F[source]¶
Bases:
PredicateRootRuleExtract a conjunct token of a predicate token.
- class PredConjBorrowAuxNeg[source]¶
Bases:
PredConjRuleBorrow aux and neg tokens from conjoined predicate’s name.
- class PredConjBorrowTokensXcomp[source]¶
Bases:
PredConjRuleBorrow tokens from xcomp in a conjunction or predicates.
- class N1[source]¶
Bases:
PredPhraseRuleExtract a token from the subtree of the predicate root token.
Adds the token to the predicate phrase.
- class N2[source]¶
Bases:
PredPhraseRuleDrop a token, which is an argument root token, from the predicate subtree.
- class N3[source]¶
Bases:
PredPhraseRuleDrop a token, which is another predicate root token, from the predicate subtree.
- class N4[source]¶
Bases:
PredPhraseRuleDrop a token which is a dependent of specific relations from the predicate subtree.
Relations: {ccomp, csubj, advcl, acl, acl:relcl, nmod:tmod, parataxis, appos, dep}.
- class N5[source]¶
Bases:
PredPhraseRuleDrop a conjunct token from the predicate subtree.
Drops conjuncts of the predicate root token or conjuncts of a xcomp’s dependent token.
- class N6[source]¶
Bases:
PredPhraseRuleAdd a case phrase to the predicate phrase.
- class P1[source]¶
Bases:
SimplifyRuleRemove a non-core argument, a nominal modifier, from the predpatt.
- class P2[source]¶
Bases:
SimplifyRuleRemove an argument of other type from the predpatt.
- class Q[source]¶
Bases:
SimplifyRuleRemove an adverbial modifier in the predicate phrase.
- class R[source]¶
Bases:
SimplifyRuleRemove auxiliary in the predicate phrase.
- class U[source]¶
Bases:
SimplifyRuleStrip the punct in the phrase.
- class EnRelclDummyArgFilter[source]¶
Bases:
EnglishSpecificFilter out dummy arguments in English relative clauses.
decomp.semantics.predpatt.rules.argument_rules¶
Argument extraction rules for PredPatt.
This module contains rules for identifying argument root tokens, resolving missing arguments, and building argument phrases.
- class G1[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the dependent of the following relations.
Relations: {nsubj, nsubjpass, dobj, iobj}.
- class H1[source]¶
Bases:
ArgumentRootRuleExtract an argument token, which directly depends on the predicate token.
Extracts from the dependent of the relations {nmod, nmod:npmod, nmod:tmod}.
- class H2[source]¶
Bases:
ArgumentRootRuleExtract an argument token, which indirectly depends on the predicate token.
Extracts from the dependent of the relations {nmod, nmod:npmod, nmod:tmod}.
- class RuleI[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the governor of an adjectival modifier.
- class J[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the governor of apposition.
- class W1[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the governor of ‘nmod:poss’ (English specific).
- class W2[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the dependent of ‘nmod:poss’ (English specific).
- class K[source]¶
Bases:
ArgumentRootRuleExtract an argument token from the dependent of clausal complement ‘ccomp’.
- class CutBorrowOther[source]¶
Bases:
ArgumentResolutionBorrow an argument from another predicate in a cut structure.
- class CutBorrowSubj[source]¶
Bases:
ArgumentResolutionBorrow subject from another predicate in a cut structure.
- class CutBorrowObj[source]¶
Bases:
ArgumentResolutionBorrow object from another predicate in a cut structure.
- class BorrowSubj[source]¶
Bases:
ArgumentResolutionBorrow subject from governor in (conj, xcomp of conj root, and advcl).
if gov_rel==’conj’ and missing a subject, try to borrow the subject from the other event. Still no subject. Try looking at xcomp of conjunction root.
if gov_rel==advcl and not event.has_subj() then borrow from governor.
- class BorrowObj[source]¶
Bases:
ArgumentResolutionBorrow object from governor in (conj, xcomp of conj root, and advcl).
if gov_rel==’conj’ and missing a subject, try to borrow the subject from the other event. Still no subject. Try looking at xcomp of conjunction root.
if gov_rel==advcl and not event.has_subj() then borrow from governor.
Bases:
ArgumentResolutionCreate an argument sharing tokens with another argument.
- class ArgResolveRelcl[source]¶
Bases:
ArgumentResolutionResolve argument of a predicate inside a relative clause.
The missing argument that we take is rooted at the governor of the acl dependency relation (type
acl:*) pointing at the embedded predicate.
- class PredResolveRelcl[source]¶
Bases:
ArgumentResolutionPredicate has an argument from relcl resolution (arg_resolve_relcl).
- class L[source]¶
Bases:
ArgumentResolutionMerge the argument token set of xcomp’s dependent to the real predicate token.
- class M[source]¶
Bases:
ConjunctionResolutionExtract a conjunct token of the argument root token.
- class CleanArgToken[source]¶
Bases:
ArgPhraseRuleExtract a token from the subtree of the argument root token.
Adds the token to the argument phrase.
- class MoveCaseTokenToPred[source]¶
Bases:
ArgPhraseRuleExtract a case token from the subtree of the argument root token.
- class PredicateHas[source]¶
Bases:
ArgPhraseRuleDrop a token, which is a predicate root token, from the argument subtree.
- class DropAppos[source]¶
Bases:
ArgPhraseRuleDrop apposition from argument phrase.
- class DropUnknown[source]¶
Bases:
ArgPhraseRuleDrop unknown dependency from argument phrase.
- class DropCc[source]¶
Bases:
ArgPhraseRuleDrop the argument’s cc (coordinating conjunction) from the argument subtree.
- class DropConj[source]¶
Bases:
ArgPhraseRuleDrop the argument’s conjuct from the subtree of the argument root token.
- class SpecialArgDropDirectDep[source]¶
Bases:
ArgPhraseRuleDrop special direct dependencies from argument phrase.
- class EmbeddedAdvcl[source]¶
Bases:
ArgPhraseRuleDrop embedded adverbial clause from argument phrase.
- class EmbeddedCcomp[source]¶
Bases:
ArgPhraseRuleDrop embedded clausal complement from argument phrase.
- class EmbeddedUnknown[source]¶
Bases:
ArgPhraseRuleDrop embedded unknown structure from argument phrase.
- class EnRelclDummyArgFilter[source]¶
Bases:
EnglishSpecificFilter out dummy arguments in English relative clauses.
This rule removes arguments with phrases like ‘that’, ‘which’, ‘who’ from predicates that have undergone relative clause resolution.
decomp.semantics.predpatt.rules.helpers¶
Helper functions for rule application.
This module contains utility functions used by rules to determine when certain rules should be applied.