C# Class LevenshteinAutomaton.SpellChecker

Spell Checker uses the Levenshtein automaton and FB-Trie algorithm to find possible corrections for the given garbled word
Mostrar archivo Open project: ibendrup/LevenshteinAutomaton

Public Methods

Method Description
AddWord ( string word ) : void

Append new word to the dictionary

GetCorrections1T ( string typo ) : IList

Gets the corrections for edit distance 1 with transpositions.

GetCorrections2T ( string typo ) : IList

Gets the corrections for edit distance 2 with transpositions.

SpellChecker ( ) : System

Initializes a new instance for empty lexicon

SpellChecker ( IEnumerable words ) : System

Initializes a new instance for the given lexicon

Private Methods

Method Description
GetCorrectionNodes ( string typo, TrieNode start, int editDistance, bool includeOnlyWords = true ) : IList

Basic Schulz and Mihov algoritm

GetCorrectionStrings ( string typo, TrieNode start, int editDistance ) : IEnumerable

Find all words in dictionary such that Levenshtein distance to typo less or equal to editDistance

PrepareSubstrings ( string typo, string &left, string &right, string &rleft, string &rright ) : int

Splits the typo into two substrings of similar length

Method Details

AddWord() public method

Append new word to the dictionary
public AddWord ( string word ) : void
word string Word.
return void

GetCorrections1T() public method

Gets the corrections for edit distance 1 with transpositions.
public GetCorrections1T ( string typo ) : IList
typo string Garbled word.
return IList

GetCorrections2T() public method

Gets the corrections for edit distance 2 with transpositions.
public GetCorrections2T ( string typo ) : IList
typo string Garbled word.
return IList

SpellChecker() public method

Initializes a new instance for empty lexicon
public SpellChecker ( ) : System
return System

SpellChecker() public method

Initializes a new instance for the given lexicon
public SpellChecker ( IEnumerable words ) : System
words IEnumerable
return System