decomp.semantics.predpatt.filters¶
Filters for refining predicate and argument extractions based on linguistic criteria.
Filtering functions for refining PredPatt extractions.
This module provides predicate and argument filters that can be applied to refine the output of PredPatt extraction based on linguistic criteria such as verb type, syntactic role, and semantic properties.
Functions¶
Predicate Filters¶
- is_pred_verb
Check if predicate root is a verb.
- is_not_copula
Exclude copular predicates.
- is_not_have
Exclude “have” predicates.
- is_not_interrogative
Exclude interrogative predicates.
- has_subj
Check if predicate has a subject.
- is_good_ancestor
Check if predicate has good dependency ancestors.
- is_good_descendants
Check if predicate has good dependency descendants.
- filter_events_nucl
Filter predicates for NUCL event extraction.
- filter_events_sprl
Filter predicates for SituatedPRL event extraction.
Argument Filters¶
- is_sbj_or_obj
Check if argument is subject or object.
- is_not_pronoun
Exclude pronominal arguments.
- has_direct_arc
Check for direct dependency arc.
Filter Application¶
- apply_filters
Apply multiple filters to extractions.
- activate
Activate specific filter configurations.
Notes
Filters can be combined using PredPattOpts to customize extraction behavior. Backward compatibility aliases use camelCase naming.
- activate(pred)[source]¶
Apply all predicate and argument filters to a predicate.
Demonstrates how to apply all available filters to a predicate and its arguments. Initializes empty rules lists before applying.
- apply_filters(_filter, pred, **options)[source]¶
Apply a filter function with proper parameter handling.
Handles different filter function signatures and parameter requirements. Supports both predicate filters and argument filters.
- filter_events_NUCL(event, parse)¶
Apply filters for running Keisuke’s NUCLE HIT.
Combines multiple predicate filters for the NUCL evaluation. Only applies if the event is not interrogative.
- filter_events_SPRL(event, parse)¶
Apply filters for running UD SPRL HIT.
Combines multiple predicate filters for the SPRL evaluation. Only applies if the parse is not interrogative.
- filter_events_nucl(event, parse)[source]¶
Apply filters for running Keisuke’s NUCLE HIT.
Combines multiple predicate filters for the NUCL evaluation. Only applies if the event is not interrogative.
- filter_events_sprl(event, parse)[source]¶
Apply filters for running UD SPRL HIT.
Combines multiple predicate filters for the SPRL evaluation. Only applies if the parse is not interrogative.
- hasSubj(pred, passive=False)¶
Filter predicates that have subjects.
Checks if the predicate has a subject dependent. Optionally includes passive subjects (nsubjpass) when passive=True.
- has_direct_arc(pred, arg)[source]¶
Check if the argument and predicate has a direct arc.
Verifies that the argument root token is directly governed by the predicate root token.
- has_subj(pred, passive=False)[source]¶
Filter predicates that have subjects.
Checks if the predicate has a subject dependent. Optionally includes passive subjects (nsubjpass) when passive=True.
- isGoodAncestor(pred)¶
Filter predicates with good ancestry.
Returns true if verb is not dominated by a relation that might alter its veridicality. This filter is very conservative; many veridical verbs will be excluded.
- isGoodDescendants(pred)¶
Filter predicates with good descendants.
Returns true if verb immediately dominates a relation that might alter its veridicality. This filter is very conservative; many veridical verbs will be excluded.
- isNotCopula(pred)¶
Filter out copula constructions.
Checks if any of the dependents of pred are copula verbs. UD annotates copula verbs only when the nonverbal predicate is the head of the clause.
- isNotHave(pred)¶
Filter out ‘have’ verbs.
Excludes predicates with ‘have’, ‘had’, or ‘has’ as the root text.
- isNotInterrogative(pred)¶
Filter out interrogative predicates.
Checks if the predicate contains a question mark. This is a simple heuristic filter to exclude interrogative sentences.
- isNotPronoun(arg)¶
Filter out pronoun arguments.
Excludes arguments that are pronouns (PRP tag) or specific pronoun-like words: that, this, which, what.
- isPredVerb(pred)¶
Filter to accept only verbal predicates.
Checks if the predicate root has a verbal part-of-speech tag (starts with ‘V’).
- isSbjOrObj(arg)¶
Filter to accept core arguments (subjects and objects).
Accepts arguments with core grammatical relations: nsubj, dobj, iobj.
- is_good_ancestor(pred)[source]¶
Filter predicates with good ancestry.
Returns true if verb is not dominated by a relation that might alter its veridicality. This filter is very conservative; many veridical verbs will be excluded.
- is_good_descendants(pred)[source]¶
Filter predicates with good descendants.
Returns true if verb immediately dominates a relation that might alter its veridicality. This filter is very conservative; many veridical verbs will be excluded.
- is_not_copula(pred)[source]¶
Filter out copula constructions.
Checks if any of the dependents of pred are copula verbs. UD annotates copula verbs only when the nonverbal predicate is the head of the clause.
- is_not_have(pred)[source]¶
Filter out ‘have’ verbs.
Excludes predicates with ‘have’, ‘had’, or ‘has’ as the root text.
- is_not_interrogative(pred)[source]¶
Filter out interrogative predicates.
Checks if the predicate contains a question mark. This is a simple heuristic filter to exclude interrogative sentences.
- is_not_pronoun(arg)[source]¶
Filter out pronoun arguments.
Excludes arguments that are pronouns (PRP tag) or specific pronoun-like words: that, this, which, what.
- is_pred_verb(pred)[source]¶
Filter to accept only verbal predicates.
Checks if the predicate root has a verbal part-of-speech tag (starts with ‘V’).
- is_sbj_or_obj(arg)[source]¶
Filter to accept core arguments (subjects and objects).
Accepts arguments with core grammatical relations: nsubj, dobj, iobj.
Submodules¶
decomp.semantics.predpatt.filters.predicate_filters¶
Predicate filtering functions for PredPatt.
This module contains filter functions that determine whether predicates should be included in the final extraction results based on various linguistic and structural criteria.
- is_not_interrogative(pred)[source]¶
Filter out interrogative predicates.
Checks if the predicate contains a question mark. This is a simple heuristic filter to exclude interrogative sentences.
- is_pred_verb(pred)[source]¶
Filter to accept only verbal predicates.
Checks if the predicate root has a verbal part-of-speech tag (starts with ‘V’).
- is_not_copula(pred)[source]¶
Filter out copula constructions.
Checks if any of the dependents of pred are copula verbs. UD annotates copula verbs only when the nonverbal predicate is the head of the clause.
- is_good_ancestor(pred)[source]¶
Filter predicates with good ancestry.
Returns true if verb is not dominated by a relation that might alter its veridicality. This filter is very conservative; many veridical verbs will be excluded.
- is_good_descendants(pred)[source]¶
Filter predicates with good descendants.
Returns true if verb immediately dominates a relation that might alter its veridicality. This filter is very conservative; many veridical verbs will be excluded.
- has_subj(pred, passive=False)[source]¶
Filter predicates that have subjects.
Checks if the predicate has a subject dependent. Optionally includes passive subjects (nsubjpass) when passive=True.
- is_not_have(pred)[source]¶
Filter out ‘have’ verbs.
Excludes predicates with ‘have’, ‘had’, or ‘has’ as the root text.
- filter_events_nucl(event, parse)[source]¶
Apply filters for running Keisuke’s NUCLE HIT.
Combines multiple predicate filters for the NUCL evaluation. Only applies if the event is not interrogative.
- filter_events_sprl(event, parse)[source]¶
Apply filters for running UD SPRL HIT.
Combines multiple predicate filters for the SPRL evaluation. Only applies if the parse is not interrogative.
- activate(pred)[source]¶
Apply all predicate and argument filters to a predicate.
Demonstrates how to apply all available filters to a predicate and its arguments. Initializes empty rules lists before applying.
decomp.semantics.predpatt.filters.argument_filters¶
Argument filtering functions for PredPatt.
This module contains filter functions that determine whether arguments should be included in the final extraction results based on various linguistic and structural criteria.
- is_sbj_or_obj(arg)[source]¶
Filter to accept core arguments (subjects and objects).
Accepts arguments with core grammatical relations: nsubj, dobj, iobj.
- is_not_pronoun(arg)[source]¶
Filter out pronoun arguments.
Excludes arguments that are pronouns (PRP tag) or specific pronoun-like words: that, this, which, what.