Esempio n. 1
0
 /// <summary>
 /// Returns suggestions for an input string.
 /// </summary>
 /// <param name="input">Input string</param>
 protected override IEnumerable <string> GetSuggestionImpl(string input)
 {
     return(Words
            .Where(x => !string.IsNullOrEmpty(x) && x.First() == input.First() && x.Last() == input.Last())
            .Where(x => Match(input, x))
            .Where(x => x.Length > GetMinimumWordlength(input))
            .OrderBy(x => TextDistance.GetDamerauLevenshteinDistance(input, x)));
 }
Esempio n. 2
0
        /// <inheritdoc />
        protected override IEnumerable <string> GetSuggestionHelper(string input)
        {
            string inputStr = input.ToLower(CultureInfo.InvariantCulture);

            return(Words
                   .Where(x => (!string.IsNullOrEmpty(x)) && (x[0] == inputStr[0]) && (x[x.Length > 0 ? x.Length - 1 : 0] == inputStr[inputStr.Length > 0 ? inputStr.Length - 1 : 0]))
                   .Where(x => Match(inputStr, x))
                   .Where(x => x.Length > GetMinimumWordlength(inputStr))
                   .OrderBy(x => TextDistance.GetDamerauLevenshteinDistance(inputStr, x)));
        }
Esempio n. 3
0
        /// <summary>
        /// Returns suggestions for an input string.
        /// </summary>
        /// <param name="input">Input string</param>
        protected override IEnumerable <string> GetSuggestionImpl(string input)
        {
            string inputStr = input.ToLower(CultureInfo.InvariantCulture);

            return(Words
                   .Where(x => !string.IsNullOrEmpty(x) && x.First() == inputStr.First() && x.Last() == inputStr.Last())
                   .Where(x => Match(inputStr, x))
                   .Where(x => x.Length > GetMinimumWordlength(inputStr))
                   .OrderBy(x => TextDistance.GetDamerauLevenshteinDistance(inputStr, x)));
        }
        /// <inheritdoc />
        protected override IEnumerable <string> GetSuggestionHelper(string input)
        {
            string inputStr = input.ToLower(CultureInfo.InvariantCulture);

            return(Words.OrderBy(x => TextDistance.GetDamerauLevenshteinDistance(inputStr, x)));
        }
Esempio n. 5
0
 /// <summary>
 /// Returns suggestions for an input string.
 /// </summary>
 /// <param name="input">Input string</param>
 protected override IEnumerable <string> GetSuggestionImpl(string input)
 {
     return(Words.OrderBy(x => TextDistance.GetDamerauLevenshteinDistance(input, x)));
 }