A .NET port of Hunspell for .NET and .NET Core
Download and install with NuGet: Hunspell.NetCore
- Reads Hunspell DIC and AFF file formats
- Supports checking and suggesting words
- Ported to fully managed C#
- Confusing LGPL, GPL, MPL tri-license
- Compatible with .NET Core
- Compatible with multiple .NET framework versions
- Uses .NET to handle cultures and encodings
"It's complicated"
Read the license: LICENSE
This library was ported from the original Hunspell source and as a result is licensed under an MPL, LGPL, and GPL tri-license. Read the LICENSE file to be sure you can use this library.
using Hunspell;
namespace ConsoleApp1
{
public class Program
{
static void Main(string[] args)
{
var hunspell = HunspellDictionary.FromFile(@"English (British).dic");
bool notOk = hunspell.Check("teh");
var suggestions = hunspell.Suggest("teh");
bool ok = hunspell.Check("the");
}
}
}
To know how up to date this port is, check the hunspell-origin submodule.
"Good enough I guess"
The performance of this port while not fantastic relative to the original binaries and NHunspell is definitely acceptable. If you need better performance you should check out NHunspell.
Benchmark | Hunspell.NetCore | NHunspell |
---|---|---|
Dictionary Loads /s | 🐢 2.2 | 🐇 15.92 |
Words Checked /s | 🐢 560,499 | 🐇 965,254 |
Note: Measurements taken on a Intel 6700K with a 850 PRO 256GB.