Stop word dictionary

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 StopWordDictionary class is designed to store stop words in an index. Information on using stop words during indexing is provided on the Indexing with stop words page.

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

To add stop words to the dictionary, use the addRange method.

To remove words from the dictionary, use the removeRange method.

To check for a word in a dictionary, use the contains method.

To remove all words from the dictionary, use the clear method.

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 stop word dictionary.

String indexFolder = "c:\\MyIndex\\";
 
// Creating an index from in specified folder
Index index = new Index(indexFolder);
 
if (index.getDictionaries().getStopWordDictionary().getCount() > 0) {
    // Removing all words from the dictionary
    index.getDictionaries().getStopWordDictionary().clear();
}
 
// Adding stop words to the dictionary
String[] words = new String[] { "a", "an", "the", "but", "by" };
index.getDictionaries().getStopWordDictionary().addRange(words);
 
if (index.getDictionaries().getStopWordDictionary().contains("but") &&
    index.getDictionaries().getStopWordDictionary().contains("by")) {
    // Removing words from the dictionary
    index.getDictionaries().getStopWordDictionary().removeRange(new String[] { "but", "by" });
}
 
// Export words to a file
index.getDictionaries().getStopWordDictionary().exportDictionary("C:\\Words.txt");
 
// Import words from a file
index.getDictionaries().getStopWordDictionary().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.