Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
hunspell-origin @ 2de60ab Adds a few tests Aug 19, 2018
samples @ 4434ceb
src/WeCantSpell.Hunspell Improves ph usage for capitolization and fixes other issues when addi… Aug 19, 2018
test Updates performance testing projects Aug 19, 2018
.editorconfig Add more editorconfig preferences Jun 1, 2017
.gitattributes Added origin as a submodule Jul 1, 2016
.gitignore Trim the code of some cold or dead code Jun 25, 2017
.gitmodules Maybe https will work? Sep 19, 2016
GitVersion.yml Added appveyor build Sep 19, 2016
SharedAssemblyInfo.cs Migrate project to VS2017 May 29, 2017
WeCantSpell.Hunspell.v3.ncrunchsolution Migrate project to VS2017 May 29, 2017
appveyor.yml Changes random bytes in files to attempt to make builds work Jul 23, 2018
changelog.md Skips empty ph: field and supports character stripping Aug 19, 2018
contributing.md Improves word pair suggestions Aug 17, 2018
icon.png Adds icon to readme and package Jun 12, 2017
readme.md Restore old license Aug 4, 2018


WeCantSpell: Hunspell

A port of Hunspell v1 for .NET, .NET Standard, and .NET Core.


Download and install with NuGet: WeCantSpell.Hunspell

Build status NuGet version


  • Reads Hunspell DIC and AFF file formats
  • Supports checking and suggesting words
  • Ported to fully managed C#
  • Can be queried concurrently
  • Confusing LGPL, GPL, MPL tri-license
  • Compatible with .NET Core and .NET Standard
  • 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.

Quick Start Example

using WeCantSpell.Hunspell;

public class Program
    static void Main(string[] args)
        var dictionary = WordList.CreateFromFiles(@"English (British).dic");
        bool notOk = dictionary.Check("teh");
        var suggestions = dictionary.Suggest("teh");
        bool ok = dictionary.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 WeCantSpell.Hunspell NHunspell
Dictionary Loads /s 🐌 3.08 🐇 13.62
Words Checked /s 🐢 724,855 🐇 986,026

Note: Measurements taken on a Intel 6700K with a 850 PRO 256GB.

Specialized Examples

Construct from a list:

static void Main(string[] args)
    var words = "The quick brown fox jumps over the lazy dog".Split(' ');
    var dictionary = WordList.CreateFromWords(words);
    bool notOk = dictionary.Check("teh");

Construct from streams:

static void Main(string[] args)
    using(var dictionaryStream = File.OpenRead(@"English (British).dic"))
    using(var affixStream = File.OpenRead(@"English (British).aff"))
        var dictionary = WordList.CreateFromStreams(dictionaryStream, affixStream);
        bool notOk = dictionary.Check("teh");

Encoding Issues

The .NET Framework contains many encodings that can be handy when opening some dictionary or affix files that do not use a UTF8 encoding or were incorrectly given a UTF BOM. On a full framework platform this works out great but when using .NET Core or .NET Standard those encodings may be missing. If you suspect that there is an issue when loading dictionary and affix files you can check the dictionary.Affix.Warnings collection to see if there was a failure when parsing the encoding specified in the file, such as "Failed to get encoding: ISO-8859-15" or "Failed to parse line: SET ISO-8859-15". To enable these encodings, reference the System.Text.Encoding.CodePages package and then use Encoding.RegisterProvider(CodePagesEncodingProvider.Instance) to register them before loading files.

using System.Text;
using WeCantSpell.Hunspell;

class Program
    static Program() => Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

    static void Main(string[] args)
        var dictionary = WordList.CreateFromFiles(@"encoding.dic");
        bool notOk = dictionary.Check("teh");
        var warnings = dictionary.Affix.Warnings;