Sorac.WordCloud 1.3.0

dotnet add package Sorac.WordCloud --version 1.3.0
                    
NuGet\Install-Package Sorac.WordCloud -Version 1.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sorac.WordCloud" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sorac.WordCloud" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Sorac.WordCloud" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sorac.WordCloud --version 1.3.0
                    
#r "nuget: Sorac.WordCloud, 1.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Sorac.WordCloud@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sorac.WordCloud&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Sorac.WordCloud&version=1.3.0
                    
Install as a Cake 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

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 201 12/7/2024
1.2.3 135 12/7/2024
1.2.2 111 12/2/2024
1.2.1 117 12/2/2024
1.2.0 123 12/2/2024
1.1.3 942 10/31/2024
1.1.2 984 4/15/2024
1.1.1 948 4/15/2024
1.1.0 957 4/15/2024
1.0.9 979 2/12/2024
1.0.8 979 2/12/2024
1.0.7 950 2/12/2024
1.0.6 962 2/12/2024
1.0.5 976 2/12/2024
1.0.4 950 2/11/2024
1.0.3 969 2/10/2024
1.0.2 951 2/10/2024
1.0.1 941 2/10/2024
1.0.0 977 2/10/2024