Hi Jim,
Some time ago I asked you about usage of memoryStream as a user dictionary source and you advised to inherit UserDictionary class and do processing of MemoryStream storage in it.
I implemented such inheritor, but for some reason after I have applied a new version of Spell check (5.3) (it might be not related to the issue, but the code was not changed), an unexpected behavior appeared.
I am filling wordList variable of my child class that inherits UserDictionary with three words from file:
JSmith
IGoblet
jblack
and I can see that when I set my inheritor as a user dictionary it already includes the mentioned words (without any unexpected characters) in it. (I am doing that with SetUserDictionary() method of Keyoti.RapidSpell.RapidSpellChecker class).
Additionally, I am enabling flag SetIncludeUserDictionaryInSuggestions to have the words as proposals.
After that I am trying to check the following string:
"IGoblet and JSmith jblack and Jblack"
In this case, I am getting results that the word "JSmith" is an error, but at the same time, I have absolutely the same word as a proposal for this error.
If I have only "JSmith" word in user dictionary, the string is checked correctly.
The question is: is it enough to add the words to wordList list or I need to do something else at the moment to make it work? You might have some thoughts on that and if you do, please, share those with me.
A piece of code that is used to load words from stream attached below:
using System;
using System.Text;
using System.Collections;
using System.IO;
using Keyoti.RapidSpell;
namespace CustomKeyoti
{
public class CustomUserDictionary : UserDictionary
{
ArrayList wordList;
MemoryStream stream;
protected void loadWordsFromStream()
{
wordList = new ArrayList();
var reader = new StreamReader(this.stream);
for (string line = reader.ReadLine(); line != null; line = reader.ReadLine())
{
wordList.Add(line);
}
}
public CustomUserDictionary(MemoryStream stream)
{
// Read words from stream to arraylist
if (stream == null)
{
throw new ArgumentException("Parameter cannot be null", "stream");
}
this.stream = stream;
this.loadWordsFromStream();
}
... // code for adding / removing words etc.
}
Thanks in advance.