Examples/Tutorials of Hunspell
Asked Answered
C

1

9

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?

Celebrated answered 21/6, 2013 at 17:58 Comment(0)
P
5

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
}
Palikar answered 15/11, 2013 at 21:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.