
PrefixAutomaton
- Namespace
- Rowles.LeanLucene.Codecs.Fst
- Assembly
- Rowles.LeanLucene.dll
Accepts any byte sequence that starts with a given UTF-8 prefix. States: 0..prefix.Length-1 = matching prefix bytes, prefix.Length = accepted (sink).
public sealed class PrefixAutomaton : IAutomaton
PrefixAutomaton
- Implements
PrefixAutomaton(ReadOnlySpan<byte>)
Initialises a new PrefixAutomaton from a raw UTF-8 byte prefix.
PrefixAutomaton(string)
Initialises a new PrefixAutomaton from a string prefix, converted to UTF-8.
Start
Initial state of the automaton.
CanMatch(int)
Returns true if the automaton could potentially accept any string starting from the given state. Used for early pruning during intersection. Returns false only if the state is dead (no path to any accept state).
IsAccept(int)
Returns true if the given state is an accepting state.
Step(int, byte)
Transition function: returns next state given current state and input byte, or -1 if no transition.