Exemple #1
0
        public string[] Check(string misspelling)
        {
            List <WordCount> candidates =
                new List <WordCount>();

            string[] allCandidates = CandidateGenerator.GetCandidates(misspelling);
            for (long i = 0; i < allCandidates.Length; i++)
            {
                ulong result = FastLM.BisectionSearch(LanguageModel.WordCounts, allCandidates[i]);
                if (result > 0)
                {
                    candidates.Add(new WordCount(allCandidates[i], result));
                }
            }

            return(candidates
                   .OrderByDescending(x => x.Count)
                   .Select(x => x.Word)
                   .Distinct()
                   .ToArray());
        }
Exemple #2
0
 public SpellChecker(FastLM lm)
 {
     this.LanguageModel = lm;
 }