public final class GraphTokenStreamFiniteStrings
extends java.lang.Object
Automaton
where the transition labels are terms from
the TermToBytesRefAttribute
.
This class also provides helpers to explore the different paths of the Automaton
.Modifier and Type | Class and Description |
---|---|
private class |
GraphTokenStreamFiniteStrings.FiniteStringsTokenStream |
Modifier and Type | Field and Description |
---|---|
private Automaton |
det |
private java.util.Map<java.lang.Integer,java.lang.Integer> |
idToInc |
private java.util.Map<java.lang.Integer,BytesRef> |
idToTerm |
private Transition |
transition |
Constructor and Description |
---|
GraphTokenStreamFiniteStrings(TokenStream in) |
Modifier and Type | Method and Description |
---|---|
int[] |
articulationPoints()
Returns the articulation points (or cut vertices) of the graph:
https://en.wikipedia.org/wiki/Biconnected_component
|
private static void |
articulationPointsRecurse(Automaton a,
int state,
int d,
int[] depth,
int[] low,
int[] parent,
java.util.BitSet visited,
java.util.List<java.lang.Integer> points) |
private Automaton |
build(TokenStream in)
Build an automaton from the provided
TokenStream . |
java.util.Iterator<TokenStream> |
getFiniteStrings()
Get all finite strings from the automaton.
|
java.util.Iterator<TokenStream> |
getFiniteStrings(int startState,
int endState)
Get all finite strings that start at
startState and end at endState . |
private int |
getTermID(int incr,
int prevIncr,
BytesRef term)
Gets an integer id for a given term and saves the position increment if needed.
|
Term[] |
getTerms(java.lang.String field,
int state)
Returns the list of terms that start at the provided state
|
boolean |
hasSidePath(int state)
Returns whether the provided state is the start of multiple side paths of different length (eg: new york, ny)
|
private final java.util.Map<java.lang.Integer,BytesRef> idToTerm
private final java.util.Map<java.lang.Integer,java.lang.Integer> idToInc
private final Automaton det
private final Transition transition
public GraphTokenStreamFiniteStrings(TokenStream in) throws java.io.IOException
java.io.IOException
public boolean hasSidePath(int state)
public Term[] getTerms(java.lang.String field, int state)
public java.util.Iterator<TokenStream> getFiniteStrings() throws java.io.IOException
java.io.IOException
public java.util.Iterator<TokenStream> getFiniteStrings(int startState, int endState) throws java.io.IOException
startState
and end at endState
.java.io.IOException
public int[] articulationPoints()
private Automaton build(TokenStream in) throws java.io.IOException
TokenStream
.java.io.IOException
private int getTermID(int incr, int prevIncr, BytesRef term)
private static void articulationPointsRecurse(Automaton a, int state, int d, int[] depth, int[] low, int[] parent, java.util.BitSet visited, java.util.List<java.lang.Integer> points)