SpellCheck.Dictionaries
1.1.0
See the version list below for details.
dotnet add package SpellCheck.Dictionaries --version 1.1.0
NuGet\Install-Package SpellCheck.Dictionaries -Version 1.1.0
<PackageReference Include="SpellCheck.Dictionaries" Version="1.1.0" />
paket add SpellCheck.Dictionaries --version 1.1.0
#r "nuget: SpellCheck.Dictionaries, 1.1.0"
// Install SpellCheck.Dictionaries as a Cake Addin #addin nuget:?package=SpellCheck.Dictionaries&version=1.1.0 // Install SpellCheck.Dictionaries as a Cake Tool #tool nuget:?package=SpellCheck.Dictionaries&version=1.1.0
SpellCheck Offline Library
Offline spell-checking of words within texts, including Markdown tags. This library enables accurate detection of spelling errors while considering the presence of Markdown formatting.
The library utilizes OpenOffice's *.dic and *.aff files to support spell-checking in over 80 languages from around the world.
The library comes with built-in support for languages such as de-DE, en-GB, en-US, es-ES, fr-FR, it-IT, pl-PL, and pt-PT for your convenience. It enhances the spell-checking capability by providing preloaded dictionaries, thus streamlining the process of checking text for accuracy across different languages.
NOTE: Feel free to make a pull request.
SpellCheck.Simple nuget package
The SpellCheck.Simple
library can be used to perform various spell-checking tasks.
Here's an example of how to get started:
Install the SpellCheck.Simple nuget package from the package manager console:
dotnet add package SpellCheck.Simple
Just create an instance of the SpellCheck
class and use it.
using SpellCheck;
// Create a SpellCheck instance
var spellChecker = SpellCheck.CreateFromFiles("en-US.dic", "en-US.aff");
spellChecker.SetIgnoredWords("bulba", "kotek");
// Perform spell-checking
var isHelloCorrect = spellChecker.IsWordCorrect("hello"); // true
var isKotekCorrect = spellChecker.IsWordCorrect("kotek"); // true
var isAdsasdCorrect = spellChecker.IsWordCorrect("adsasd"); // false
var isTextCorrect = spellChecker.IsTextCorrect("This is an example text."); // true
// Get suggestions for an incorrect word
var suggestions = spellChecker.SuggestWord("wor"); // ["world", "worm", "worn", "worst", "wore", "word"]
// More advanced usage is possible as well
Use this class in the way above if you want to use your own dictionaries and don't want to use built-in dictionaries.
SpellCheck.Dictionaries nuget package
A much simpler way to use the SpellCheck class is to use the built-in dictionaries.
Install the SpellCheck.Dictionaries nuget package from the package manager console:
dotnet add package SpellCheck.Dictionaries
Just create an instance of the SpellCheck
class and use it.
using SpellCheck.Dictionaries;
var factory = new SpellCheckFactory();
// Create a SpellCheck instance
var spellChecker = factory.Create("en-US");
// Create a SpellCheck instance from current culture
var anotherSpellChecker = factory.Create(CultureInfo.CurrentCulture);
There are some built in dictionaries for the following languages:
Language | Culture | Dictionary | Affix file |
---|---|---|---|
Deutsch | de-DE | de_DE.dic | de_DE.aff |
English (US) | en-US | en_US.dic | en_US.aff |
English (GB) | en-GB | en_GB.dic | en_GB.aff |
Español | es-ES | es_ES.dic | es_ES.aff |
Français | fr-FR | fr_FR.dic | fr_FR.aff |
Italiano | it-IT | it_IT.dic | it_IT.aff |
Polish | pl-PL | pl_PL.dic | pl_PL.aff |
Português | pt-PT | pt_PT.dic | pt_PT.aff |
Custom dictionaries
using SpellCheck.Dictionaries;
var factory = new SpellCheckFactory("C:\Dictionaries");
// Create a SpellCheck instance from files ar-SR.dic and ar-SR.aff
// in the C:\Dictionaries directory
var spellChecker = factory.Create("ar-SR");
If the directory is not specified, the current directory is used.
SpellCheck
works with dictionaries and affix files coming from Open Office Hunspell format.
If you need more languages, you can download them from this GitHub repository
and put them into destination directory to work with. These files are in UTF-8 format.
Another way is to go to the website softmaker.com
and download dictionary you wish. A total of 85 language dictionaries are available.
After downloading, change the file name extension .sox
to .zip
and open the file. You should see some files inside.
Unpack *.dic
and *.aff
files to the destination directory, an that's all.
You can use these files by SpellCheck
and SpellCheckFactory
classes.
If you're using the SpellCheck
class alone,
the *.dic
and *.aff
files should be in UTF-8 format.
If they're not, you can convert them using the
iconv tool or
include the following code before the first use of the SpellCheck
class:
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
This step is unnecessary if you're using SpellCheckFactory
class.
Class dependency diagram
Links
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- SpellCheck.Simple (>= 1.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Bugfixes. SpellCheck project has been separated into another nuget repository SpellCheck.Simple 1.1.0.