Class LevenshteinAutomata
Class to construct DFAs that match a word within some edit distance.
Implements the algorithm described in: Schulz and Mihov: Fast String Correction with Levenshtein AutomataNote
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Util.Automaton
Assembly: Lucene.Net.dll
Syntax
public class LevenshteinAutomata
Constructors
LevenshteinAutomata(int[], int, bool)
Expert: specify a custom maximum possible symbol (alphaMax); default is J2N.Character.MaxCodePoint.
Declaration
public LevenshteinAutomata(int[] word, int alphaMax, bool withTranspositions)
Parameters
Type | Name | Description |
---|---|---|
int[] | word | |
int | alphaMax | |
bool | withTranspositions |
LevenshteinAutomata(string, bool)
Create a new LevenshteinAutomata for some input
string.
Optionally count transpositions as a primitive edit.
Declaration
public LevenshteinAutomata(string input, bool withTranspositions)
Parameters
Type | Name | Description |
---|---|---|
string | input | |
bool | withTranspositions |
Fields
MAXIMUM_SUPPORTED_DISTANCE
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public const int MAXIMUM_SUPPORTED_DISTANCE = 2
Field Value
Type | Description |
---|---|
int |
Methods
ToAutomaton(int)
Compute a DFA that accepts all strings within an edit distance of n
.
All automata have the following properties:
- They are deterministic (DFA).
- There are no transitions to dead states.
- They are not minimal (some transitions could be combined).
Declaration
public virtual Automaton ToAutomaton(int n)
Parameters
Type | Name | Description |
---|---|---|
int | n |
Returns
Type | Description |
---|---|
Automaton |