SpellChecker.Net.Search.Spell.SpellChecker.SuggestSimilar C# (CSharp) Method

SuggestSimilar() public method

Suggest similar words
public SuggestSimilar ( System word, int num_sug ) : System.String[]
word System String the word you want a spell check done on ///
num_sug int int the number of suggest words ///
return System.String[]
        public virtual System.String[] SuggestSimilar(System.String word, int num_sug)
        {
            return this.SuggestSimilar(word, num_sug, null, null, false);
        }

Same methods

SpellChecker::SuggestSimilar ( System word, int numSug, Lucene.Net.Index.IndexReader ir, System field, bool morePopular ) : System.String[]

Usage Example

        public SuggestionQueryResult Query(SuggestionQuery suggestionQuery)
        {
            if (suggestionQuery.Term.StartsWith("<<") && suggestionQuery.Term.EndsWith(">>"))
            {
                var individualTerms = suggestionQuery.Term.Substring(2, suggestionQuery.Term.Length - 4).Split(new[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                var result          = new List <string>();

                foreach (var term in individualTerms)
                {
                    result.AddRange(spellChecker.SuggestSimilar(term,
                                                                suggestionQuery.MaxSuggestions,
                                                                null,
                                                                suggestionQuery.Field,
                                                                true));
                }

                return(new SuggestionQueryResult
                {
                    Suggestions = result.ToArray()
                });
            }
            string[] suggestions = spellChecker.SuggestSimilar(suggestionQuery.Term,
                                                               suggestionQuery.MaxSuggestions,
                                                               null,
                                                               suggestionQuery.Field,
                                                               true);

            return(new SuggestionQueryResult
            {
                Suggestions = suggestions
            });
        }
All Usage Examples Of SpellChecker.Net.Search.Spell.SpellChecker::SuggestSimilar