Homophone dictionary

The HomophoneDictionary class is designed to store homophones in an index. For information on searching using homophones, see the Homophone search page.

To get the number of homophones in the dictionary, use the Count property.

To add groups of homophones to the dictionary, use the AddRange method.

The Clear method is used to remove all homophones from the dictionary.

To export homophones to a file, use the ExportDictionary method.

To import homophones from a file, use the ImportDictionary method.

The following example demonstrates the use of methods of the homophone dictionary.

C#

string indexFolder = @"c:\MyIndex\";
 
// Creating an index from in specified folder
Index index = new Index(indexFolder);
 
if (index.Dictionaries.HomophoneDictionary.Count > 0)
{
    // Removing all homophones from the dictionary
    index.Dictionaries.HomophoneDictionary.Clear();
}
 
// Adding homophones to the dictionary
string[][] homophoneGroups = new string[][]
{
    new string[] { "awe", "oar", "or", "ore" },
    new string[] { "aye", "eye", "i" },
};
index.Dictionaries.HomophoneDictionary.AddRange(homophoneGroups);
 
// Export homophones to a file
index.Dictionaries.HomophoneDictionary.ExportDictionary(@"C:\Homophones.dat");
 
// Import homophones from a file
index.Dictionaries.HomophoneDictionary.ImportDictionary(@"C:\Homophones.dat");

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.