Unscrambler 1.0.1
dotnet add package Unscrambler --version 1.0.1
NuGet\Install-Package Unscrambler -Version 1.0.1
<PackageReference Include="Unscrambler" Version="1.0.1" />
paket add Unscrambler --version 1.0.1
#r "nuget: Unscrambler, 1.0.1"
// Install Unscrambler as a Cake Addin #addin nuget:?package=Unscrambler&version=1.0.1 // Install Unscrambler as a Cake Tool #tool nuget:?package=Unscrambler&version=1.0.1
Unscrambler
Unscrambler is a .NET package that can help you find all possible words from a list of letters. It is useful for solving word puzzles, crossword clues, or anagrams. Unscrambler is fast, easy to use, and highly optimized.
Installation
You can install Unscrambler from NuGet, the package manager for .NET. To install Unscrambler, run the following command in your terminal:
dotnet add package Unscrambler --version 1.0.0
Usage
Loading words
Before you can use Unscrambler to find words, you need to load the words into the an instance of IUnscrambler
. You can use any list of words that you want, as long as they are in a text file where each word is on a new line. You can find some examples of word lists online, such as:
- Github repo: dictionary by Dolph Mathews
- Wikipedia also has some sources
- You can also use your own.
To load the words from a file, you can use the BasicWordLoader
class that comes with the package. It takes an IUnscrambler
object and a file path as parameters, and returns a boolean value indicating whether the loading was successful or not.
IUnscrambler unscrambler = new BasicUnscrambler();
IWordLoader loader = new BasicWordLoader("words.txt");
// Load words from a file
bool success = await loader.LoadFromFileAsync(unscrambler);
// If success is true, the words are loaded successfully
Implementing your own word loader
If you are already loading your words from a database or another source, can add the words to a IUnscrambler like this:
IUnscrambler unscrambler = new BasicUnscrambler();
foreach (string word in words)
{
unscrambler.AddWord(word);
}
You can also create your own implementation of the IWordLoader
interface if you want to load words from a different source.
Finding words
Once you have loaded the words into the package, you can use the Unscramble
method to find all the words that can be made from a list of letters. The method takes a string of letters as a parameter, and returns a HashSet<string>
object that contains all the words found.
HashSet<string> words = unscrambler.Unscramble("letters");
You can then iterate over the HashSet<string>
object to access the words, or use any other methods that are available for the HashSet<T>
class.
Example
Here is an example of how to use Unscrambler to find words from a list of letters and print them to the console:
IUnscrambler unscrambler = new BasicUnscrambler();
IWordLoader loader = new BasicWordLoader("words.txt");
// Load words from a file
bool success = await loader.LoadFromFileAsync(unscrambler);
if (success)
{
// Find words from a list of letters
HashSet<string> words = unscrambler.Unscramble("letters");
// Print the words to the console
foreach (string word in words)
{
Console.WriteLine(word);
}
}
else
{
Console.WriteLine("Failed to load words from file.");
}
Product | Versions 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. |
-
net8.0
- No dependencies.
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.0.1 | 152 | 2/1/2024 | |
1.0.0 | 114 | 2/1/2024 | |
0.0.1 | 120 | 2/1/2024 | |
0.0.1-alpha.1 | 67 | 2/1/2024 |