public Result <Dictionary <string, int> > GetWordsFrequencyDict() { var linesResult = textReader.GetLines(); if (!linesResult.IsSuccess) { return(Result.Fail <Dictionary <string, int> >(linesResult.Error)); } return(Result.Ok(linesResult.Value .SelectMany(l => wordPattern.Matches(l).Cast <Match>().Select(m => m.Value)) .Where(cw => !dullWordsEliminator.IsDull(cw)) .GroupBy(cw => cw.ToLower()) .ToDictionary(wg => wg.Key, wg => wg.Count()))); }