CrackTC / WordCloud

A C# word cloud generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A C# word cloud generator, algorithm based on this blog post, with minor improvements.


Usage

using var cloud = new WordCloudBuilder()
    .WithSize(800, 600)
    .WithPadding(5)
    .Build()

var dict = File.ReadAllText("path/to/your/text/file.txt")
               .Split(' ', StringSplitOptions.RemoveEmptyEntries)
               .Where(w => w.All(char.IsLetter))
               .GroupBy(w => w)
               .ToDictionary(g => g.Key, g => g.Count());

using var image = cloud.GenerateImage(dict);
using var stream = File.OpenWrite("path/to/your/output/image.png");
image.Encode().SaveTo(stream);

Example

see example

example

License

MIT

About

A C# word cloud generator

License:MIT License


Languages

Language:C# 84.6%Language:C 7.3%Language:Nix 4.3%Language:CMake 3.8%