Package org.nineml.coffeegrinder.trees
Class Arborist
- java.lang.Object
-
- org.nineml.coffeegrinder.trees.Arborist
-
- Direct Known Subclasses:
Lumberjack,TreeSurgeon
public abstract class Arborist extends java.lang.ObjectOne who might be employed to extract trees from a forest.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ArboristgetArborist(ParseForest forest)Get an arborist for the forest.static ArboristgetArborist(ParseForest forest, Axe axe)Get an arborist for the forest.java.util.Set<java.lang.Integer>getSelectedNodes()Return the selected nodes.java.util.List<TreeSelection>getSelectedTrees()Return the selected trees.abstract voidgetTree(TreeBuilder builder)Get the next tree.abstract booleanhasMoreTrees()Are there more trees?abstract booleanisAbsolutelyAmbiguous()Is the underlying forest infinitely ambiguous?abstract booleanisAmbiguous()Is the parse ambiguous?booleanisInfinitelyAmbiguous()Is the underlying forest infinitely ambiguous?abstract voidreset()Reset the arborist.
-
-
-
Method Detail
-
getTree
public abstract void getTree(TreeBuilder builder)
Get the next tree.- Parameters:
builder- the builder.
-
isAmbiguous
public abstract boolean isAmbiguous()
Is the parse ambiguous?- Returns:
- true if it is.
-
isAbsolutelyAmbiguous
public abstract boolean isAbsolutelyAmbiguous()
Is the underlying forest infinitely ambiguous?- Returns:
- true if it is.
-
hasMoreTrees
public abstract boolean hasMoreTrees()
Are there more trees?- Returns:
- true if there are.
-
reset
public abstract void reset()
Reset the arborist.
-
getArborist
public static Arborist getArborist(ParseForest forest)
Get an arborist for the forest.By default, the arborist uses a
SequentialAxe.- Parameters:
forest- The forest- Returns:
- the arborist
-
getArborist
public static Arborist getArborist(ParseForest forest, Axe axe)
Get an arborist for the forest.- Parameters:
forest- The forestaxe- The axe to use- Returns:
- the arborist
-
isInfinitelyAmbiguous
public boolean isInfinitelyAmbiguous()
Is the underlying forest infinitely ambiguous?- Returns:
- true if it is
-
getSelectedNodes
public java.util.Set<java.lang.Integer> getSelectedNodes()
Return the selected nodes.- Returns:
- The nodes
-
getSelectedTrees
public java.util.List<TreeSelection> getSelectedTrees()
Return the selected trees.- Returns:
- The trees.
-
-