public Result <IEnumerable <string> > ProcessWords(IEnumerable <string> words) { return(wordConverter.ConvertWords(words) .RefineError("Failed to convert words") .Then(convertedWords => wordFilter.FilterWords(convertedWords)) .RefineError("Failed to filter words")); }
public IEnumerable <WeightedWord> WeightWords(IWordReader reader) { return(_filter .FilterWords(reader) .GroupBy(word => word) .Select(group => new WeightedWord(group.Key, group.Count())) .OrderByDescending(weightedWord => weightedWord.Weight) .ToList()); }
public void Run() { var words = wordReader .ReadToEnd(pathToWords); var filteredWords = wordFilter .FilterWords(words); var tags = tagReader .ReadTags(filteredWords) .OrderByDescending(item => item.FontSize) .ToList(); using (var picture = visualizer.CreatePictureWithItems(tags)) { if (File.Exists(pathToPicture)) { File.Delete(pathToPicture); } picture.Save(pathToPicture, format); } }