Module org.apache.lucene.core
Package org.apache.lucene.util.graph
Class GraphTokenStreamFiniteStrings
java.lang.Object
org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings
Consumes a TokenStream and creates an
Automaton
where the transition labels are terms
from the TermToBytesRefAttribute
. This class also provides helpers to explore the
different paths of the Automaton
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Automaton
private static final int
Maximum level of recursion allowed in recursive operations.private AttributeSource[]
private final Transition
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint[]
Returns the articulation points (or cut vertices) of the graph: https://en.wikipedia.org/wiki/Biconnected_componentprivate static void
articulationPointsRecurse
(Automaton a, int state, int d, int[] depth, int[] low, int[] parent, BitSet visited, IntArrayList points) private Automaton
build
(TokenStream in) Build an automaton from the providedTokenStream
.Get all finite strings from the automaton.getFiniteStrings
(int startState, int endState) Get all finite strings that start atstartState
and end atendState
.getTerms
(int state) Returns the list of tokens that start at the provided stateTerm[]
Returns the list of terms that start at the provided stateboolean
hasSidePath
(int state) Returns whether the provided state is the start of multiple side paths of different length (eg: new york, ny)
-
Field Details
-
MAX_RECURSION_LEVEL
private static final int MAX_RECURSION_LEVELMaximum level of recursion allowed in recursive operations.- See Also:
-
tokens
-
det
-
transition
-
-
Constructor Details
-
GraphTokenStreamFiniteStrings
- Throws:
IOException
-
-
Method Details
-
hasSidePath
public boolean hasSidePath(int state) Returns whether the provided state is the start of multiple side paths of different length (eg: new york, ny) -
getTerms
Returns the list of tokens that start at the provided state -
getTerms
Returns the list of terms that start at the provided state -
getFiniteStrings
Get all finite strings from the automaton.- Throws:
IOException
-
getFiniteStrings
Get all finite strings that start atstartState
and end atendState
. -
articulationPoints
public int[] articulationPoints()Returns the articulation points (or cut vertices) of the graph: https://en.wikipedia.org/wiki/Biconnected_component -
build
Build an automaton from the providedTokenStream
.- Throws:
IOException
-
articulationPointsRecurse
private static void articulationPointsRecurse(Automaton a, int state, int d, int[] depth, int[] low, int[] parent, BitSet visited, IntArrayList points)
-