Spelling corrector

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Search MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-search -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-search/search-net-mcp:latest
Folders, licensing and more →

The SpellingCorrector class is designed to correct spelling errors in search queries, as well as to store words with correct spelling. You can learn about spelling correction in search queries on the Spell checking page.

To get the number of words in the spelling corrector dictionary, use the getCount method.

To get an array of words containing in the spelling corrector dictionary, the getWords method is used.

To add words to the spelling corrector dictionary, use the addRange method.

The clear method is used to remove all words from the spelling corrector dictionary.

To export words to a file, use the exportDictionary method.

To import words from a file, use the importDictionary method.

The following example demonstrates the use of methods of the spelling corrector.

String indexFolder = "c:\\MyIndex\\";
 
// Creating an index from in specified folder
Index index = new Index(indexFolder);
 
if (index.getDictionaries().getSpellingCorrector().getCount() > 0) {
    // Removing all words from the dictionary
    index.getDictionaries().getSpellingCorrector().clear();
}
 
// Adding words to the dictionary
String[] words = new String[] { "achieve", "accomplish", "attain", "reach" };
index.getDictionaries().getSpellingCorrector().addRange(words);
 
// Export words to a file
index.getDictionaries().getSpellingCorrector().exportDictionary("C:\\Words.txt");
 
// Import words from a file
index.getDictionaries().getSpellingCorrector().importDictionary("C:\\Words.txt");

More resources

GitHub examples

You may easily run the code from documentation articles and see the features in action in our GitHub examples:

Free online document search App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to search over your PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and more with our free online Free Online Document Search App.