I am porting the authoring application to UWP platorm. The only puzzle piece I left is the NHunspell library. I use it to check spelling and thesaurus functions. I set up a damn thing out of it and created custom dictionaries for different things (i.e. another dictionary for each writing project). This library is a wonderful thing.
However, I cannot include this DLL in the UWP application.
1) Is there a way to force the use of this DLL? I really like how the NHunSpell system is configured. It has common sense and is very fast and easy to use.
2) If not, can anyone recommend a better solution for custom dictionaries, an individual spell check, etc.
Update 3
After a significant update and reading on the Internet, 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 this basic code and cleaning out English words from .dic Hunspell files, I created my own spell checker library that works in UWP.
Once I get it solidified, I will send it as an answer below to donate to the SO community. :)
Update 2
I give way to using Hunspell. It doesn't seem like this is possible at all ... are there any other libraries / packages anyone can offer?
UPDATE:
I probably need to rephrase the statement that I cannot enable the DLL: I cannot include the DLL through NuGet. He complains that the DLL is not compatible with the UAP / UWP platform.
I can MANUALLY include a DLL in my project by contacting an existing DLL (not NuGet). However, this DLL does prove to be incompatible with the UAP platform. A simple spellchecking call works fine in WinForms, but drops immediately with a System.IO.FileNotFoundException
.
The NHunspell constructor allows you to load related .dic
and .aff
. However, I reduced this by loading the files into memory, and then called an alternative constructor that takes a byte array instead of the file name for each of these files. It still crashes, but with a new error Method not found
:
String System.AppDomain.get_RelativeSearchPath()
I am looking for a spell checking mechanism that will work within UAP. I would prefer it to be NHunspell just for reference. However, I am not blind to the fact that this is becoming less and less possible as an option.
The people I work with have suggested using the built-in spell checker options. However, I cannot use the built-in spell-check features of Windows 10 / TextBox (what I know), because I cannot manage user dictionaries, and I cannot turn off things like automatic capitalization and word replacement (where it replaces a word for you if he thinks he's close enough to the right guess). These things are suicide chapters for writers! The writer may disable them at the OS level, but they may want them for other applications, not just that.
Please let me know if there is work for NHunspell. And if you donโt know about it, let me know your best spare spelling checker that works within UAP.
As a side note, I also use NHunspell for its thesaurus capability. It works great in my windows apps. I would also have to replace this functionality, hopefully with the same engine as the spellchecker. However, if you know a good thesaurus engine (but this is not a spell check), that's good too!
Thanks!