I've tried looking through the documentation found on SourceForge with Hunspell, but I'm still lost. Are there any decent examples of hunspell that a C++ beginner would be able to follow? Failing that, are there any free/opensource spellcheckers that are easier to use?
The hunspell function is a high-level wrapper for finding spelling errors within a text document. It takes a character vector with text ( plain , latex , man , html or xml format), parses out the words and returns a list with incorrect words for each line.
A line starting with '*' tells hunspell to insert the word into the user's dictionary (similar to the I command). A line starting with '&' tells hunspell to insert an all-lowercase version of the word into the user's dictionary (similar to the U command).
Hunspell is the spell checker library used by LibreOffice, OpenOffice, Mozilla Firefox, Google Chrome, Mac OS-X, InDesign, Opera, RStudio and many others. It provides a system for tokenizing, stemming and spelling in almost any language or alphabet.
English (GB) dictionary for hunspell Hunspell is a spell checker and morphological analyzer library and program designed for languages with rich morphology and complex word compounding or character encoding.
I agree that their website is a little bit difficult to navigate and there aren't many tutorials for it.
I'd recommend just diving in.
For example here is some code for NHunspell
, which is just the .net version. The code below is just the basic usage but should still be useful for someone getting started.
You can download dictionaries from the Open Office
repository
//affPath = path to the .aff file
//dictPath = path to the .dic file
// create and load your hunspell object
NHunspell.Hunspell hunspell = new NHunspell.Hunspell(affPath, dicPath);
// want to add a word that is not part of the base dictionary? Sure, we can do that.
hunspell.Add("stackoverflow");
//lets check if a word is valid
bool isValid = hunpsell.Spell("stackoverflowed");
if(!isValid)
{
//lets get some suggestions for this word
List<String> suggestions = hunspell.Suggest("stackoverflowed");
...do stuff with your list of suggestions
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With