public void TestBuild() { String LF = System.Environment.NewLine; String input = "oneword" + LF + "twoword" + LF + "threeword"; PlainTextDictionary ptd = new PlainTextDictionary( new MemoryStream( System.Text.Encoding.UTF8.GetBytes(input)) ); RAMDirectory ramDir = new RAMDirectory(); SpellChecker.Net.Search.Spell.SpellChecker spellChecker = new SpellChecker.Net.Search.Spell.SpellChecker(ramDir); spellChecker.IndexDictionary(ptd); String[] similar = spellChecker.SuggestSimilar("treeword", 2); Assert.AreEqual(2, similar.Length); Assert.AreEqual(similar[0], "threeword"); Assert.AreEqual(similar[1], "twoword"); }
public static void Build(string dictionaryPath, string indexPath) { var di = CreateTargetFolder(indexPath); using (var file = File.Open(dictionaryPath, FileMode.Open, FileAccess.Read)) { var dict = new PlainTextDictionary(file); using (var staticSpellChecker = new SpellChecker.Net.Search.Spell.SpellChecker(FSDirectory.Open(di))) { try { staticSpellChecker.IndexDictionary(dict); } catch (Exception e) { Console.WriteLine(e.Message); } } } }
private void InitBlock(PlainTextDictionary enclosingInstance) { this.enclosingInstance = enclosingInstance; }
public FileIterator(PlainTextDictionary enclosingInstance) { InitBlock(enclosingInstance); }