Package org.apache.lucene.util.graph

# Class GraphTokenStreamFiniteStrings

java.lang.Object
org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings

public final class GraphTokenStreamFiniteStrings extends Object
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`.

## Constructor Summary

Constructors
Constructor
Description
`GraphTokenStreamFiniteStrings(TokenStream in)`

## Method Summary

Modifier and Type
Method
Description
`int[]`
`articulationPoints()`
Returns the articulation points (or cut vertices) of the graph: https://en.wikipedia.org/wiki/Biconnected_component
`Iterator<TokenStream>`
`getFiniteStrings()`
Get all finite strings from the automaton.
`Iterator<TokenStream>`
`getFiniteStrings(int startState, int endState)`
Get all finite strings that start at `startState` and end at `endState`.
`List<AttributeSource>`
`getTerms(int state)`
Returns the list of tokens that start at the provided state
`Term[]`
`getTerms(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)

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### GraphTokenStreamFiniteStrings

public GraphTokenStreamFiniteStrings(TokenStream in) throws IOException

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

public List<AttributeSource> getTerms(int state)
Returns the list of tokens that start at the provided state

### getTerms

public Term[] getTerms(String field, int state)
Returns the list of terms that start at the provided state

### getFiniteStrings

public Iterator<TokenStream> getFiniteStrings() throws IOException
Get all finite strings from the automaton.

Throws:
  `IOException`

### getFiniteStrings

public Iterator<TokenStream> getFiniteStrings(int startState, int endState)
Get all finite strings that start at `startState` and end at `endState`.

### articulationPoints

public int[] articulationPoints()
Returns the articulation points (or cut vertices) of the graph: https://en.wikipedia.org/wiki/Biconnected_component