2

I have been trying to integrate the NHunspell spell checker API into a unity project that I am currently working on. I have been able to set it up correctly using the code:

void Start()
{
      using (Hunspell hunspell = new Hunspell("Assets/Dictionaries/en_GB-oed.aff", "Assets/Dictionaries/en_GB-oed.dic"))
      {
            bool correct = hunspell.Spell("Recommendation");
            Debug.Log("Recommendation is spelled " + (correct ? "correct" : "not     correct"));
      }
} 

but when I press play, I get the following error:

NHunspell Unity Error

The files were downloaded from the Nhunspell website and are in the correct directory location:

AFF/DIC File Location

I understand that the error is caused because it believes the aff file to be null but it isn't. I haven't been able to find anyone with the same problem online and other examples using NHunspell seem to work without any problems using the same code. wherever I put the files in the directory the same error occurs.

If anyone can help me with this, It would be much appreciated.

Dan Puzey
  • 33,626
  • 4
  • 73
  • 96
Boslem
  • 21
  • 1
  • Can you confirm the stack trace of your exception? From the posted code, it's unclear what's causing it. – Dan Puzey Aug 04 '14 at 11:10
  • This is what I recieved: ArgumentNullException: Argument cannot be null. Parameter name: path1 System.IO.Path.Combine (System.String path1, System.String path2) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/Path.cs:138) NHunspell.MarshalHunspellDll.get_NativeDLLPath () NHunspell.MarshalHunspellDll.ReferenceNativeHunspellDll () – Boslem Aug 04 '14 at 11:12
  • That looks like a different error to what you think. It's not failing to find your dictionary; it's failing to properly load the Hunspell library. I don't know the library well, but it looks as though you need two DLLs - one managed, and one unmanaged. Do you have both of those in your project? – Dan Puzey Aug 04 '14 at 11:24
  • Oh ok, Thanks. I'm not sure as I installed Hunspell using the Nuget package Manager as it was suggested on the Hunspell website.(I don't use API's that are not Unity packages often so I may not understand everything) is there a easy way for me to check? – Boslem Aug 04 '14 at 11:49
  • We (the NHunspell) developers will investigate in this issue. This is the post in our support forum: http://www.crawler-lib.net/boards/topic/6/having-implementation-issues – Thomas Maierhofer Aug 04 '14 at 18:46
  • Did you find a soltution ? I have the same issue trying using it with Unity3D. I think it is a compatibility problem due to the fact Unity3D is using an old version of .Net through Mono. – Nicolas Hognon Oct 10 '14 at 09:14
  • Sadly I did not find a solution and had to write my own Spell checking system – Boslem Oct 11 '14 at 18:07
  • Is there any update about this problem? – Ognjen Marceta Jun 07 '17 at 09:27

0 Answers0