SpellCheckController() { if (baseDictionary == null) { string filePath = HttpContext.Current.Server.MapPath("~/App_Data/Default.dic"); // Here we need to specify the corresponding file name Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read); baseDictionary = new SpellCheckerBase(stream); } this.CustomFileRead(); }
String CheckText(String text) { SpellCheckerBase checker = new SpellCheckerBase(); checker.NotInDictionaryWordFound += new NotInDictionaryWordFoundEventHandler(checker_NotInDictionaryWordFound); SpellCheckerISpellDictionary dict = new SpellCheckerISpellDictionary(Server.MapPath("~/Dictionaries/american.xlg"), Server.MapPath("~/Dictionaries/english.aff"), new CultureInfo("en-us")); dict.AlphabetPath = Server.MapPath("~/Dictionaries/EnglishAlphabet.txt"); dict.CacheKey = "ispellDic"; dict.Load(); checker.Dictionaries.Add(dict); checker.LevenshteinDistance = 4; String result = checker.Check(text); return(result); }
private void CustomFileRead() { Stream stream1 = new FileStream(_customFilePath, FileMode.Open, FileAccess.ReadWrite); customDictionary = new SpellCheckerBase(stream1); }