Package org.apache.lucene.analysis
Class AutomatonToTokenStream
- java.lang.Object
-
- org.apache.lucene.analysis.AutomatonToTokenStream
-
public class AutomatonToTokenStream extends java.lang.Object
Converts an Automaton into a TokenStream.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AutomatonToTokenStream.EdgeToken
Edge between position nodes.private static class
AutomatonToTokenStream.RemapNode
Node that contains original node id and position in TokenStreamprivate static class
AutomatonToTokenStream.TopoTokenStream
Token Stream that outputs tokens from a topo sorted graph.
-
Constructor Summary
Constructors Modifier Constructor Description private
AutomatonToTokenStream()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TokenStream
toTokenStream(Automaton automaton)
converts an automaton into a TokenStream.
-
-
-
Method Detail
-
toTokenStream
public static TokenStream toTokenStream(Automaton automaton)
converts an automaton into a TokenStream. This is done by first Topo sorting the nodes in the Automaton. Nodes that have the same distance from the start are grouped together to form the position nodes for the TokenStream. The resulting TokenStream releases edges from the automaton as tokens in order from the position nodes. This requires the automaton be a finite DAG.- Parameters:
automaton
- automaton to convert. Must be a finite DAG.- Returns:
- TokenStream representation of automaton.
-
-