private ScoredString GetSuggestionPrefixScore(string wordToSuggest, string suggestion)
            {
                int smallestLength = Math.Min(wordToSuggest.Length, suggestion.Length);
                ScoredString suggestionScore = new ScoredString() {Text = suggestion};
                int score = 0;

                for (int i = 0; i < smallestLength; ++i)
                {
                    if (wordToSuggest[i] != suggestion[i])
                        break;

                    score++;
                }

                suggestionScore.Score = score;

                return suggestionScore;
            }
Ejemplo n.º 2
0
            private ScoredString GetSuggestionPrefixScore(string wordToSuggest, string suggestion)
            {
                int          smallestLength  = Math.Min(wordToSuggest.Length, suggestion.Length);
                ScoredString suggestionScore = new ScoredString()
                {
                    Text = suggestion
                };
                int score = 0;

                for (int i = 0; i < smallestLength; ++i)
                {
                    if (wordToSuggest[i] != suggestion[i])
                    {
                        break;
                    }

                    score++;
                }

                suggestionScore.Score = score;

                return(suggestionScore);
            }
Ejemplo n.º 3
0
            private ScoredString GetSuggestionPrefixScore(string wordToSuggest, string suggestion)
            {
                int          smallestLength  = Math.Min(wordToSuggest.Length, suggestion.Length);
                ScoredString suggestionScore = new ScoredString()
                {
                    Text = suggestion
                };
                int score = 0;

                for (int i = 0; i < smallestLength; ++i)
                {
                    // To cater the comparison with case insensitive words
                    if (wordToSuggest.ToLower()[i] != suggestion.ToLower()[i])
                    {
                        break;
                    }

                    score++;
                }

                suggestionScore.Score = score;

                return(suggestionScore);
            }