Adding new words to Hunspell dictionary

Posted: 2 months ago Quote #20

I am working on a application able to read the OCR text from .pdf files in order to improve the quality of the text we have decided to implement Hunspell and it works! however now we need to grant the user the abilty to add new words to the dictionary file, I have been trying to add new words to the Hunspell dictionary (huspell.add("newword");) according to some documentation the new word is not been added to the dictionary file but "newword" is available for as long as the Hunspell object is alive, now I am following the approach to create a .txt file where the all the new words from the users are going to be stored, these words are being added to the dictionary using the add() method but it does not work I don't see the difference, do I need to do something else other than just adding the new words to the hunspell object before checking any word? should I specify an specific format in the .txt file for the new words?
Posted: 2 months ago Quote #21
Hello Chema,

is it possible that you add the whole text of your file at once? The hunspell.Add(word) method allows only to add a single word. So you have to split your file in single words and add it one by one using the Add method. BTW to test it you can hard code hunspell.Add("SomeWord") after you've loaded the dictionary and check if it is recognized.

If you can't fix the problem, please provide a zipped sample solution so that we can reproduce the error. Send it to [email protected]

Best regards
Crawler-Lib Developer
Posted: 2 months ago Quote #22
Hello, I am adding word by word also I have tried hardcoding the new words in Add() method I can make a test calling the Suggest() method and can see the new word is in the list
Posted: 2 months ago Quote #23
When you add words hard coded, and check the same string via Spell() it must return true. Please provide a zipped sample solution to reproduce this error. Send it to [email protected]
Crawler-Lib Developer
Posted: 2 months ago Quote #24
Unfortunately you couldn't send a sample solution because of legal reasons. With the code fragment you send us I've added a sample to the NHunspell Code Samples. As a result I can't reproduce the error you have. The code works as desired.

You can download the samples solution here:

After you find the error in your code it would be very nice to post the problem and how you fixed it.

Last but not least, We can provide consulting service to find the error with you at little cost and We sign a non disclosure agreement. You don't have to provide the source code. We can do this with a remote session with VNC or TeamViewer.
Crawler-Lib Developer