I am porting an application for writers to the UWP platorm. The only piece of the puzzle i have left is the NHunspell library. I use it extensively for spell checking and thesaurus features. I've customized the heck out of it, and created custom dictionaries for various things (i.e. a different dictionary for each writing project). This library is a beautiful thing.
However, I can't seem to include this DLL in my UWP application.
1) Is there a way to force the usage of this DLL? I really do like how the NHunSpell system is set up. It makes common sense and is very fast and easy to use.
2) If not, can anyone recommend a better solution for custom dictionaries, customized spell checking, etc?
Update 3
After considerable update and reading online, I found a link discussing the theory of spell checking. Here is one quick example (the one I used the most).
http://www.anotherchris.net/csharp/how-to-write-a-spelling-corrector-in-csharp/
After reading this article, taking that base code, and stripping the English words from the Hunspell .dic files, I have created my own spell-checking library that works in UWP.
Once I get it solidified, I will post it as an answer below to donate to the SO community. :)
Update 2
I'm conceding the use of Hunspell. It doesn't look like it is possible at all... are there any other libraries/packages that anyone can suggest?
UPDATE :
I probably need to rephrase the statement that I can't include the DLL: I cannot include the DLL through NuGet. It complains that the DLL is not compatible with the UAP/UWP platform.
I am able to MANUALLY include the DLL in my project by linking to an existing DLL (not NuGet). However, that DLL does indeed prove to be incompatible with the UAP platform. A simple call to spellcheck a word works fine in WinForms, but immediately crashes with System.IO.FileNotFoundException.
The constructor of NHunspell does reach out to load the associated .dic and .aff files. However, I have mitigated this by loading the files into memory and then call the alternate constructor which takes a byte array instead of a file name for each of those files. It still crashes, but with a new Method not found error:
String System.AppDomain.get_RelativeSearchPath()
I am looking for any spell checking engine that will work within the UAP framework. I would prefer for it to be NHunspell simply for familiarity reasons. However, I'm not blind to the fact that this is becoming increasingly less-possible as an option.
People I work with have suggested that I use the built-in spellchecking options. However, I can't use the built-in Windows 10/TextBox spell checking features (that I know of), because I can't control custom dictionaries and I can't disable things like auto-capitalize and word-replacement (where it replaces the word for you if it thinks it is close enough to the right guess). Those things are chapter-suicide for writers! A writer can turn them off at the OS level, but they may want them on for other apps, just not this one.
Please let me know if there is a work-around for NHunspell. And if you don't know of a work-around, please let me know your best replacement custom spellcheck engine that works within the UAP framework.
As a side note, I also use NHunspell for its thesaurus capability. It works very well in my windows apps. I would also have to replace this functionality as well -- hopefully with the same engine as the spellcheck engine. However, if you know of a good thesaurus engine (but it doesn't spell check), that's good too!
Thank you!!
I download the source code of NHunspell library and I tried to build a library with UWP support, however I found problems with the Marshalling (Marshalling.cs)
The package loads dlls that only working in x86 and x64 architecture, so in arm (mobiles, tablets) the app will not work.
The package loads dlls with system calls:
and I think that it needs to be rewrite for working in UWP, because UWP uses a sandboxing.
IMHO there are only two options:
1) Rewrite the Marshalling class with the restrictions of UWP.
2) Not use Hunspell in your program.
I don't have a large knowledge about dlls with UWP, but I believe that the rewrite could be very difficult.