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

FormGrams() private static method

Form all ngrams for a given word.
private static FormGrams ( System text, int ng ) : System.String[]
text System the word to parse ///
ng int the ngram length e.g. 3 ///
return System.String[]
        private static System.String[] FormGrams(System.String text, int ng)
        {
            int len = text.Length;
            System.String[] res = new System.String[len - ng + 1];
            for (int i = 0; i < len - ng + 1; i++)
            {
                res[i] = text.Substring(i, (i + ng) - (i));
            }
            return res;
        }