This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Action/Condition Classification (#48)
* #43 basic condtion and action extraction functions * #43 corrected extractions, now matching occurs per sentence, removes many false positives * #43 fixed recursive action extraction function * Added new pattern * #43 classifying of ignored parameter actions * #43 conditions and actions are now dataclasses, renamed one condition * #43 phrases to categories actions/conditions * #43 mypy fixes * style: apply automatic fixes of linters * #43 renamed IDs in general SCONJ pattern * #43 more descriptive pattern name Co-authored-by: Aleksandr Sergeev <[email protected]> Co-authored-by: prajakta <[email protected]> Co-authored-by: aserge16 <[email protected]>
- Loading branch information
1 parent
3efa424
commit 13c789c
Showing
4 changed files
with
121 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 18 additions & 30 deletions
48
package_parser/package_parser/commands/get_dependencies/_dependency_patterns.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,41 @@ | ||
dependency_matcher_patterns = { | ||
"pattern_parameter_used_condition": [ | ||
{"RIGHT_ID": "used", "RIGHT_ATTRS": {"ORTH": {"IN": ["used", "Used"]}}}, | ||
"pattern_parameter_subordinating_conjunction": [ | ||
{"RIGHT_ID": "action_head", "RIGHT_ATTRS": {"POS": "VERB"}}, | ||
{ | ||
"LEFT_ID": "used", | ||
"LEFT_ID": "action_head", | ||
"REL_OP": ">", | ||
"RIGHT_ID": "condition", | ||
"RIGHT_ID": "condition_head", | ||
"RIGHT_ATTRS": {"DEP": "advcl"}, | ||
}, | ||
{ | ||
"LEFT_ID": "condition", | ||
"LEFT_ID": "condition_head", | ||
"REL_OP": ">", | ||
"RIGHT_ID": "dependee_param", | ||
"RIGHT_ATTRS": {"DEP": {"IN": ["nsubj", "nsubjpass"]}}, | ||
}, | ||
], | ||
"pattern_parameter_ignored_condition": [ | ||
"pattern_parameter_": [ | ||
{ | ||
"RIGHT_ID": "ignored", | ||
"RIGHT_ATTRS": {"ORTH": {"IN": ["ignored", "Ignored"]}}, | ||
"RIGHT_ID": "action", | ||
"RIGHT_ATTRS": {"POS": "VERB"}, # verb is set as an anchor token | ||
}, | ||
{ | ||
"LEFT_ID": "ignored", | ||
"LEFT_ID": "action", | ||
"REL_OP": ">", | ||
"RIGHT_ID": "condition", | ||
"RIGHT_ATTRS": {"DEP": "advcl"}, | ||
"RIGHT_ID": "ActionParameterName", # verb is a direct head of subject which is a NOUN i.e. Parameter Name | ||
"RIGHT_ATTRS": {"DEP": {"IN": ["nsubjpass", "nsubj"]}}, | ||
}, | ||
{ | ||
"LEFT_ID": "condition", | ||
"LEFT_ID": "action", | ||
"REL_OP": ">", | ||
"RIGHT_ID": "dependee_param", | ||
"RIGHT_ATTRS": {"DEP": {"IN": ["nsubj", "nsubjpass"]}}, | ||
"RIGHT_ID": "ConditionalVerbModifier", # Verb is restricted by Verb Modifier | ||
"RIGHT_ATTRS": {"DEP": "advmod"}, | ||
}, | ||
], | ||
"pattern_parameter_applies_condition": [ | ||
{ | ||
"RIGHT_ID": "applies", | ||
"RIGHT_ATTRS": {"ORTH": {"IN": ["applies", "Applies"]}}, | ||
}, | ||
{ | ||
"LEFT_ID": "applies", | ||
"REL_OP": ">", | ||
"RIGHT_ID": "condition", | ||
"RIGHT_ATTRS": {"DEP": "advcl"}, | ||
}, | ||
{ | ||
"LEFT_ID": "condition", | ||
"REL_OP": ">", | ||
"RIGHT_ID": "dependee_param", | ||
"RIGHT_ATTRS": {"DEP": {"IN": ["nsubj", "nsubjpass"]}}, | ||
"LEFT_ID": "action", | ||
"REL_OP": ">>", | ||
"RIGHT_ID": "ConditionalParameterName", # verb is a head in chain of object i.e. Parameter name or value | ||
"RIGHT_ATTRS": {"DEP": {"IN": ["dobj", "pobj"]}}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters