Ejemplo n.º 1
0
        public Image Create(TagsCloudSettings settings)
        {
            var words = processors.Aggregate(wordReader.ReadAllWords(settings.WordsPath),
                                             (current, processor) => processor.Process(current)).ToArray();
            var tags = WordCounter.Count(words)
                       .Select(word =>
            {
                var(font, size) = wordMeasurer.Measure(word);
                return(new Tag(word.Value, font, layouter.PutNextRectangle(size)));
            })
                       .ToArray();

            return(visualizer.Visualize(painter.Colorize(tags)));
        }
Ejemplo n.º 2
0
 private Result <Tag> CreateTag(Word word)
 {
     return(wordMeasurer.Measure(word)
            .SelectMany(tuple => layouter.PutNextRectangle(tuple.size),
                        (tuple, rectangle) => new Tag(word.Value, tuple.font, rectangle)));
 }