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: PredicateRootRule

Extract a predicate token from the dependent of clausal relation {ccomp, csub, csubjpass}.

rule_type: str = 'predicate_root'
class A2[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of clausal complement ‘xcomp’.

rule_type: str = 'predicate_root'
class G1[source]

Bases: ArgumentRootRule

Extract an argument token from the dependent of the following relations.

Relations: {nsubj, nsubjpass, dobj, iobj}.

__init__(edge)[source]

Initialize with the dependency edge.

Parameters:

edge (DepTriple) – The dependency edge with a core argument relation.

__repr__()[source]

Return string representation showing the relation.

Returns:

Formatted string showing the relation type.

Return type:

str

class H1[source]

Bases: ArgumentRootRule

Extract 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: ArgumentRootRule

Extract 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: PredPhraseRule

Extract a token from the subtree of the predicate root token.

Adds the token to the predicate phrase.

class N2[source]

Bases: PredPhraseRule

Drop a token, which is an argument root token, from the predicate subtree.

class N3[source]

Bases: PredPhraseRule

Drop a token, which is another predicate root token, from the predicate subtree.

class N4[source]

Bases: PredPhraseRule

Drop 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: PredPhraseRule

Drop 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: PredPhraseRule

Add a case phrase to the predicate phrase.

class P1[source]

Bases: SimplifyRule

Remove a non-core argument, a nominal modifier, from the predpatt.

class P2[source]

Bases: SimplifyRule

Remove an argument of other type from the predpatt.

class W1[source]

Bases: ArgumentRootRule

Extract an argument token from the governor of ‘nmod:poss’ (English specific).

class W2[source]

Bases: ArgumentRootRule

Extract an argument token from the dependent of ‘nmod:poss’ (English specific).

class ArgPhraseRule[source]

Bases: Rule

Base class for rules that build argument phrases.

These rules determine which tokens from the dependency subtree should be included in the argument phrase.

type: str = 'arg_phrase'
class ArgResolveRelcl[source]

Bases: ArgumentResolution

Resolve 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: Rule

Base 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.

type: str = 'argument_resolution'
class ArgumentRootRule[source]

Bases: Rule

Base 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.

rule_type: str = 'argument_root'
class B[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of clausal modifier.

rule_type: str = 'predicate_root'
class BorrowObj[source]

Bases: ArgumentResolution

Borrow 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.

__init__(obj, friend)[source]

Initialize with the object argument and friend predicate.

Parameters:
  • obj (Argument) – The object argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class BorrowSubj[source]

Bases: ArgumentResolution

Borrow 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.

__init__(subj, friend)[source]

Initialize with the subject argument and friend predicate.

Parameters:
  • subj (Argument) – The subject argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class C[source]

Bases: PredicateRootRule

Extract 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.

__repr__()[source]

Return string representation showing the edge details.

Returns:

Formatted string showing governor, relation, and dependent.

Return type:

str

rule_type: str = 'predicate_root'
class CleanArgToken[source]

Bases: ArgPhraseRule

Extract a token from the subtree of the argument root token.

Adds the token to the argument phrase.

__init__(x)[source]

Initialize with the token to include.

Parameters:

x (Token) – The token to add to the argument phrase.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is included.

Return type:

str

class ConjunctionResolution[source]

Bases: Rule

Base class for rules handling argument conjunctions.

These rules manage how conjoined arguments are processed and expanded.

type: str = 'conjunction_resolution'
class CutBorrowObj[source]

Bases: ArgumentResolution

Borrow object from another predicate in a cut structure.

__init__(obj, friend)[source]

Initialize with the object argument and friend predicate.

Parameters:
  • obj (Argument) – The object argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class CutBorrowOther[source]

Bases: ArgumentResolution

Borrow an argument from another predicate in a cut structure.

__init__(borrowed, friend)[source]

Initialize with the borrowed argument and friend predicate.

Parameters:
  • borrowed (Argument) – The argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

class CutBorrowSubj[source]

Bases: ArgumentResolution

Borrow subject from another predicate in a cut structure.

__init__(subj, friend)[source]

Initialize with the subject argument and friend predicate.

Parameters:
  • subj (Argument) – The subject argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class D[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of apposition.

rule_type: str = 'predicate_root'
class DropAppos[source]

Bases: ArgPhraseRule

Drop apposition from argument phrase.

__init__(x)[source]

Initialize with the apposition token to drop.

Parameters:

x (Token) – The apposition token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class DropCc[source]

Bases: ArgPhraseRule

Drop the argument’s cc (coordinating conjunction) from the argument subtree.

__init__(x)[source]

Initialize with the cc token to drop.

Parameters:

x (Token) – The coordinating conjunction token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class DropConj[source]

Bases: ArgPhraseRule

Drop the argument’s conjuct from the subtree of the argument root token.

__init__(x)[source]

Initialize with the conjunct token to drop.

Parameters:

x (Token) – The conjunct token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class DropUnknown[source]

Bases: ArgPhraseRule

Drop unknown dependency from argument phrase.

__init__(x)[source]

Initialize with the unknown token to drop.

Parameters:

x (Token) – The unknown token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class E[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of an adjectival modifier.

rule_type: str = 'predicate_root'
class EmbeddedAdvcl[source]

Bases: ArgPhraseRule

Drop embedded adverbial clause from argument phrase.

__init__(x)[source]

Initialize with the advcl token to drop.

Parameters:

x (Token) – The adverbial clause token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class EmbeddedCcomp[source]

Bases: ArgPhraseRule

Drop embedded clausal complement from argument phrase.

__init__(x)[source]

Initialize with the ccomp token to drop.

Parameters:

x (Token) – The clausal complement token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class EmbeddedUnknown[source]

Bases: ArgPhraseRule

Drop embedded unknown structure from argument phrase.

__init__(x)[source]

Initialize with the unknown token to drop.

Parameters:

x (Token) – The unknown embedded token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

EnRelclDummyArgFilterArg

alias of EnRelclDummyArgFilter

EnRelclDummyArgFilterPred

alias of EnRelclDummyArgFilter

class EnglishSpecific[source]

Bases: LanguageSpecific

Base class for English-specific rules.

These rules handle English-specific phenomena like possessives and certain syntactic constructions.

lang: str = 'English'
class F[source]

Bases: PredicateRootRule

Extract a conjunct token of a predicate token.

rule_type: str = 'predicate_root'
I

alias of RuleI

class J[source]

Bases: ArgumentRootRule

Extract an argument token from the governor of apposition.

class K[source]

Bases: ArgumentRootRule

Extract an argument token from the dependent of clausal complement ‘ccomp’.

class L[source]

Bases: ArgumentResolution

Merge the argument token set of xcomp’s dependent to the real predicate token.

class LanguageSpecific[source]

Bases: Rule

Base class for language-specific rules.

These rules apply only to specific languages and handle language-specific phenomena.

lang: str | None = None
class M[source]

Bases: ConjunctionResolution

Extract a conjunct token of the argument root token.

class MoveCaseTokenToPred[source]

Bases: ArgPhraseRule

Extract a case token from the subtree of the argument root token.

__init__(x)[source]

Initialize with the case token to move.

Parameters:

x (Token) – The case token to move to predicate.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is moved.

Return type:

str

class PredConjBorrowAuxNeg[source]

Bases: PredConjRule

Borrow aux and neg tokens from conjoined predicate’s name.

__init__(friend, borrowed_token)[source]

Initialize with the friend predicate and borrowed token.

Parameters:
  • friend (Predicate) – The predicate we’re borrowing from.

  • borrowed_token (Token) – The aux or neg token being borrowed.

class PredConjBorrowTokensXcomp[source]

Bases: PredConjRule

Borrow tokens from xcomp in a conjunction or predicates.

__init__(friend, borrowed_token)[source]

Initialize with the friend predicate and borrowed token.

Parameters:
  • friend (Predicate) – The predicate we’re borrowing from.

  • borrowed_token (Token) – The token being borrowed from xcomp.

class PredConjRule[source]

Bases: Rule

Base class for rules handling predicate conjunctions.

These rules manage how conjoined predicates share or borrow elements like auxiliaries and negations.

type: str = 'predicate_conj'
class PredPhraseRule[source]

Bases: Rule

Base class for rules that build predicate phrases.

These rules determine which tokens from the dependency subtree should be included in the predicate phrase.

__init__(x)[source]

Initialize with the token being processed.

Parameters:

x (Token) – The token being considered for the predicate phrase.

type: str = 'pred_phrase'
class PredResolveRelcl[source]

Bases: ArgumentResolution

Predicate has an argument from relcl resolution (arg_resolve_relcl).

class PredicateHas[source]

Bases: ArgPhraseRule

Drop a token, which is a predicate root token, from the argument subtree.

__init__(x)[source]

Initialize with the predicate token to drop.

Parameters:

x (Token) – The predicate token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class PredicateRootRule[source]

Bases: Rule

Base 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.

rule_type: str = 'predicate_root'
class Q[source]

Bases: SimplifyRule

Remove an adverbial modifier in the predicate phrase.

class R[source]

Bases: SimplifyRule

Remove auxiliary in the predicate phrase.

class Rule[source]

Bases: object

Abstract 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.

__eq__(other)[source]

Compare rules for equality.

Parameters:

other (object) – Another object to compare with.

Returns:

True if rules are of the same type.

Return type:

bool

__hash__()[source]

Get hash of rule for use in sets/dicts.

Returns:

Hash based on class name.

Return type:

int

__init__()[source]

Initialize rule instance.

__repr__()[source]

Return string representation of the rule.

Returns:

The rule’s name by default.

Return type:

str

classmethod explain()[source]

Get explanation of what this rule does.

Returns:

The rule’s docstring explaining its purpose.

Return type:

str

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:

str

class ShareArgument[source]

Bases: ArgumentResolution

Create an argument sharing tokens with another argument.

class SimplifyRule[source]

Bases: Rule

Base class for rules that simplify patterns.

These rules are applied when options.simple=True to create simpler predicate-argument patterns.

type: str = 'simple'
class SpecialArgDropDirectDep[source]

Bases: ArgPhraseRule

Drop special direct dependencies from argument phrase.

__init__(x)[source]

Initialize with the token to drop.

Parameters:

x (Token) – The token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class U[source]

Bases: SimplifyRule

Strip the punct in the phrase.

class V[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of ‘nmod:poss’ (English specific).

rule_type: str = 'predicate_root'
a1

alias of A1

a2

alias of A2

arg_resolve_relcl

alias of ArgResolveRelcl

b

alias of B

borrow_obj

alias of BorrowObj

borrow_subj

alias of BorrowSubj

c

alias of C

clean_arg_token

alias of CleanArgToken

cut_borrow_obj

alias of CutBorrowObj

cut_borrow_other

alias of CutBorrowOther

cut_borrow_subj

alias of CutBorrowSubj

d

alias of D

drop_appos

alias of DropAppos

drop_cc

alias of DropCc

drop_conj

alias of DropConj

drop_unknown

alias of DropUnknown

e

alias of E

embedded_advcl

alias of EmbeddedAdvcl

embedded_ccomp

alias of EmbeddedCcomp

embedded_unknown

alias of EmbeddedUnknown

en_relcl_dummy_arg_filter

alias of EnRelclDummyArgFilter

f

alias of F

g1

alias of G1

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.

Parameters:
  • e (DepTriple) – The dependency edge to check.

  • ud (UniversalDependencies) – The UD schema containing relation definitions.

Returns:

True if the governor looks like a predicate.

Return type:

bool

h1

alias of H1

h2

alias of H2

i

alias of RuleI

j

alias of J

k

alias of K

l

alias of L

l_rule

alias of L

m

alias of M

move_case_token_to_pred

alias of MoveCaseTokenToPred

n1

alias of N1

n2

alias of N2

n3

alias of N3

n4

alias of N4

n5

alias of N5

n6

alias of N6

p1

alias of P1

p2

alias of P2

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

q

alias of Q

r

alias of R

share_argument

alias of ShareArgument

special_arg_drop_direct_dep

alias of SpecialArgDropDirectDep

u

alias of U

v

alias of V

w1

alias of W1

w2

alias of W2

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: object

Abstract 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.

__init__()[source]

Initialize rule instance.

__repr__()[source]

Return string representation of the rule.

Returns:

The rule’s name by default.

Return type:

str

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:

str

classmethod explain()[source]

Get explanation of what this rule does.

Returns:

The rule’s docstring explaining its purpose.

Return type:

str

__eq__(other)[source]

Compare rules for equality.

Parameters:

other (object) – Another object to compare with.

Returns:

True if rules are of the same type.

Return type:

bool

__hash__()[source]

Get hash of rule for use in sets/dicts.

Returns:

Hash based on class name.

Return type:

int

class PredicateRootRule[source]

Bases: Rule

Base 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.

rule_type: str = 'predicate_root'
class ArgumentRootRule[source]

Bases: Rule

Base 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.

rule_type: str = 'argument_root'
class PredConjRule[source]

Bases: Rule

Base class for rules handling predicate conjunctions.

These rules manage how conjoined predicates share or borrow elements like auxiliaries and negations.

type: str = 'predicate_conj'
class ArgumentResolution[source]

Bases: Rule

Base 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.

type: str = 'argument_resolution'
class ConjunctionResolution[source]

Bases: Rule

Base class for rules handling argument conjunctions.

These rules manage how conjoined arguments are processed and expanded.

type: str = 'conjunction_resolution'
class SimplifyRule[source]

Bases: Rule

Base class for rules that simplify patterns.

These rules are applied when options.simple=True to create simpler predicate-argument patterns.

type: str = 'simple'
class PredPhraseRule[source]

Bases: Rule

Base class for rules that build predicate phrases.

These rules determine which tokens from the dependency subtree should be included in the predicate phrase.

type: str = 'pred_phrase'
__init__(x)[source]

Initialize with the token being processed.

Parameters:

x (Token) – The token being considered for the predicate phrase.

class ArgPhraseRule[source]

Bases: Rule

Base class for rules that build argument phrases.

These rules determine which tokens from the dependency subtree should be included in the argument phrase.

type: str = 'arg_phrase'
class LanguageSpecific[source]

Bases: Rule

Base class for language-specific rules.

These rules apply only to specific languages and handle language-specific phenomena.

lang: str | None = None
class EnglishSpecific[source]

Bases: LanguageSpecific

Base class for English-specific rules.

These rules handle English-specific phenomena like possessives and certain syntactic constructions.

lang: str = 'English'

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: PredicateRootRule

Extract a predicate token from the dependent of clausal relation {ccomp, csub, csubjpass}.

rule_type: str = 'predicate_root'
class A2[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of clausal complement ‘xcomp’.

rule_type: str = 'predicate_root'
class B[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of clausal modifier.

rule_type: str = 'predicate_root'
class C[source]

Bases: PredicateRootRule

Extract a predicate token from the governor of predicate-indicating relations.

Relations: {nsubj, nsubjpass, dobj, iobj, ccomp, xcomp, advcl}.

rule_type: str = 'predicate_root'
__init__(e)[source]

Initialize with the dependency edge that triggered this rule.

Parameters:

e (DepTriple) – The dependency edge with a predicate-indicating relation.

__repr__()[source]

Return string representation showing the edge details.

Returns:

Formatted string showing governor, relation, and dependent.

Return type:

str

class D[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of apposition.

rule_type: str = 'predicate_root'
class E[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of an adjectival modifier.

rule_type: str = 'predicate_root'
class V[source]

Bases: PredicateRootRule

Extract a predicate token from the dependent of ‘nmod:poss’ (English specific).

rule_type: str = 'predicate_root'
class F[source]

Bases: PredicateRootRule

Extract a conjunct token of a predicate token.

rule_type: str = 'predicate_root'
class PredConjBorrowAuxNeg[source]

Bases: PredConjRule

Borrow aux and neg tokens from conjoined predicate’s name.

__init__(friend, borrowed_token)[source]

Initialize with the friend predicate and borrowed token.

Parameters:
  • friend (Predicate) – The predicate we’re borrowing from.

  • borrowed_token (Token) – The aux or neg token being borrowed.

class PredConjBorrowTokensXcomp[source]

Bases: PredConjRule

Borrow tokens from xcomp in a conjunction or predicates.

__init__(friend, borrowed_token)[source]

Initialize with the friend predicate and borrowed token.

Parameters:
  • friend (Predicate) – The predicate we’re borrowing from.

  • borrowed_token (Token) – The token being borrowed from xcomp.

class N1[source]

Bases: PredPhraseRule

Extract a token from the subtree of the predicate root token.

Adds the token to the predicate phrase.

class N2[source]

Bases: PredPhraseRule

Drop a token, which is an argument root token, from the predicate subtree.

class N3[source]

Bases: PredPhraseRule

Drop a token, which is another predicate root token, from the predicate subtree.

class N4[source]

Bases: PredPhraseRule

Drop 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: PredPhraseRule

Drop 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: PredPhraseRule

Add a case phrase to the predicate phrase.

class P1[source]

Bases: SimplifyRule

Remove a non-core argument, a nominal modifier, from the predpatt.

class P2[source]

Bases: SimplifyRule

Remove an argument of other type from the predpatt.

class Q[source]

Bases: SimplifyRule

Remove an adverbial modifier in the predicate phrase.

class R[source]

Bases: SimplifyRule

Remove auxiliary in the predicate phrase.

class U[source]

Bases: SimplifyRule

Strip the punct in the phrase.

class EnRelclDummyArgFilter[source]

Bases: EnglishSpecific

Filter out dummy arguments in English relative clauses.

__init__()[source]

Initialize the English relative clause filter.

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: ArgumentRootRule

Extract an argument token from the dependent of the following relations.

Relations: {nsubj, nsubjpass, dobj, iobj}.

__init__(edge)[source]

Initialize with the dependency edge.

Parameters:

edge (DepTriple) – The dependency edge with a core argument relation.

__repr__()[source]

Return string representation showing the relation.

Returns:

Formatted string showing the relation type.

Return type:

str

class H1[source]

Bases: ArgumentRootRule

Extract 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: ArgumentRootRule

Extract 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: ArgumentRootRule

Extract an argument token from the governor of an adjectival modifier.

I

alias of RuleI

class J[source]

Bases: ArgumentRootRule

Extract an argument token from the governor of apposition.

class W1[source]

Bases: ArgumentRootRule

Extract an argument token from the governor of ‘nmod:poss’ (English specific).

class W2[source]

Bases: ArgumentRootRule

Extract an argument token from the dependent of ‘nmod:poss’ (English specific).

class K[source]

Bases: ArgumentRootRule

Extract an argument token from the dependent of clausal complement ‘ccomp’.

class CutBorrowOther[source]

Bases: ArgumentResolution

Borrow an argument from another predicate in a cut structure.

__init__(borrowed, friend)[source]

Initialize with the borrowed argument and friend predicate.

Parameters:
  • borrowed (Argument) – The argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

class CutBorrowSubj[source]

Bases: ArgumentResolution

Borrow subject from another predicate in a cut structure.

__init__(subj, friend)[source]

Initialize with the subject argument and friend predicate.

Parameters:
  • subj (Argument) – The subject argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class CutBorrowObj[source]

Bases: ArgumentResolution

Borrow object from another predicate in a cut structure.

__init__(obj, friend)[source]

Initialize with the object argument and friend predicate.

Parameters:
  • obj (Argument) – The object argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class BorrowSubj[source]

Bases: ArgumentResolution

Borrow 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.

__init__(subj, friend)[source]

Initialize with the subject argument and friend predicate.

Parameters:
  • subj (Argument) – The subject argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class BorrowObj[source]

Bases: ArgumentResolution

Borrow 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.

__init__(obj, friend)[source]

Initialize with the object argument and friend predicate.

Parameters:
  • obj (Argument) – The object argument being borrowed.

  • friend (Predicate) – The predicate we’re borrowing from.

__repr__()[source]

Return string representation showing borrowing details.

Returns:

Formatted string showing what was borrowed from where.

Return type:

str

class ShareArgument[source]

Bases: ArgumentResolution

Create an argument sharing tokens with another argument.

class ArgResolveRelcl[source]

Bases: ArgumentResolution

Resolve 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: ArgumentResolution

Predicate has an argument from relcl resolution (arg_resolve_relcl).

class L[source]

Bases: ArgumentResolution

Merge the argument token set of xcomp’s dependent to the real predicate token.

class M[source]

Bases: ConjunctionResolution

Extract a conjunct token of the argument root token.

class CleanArgToken[source]

Bases: ArgPhraseRule

Extract a token from the subtree of the argument root token.

Adds the token to the argument phrase.

__init__(x)[source]

Initialize with the token to include.

Parameters:

x (Token) – The token to add to the argument phrase.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is included.

Return type:

str

class MoveCaseTokenToPred[source]

Bases: ArgPhraseRule

Extract a case token from the subtree of the argument root token.

__init__(x)[source]

Initialize with the case token to move.

Parameters:

x (Token) – The case token to move to predicate.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is moved.

Return type:

str

class PredicateHas[source]

Bases: ArgPhraseRule

Drop a token, which is a predicate root token, from the argument subtree.

__init__(x)[source]

Initialize with the predicate token to drop.

Parameters:

x (Token) – The predicate token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class DropAppos[source]

Bases: ArgPhraseRule

Drop apposition from argument phrase.

__init__(x)[source]

Initialize with the apposition token to drop.

Parameters:

x (Token) – The apposition token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class DropUnknown[source]

Bases: ArgPhraseRule

Drop unknown dependency from argument phrase.

__init__(x)[source]

Initialize with the unknown token to drop.

Parameters:

x (Token) – The unknown token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class DropCc[source]

Bases: ArgPhraseRule

Drop the argument’s cc (coordinating conjunction) from the argument subtree.

__init__(x)[source]

Initialize with the cc token to drop.

Parameters:

x (Token) – The coordinating conjunction token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class DropConj[source]

Bases: ArgPhraseRule

Drop the argument’s conjuct from the subtree of the argument root token.

__init__(x)[source]

Initialize with the conjunct token to drop.

Parameters:

x (Token) – The conjunct token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class SpecialArgDropDirectDep[source]

Bases: ArgPhraseRule

Drop special direct dependencies from argument phrase.

__init__(x)[source]

Initialize with the token to drop.

Parameters:

x (Token) – The token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class EmbeddedAdvcl[source]

Bases: ArgPhraseRule

Drop embedded adverbial clause from argument phrase.

__init__(x)[source]

Initialize with the advcl token to drop.

Parameters:

x (Token) – The adverbial clause token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class EmbeddedCcomp[source]

Bases: ArgPhraseRule

Drop embedded clausal complement from argument phrase.

__init__(x)[source]

Initialize with the ccomp token to drop.

Parameters:

x (Token) – The clausal complement token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class EmbeddedUnknown[source]

Bases: ArgPhraseRule

Drop embedded unknown structure from argument phrase.

__init__(x)[source]

Initialize with the unknown token to drop.

Parameters:

x (Token) – The unknown embedded token to exclude.

__repr__()[source]

Return string representation showing the token.

Returns:

Formatted string showing which token is dropped.

Return type:

str

class EnRelclDummyArgFilter[source]

Bases: EnglishSpecific

Filter 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.

__init__()[source]

Initialize the English relative clause filter.

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.

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.

Parameters:
  • e (DepTriple) – The dependency edge to check.

  • ud (UniversalDependencies) – The UD schema containing relation definitions.

Returns:

True if the governor looks like a predicate.

Return type:

bool