Пример #1
0
 public Dictionary <string, int> CountWords()
 {
     return(WordPattern.Matches(_text).Cast <Match>()
            .Select(m => m.Value.ToLower())
            .GroupBy(word => word)
            .ToDictionary(g => g.Key, g => g.Count()));
 }
Пример #2
0
        public static int GetWordCount(string content)
        {
            var wordsMatches = WordPattern.Matches(content);

            return(wordsMatches.Count);
        }