public class TreeNodePruner extends Object implements Manipulator
nodeSelectorObj
)
2) the visit can be pre-order or post-order and a limit to the number of
recursive calls can be set (depends on visit
and
maxDepthVisitsWhilePruning
3) a class for checking whether a node has to be pruned (nodePrunerObj
);
optionally a second class for pruning non leaf nodes only can be provided
(internalNodePrunerObj
)
When dealing with ExamplePair objects, it is possible to apply a pruning
strategy to the trees of one pair Example of the pair only (in this case class
treeSelectorObj
need to be set up properly)Modifier and Type | Class and Description |
---|---|
static class |
TreeNodePruner.visitType |
Modifier and Type | Field and Description |
---|---|
static int |
NO_DISTANCE_CONSTRAINT |
static int |
UNLIMITED_RECURSION |
Constructor and Description |
---|
TreeNodePruner(NodePruner nodePrunerForPreOrderVisit,
SelectRepresentationFromExample treeSelectorInExample,
TreeNodeSelector nodeSelectorObj,
int maxDepthVisitsWhilePruning)
Create a tree pruner which performs a pre-order traversal of the tree.
|
TreeNodePruner(NodePruner nodePrunerForPreOrderVisit,
String representationName,
TreeNodeSelector nodeSelectorObj,
int maxDepthVisitsWhilePruning)
Create a tree pruner which performs a pre-order traversal of the tree.
|
TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj,
SelectRepresentationFromExample treeSelectorInExample,
NodeToBePrunedCheckerAbstractClass internalNodePrunerObj,
TreeNodeSelector nodeSelectorObj,
int maxDepthVisitsWhilePruning)
Create a tree pruner which performs a post-order traversal of the tree.
|
TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj,
String representationName) |
TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj,
String representationName,
boolean applyToLeftExampleInPair) |
TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj,
String representationName,
NodeToBePrunedCheckerAbstractClass internalNodePrunerObj,
TreeNodeSelector nodeSelectorObj,
int maxDepthVisitsWhilePruning) |
Modifier and Type | Method and Description |
---|---|
void |
applyPruningToLeftElementOfExamplePair() |
void |
applyPruningToRightElementOfExamplePair() |
String |
describe()
Describe what the elements of the tree-pruner will do once the manipulator
is invoked.
|
void |
manipulate(Example example) |
void |
pruneTree(TreeRepresentation tree) |
void |
setMaximumDepthOfVisits(int maxDepth) |
void |
setVisitTypePostOrder() |
void |
setVisitTypePreOrder() |
public static final int UNLIMITED_RECURSION
public static final int NO_DISTANCE_CONSTRAINT
public TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj, SelectRepresentationFromExample treeSelectorInExample, NodeToBePrunedCheckerAbstractClass internalNodePrunerObj, TreeNodeSelector nodeSelectorObj, int maxDepthVisitsWhilePruning)
nodePrunerObj
- an object for establishing whether a node has to be prunedtreeSelectorObj
- an object for selecting trees from an ExampleinternalNodePrunerObj
- an object for establishing whether an internal
node of the tree has to be prunednodeSelectorObj
- an object for selecting a list of nodes from which
the visit of the tree will startmaxDepthVisitsWhilePruning
- maximum number of recursive calls when
visiting a treepublic TreeNodePruner(NodePruner nodePrunerForPreOrderVisit, SelectRepresentationFromExample treeSelectorInExample, TreeNodeSelector nodeSelectorObj, int maxDepthVisitsWhilePruning)
nodePrunerForPreOrderVisit
- an object performing the pruning of a nodenodeSelectorObj
- an object for selecting a list of nodes from which
the visit of the tree will startmaxDepthVisitsWhilePruning
- maximum number of recursive calls when
visiting a treepublic TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj, String representationName, NodeToBePrunedCheckerAbstractClass internalNodePrunerObj, TreeNodeSelector nodeSelectorObj, int maxDepthVisitsWhilePruning)
public TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj, String representationName)
public TreeNodePruner(NodeToBePrunedCheckerAbstractClass nodePrunerObj, String representationName, boolean applyToLeftExampleInPair)
public TreeNodePruner(NodePruner nodePrunerForPreOrderVisit, String representationName, TreeNodeSelector nodeSelectorObj, int maxDepthVisitsWhilePruning)
nodePrunerForPreOrderVisit
- an object performing the pruning of a noderepresentationName
- name of the representation of the trees in the ExamplenodeSelectorObj
- an object for selecting a list of nodes from which
the visit of the tree will startmaxDepthVisitsWhilePruning
- maximum number of recursive calls when
visiting a treepublic void applyPruningToLeftElementOfExamplePair()
public void applyPruningToRightElementOfExamplePair()
public String describe()
public void manipulate(Example example)
manipulate
in interface Manipulator
public void pruneTree(TreeRepresentation tree)
public void setMaximumDepthOfVisits(int maxDepth)
public void setVisitTypePostOrder()
public void setVisitTypePreOrder()
Copyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.