This manages the set of available custom Node and Edge tests.
This contains predicate tests used in
SsurgeonPattern objects. The predicates are used to test nodes and edges, in order to add customized testing behaviors before executing the Ssurgeon pattern.
All tests must implement
SsurgPred (Ssurgeon Predicate).
Tests are also implemented here, which accept nodes/edges as arguments. The intent is to offer the ability to generate programmatic tests beyond those that are available in Semgrex, and to push these into Java code instead of making the Semgrex unreadable.
There are two tests, nodeTest and edgeTest, which accept the named node or edge from the match result. These tests will return a boolean value. The "testID" attribute of the tests indicates the named test to apply.
Currently, tests must be first registered with their String IDs with the given Ssurgeon rewriter. This is a compromise, and we will address the ability to dyanmically specify tests at a future date.
Stanford NLP Group