Given that Hunspell does not appear to support case-insensitive spelling checks, you might want to consider adapting your algorithm slightly:
Given THesis
, you could try:
bool isExist = false;
using (Hunspell english = new Hunspell("en_US.aff", "en_US.dic"))
{
TextInfo textInfo = new CultureInfo("en-US",false).TextInfo;
isExist = english.Spell("THesis")
| english.Spell(textInfo.ToLower("THesis")
| english.Spell(textInfo.ToUpper("THesis"))
| english.Spell(textInfo.ToTitleCase("THesis"))
}
This will in turn logically check "THesis", "thesis", "THESIS" and "Thesis" and return true if any of those spellings is valid, courtesy of the logical OR operator.
Similarly for canada
, this would work, as the ToTitleCase()
method would at least guarantee a match.
This should work for most single words (including all caps acronyms).