I have a problem with my project.
This is a project for my university.
I decided to add HNUSpell from nuget package in order to check spelling It works well in code but unfortunately whn I make an .exe from it I face with this Exception:
here is code:
using (Hunspell hunspell = new Hunspell("en_US.aff", "fa.dic"))
{
string[] lines = System.IO.File.ReadAllLines("New Text Document (2).txt");
foreach (var line in lines)
{
line.Replace(" " , string.Empty);
hunspell.Add(line);
}
List<string> suggestions = hunspell.Suggest(myInput);
foreach (string suggestion in suggestions)
{
//Do something
}
I really got confused and don't what should I do.
Can anyone please help me?
thanks in advance
In the first line of your code snippet you specify the path to the aff file:
You provide a relative path
"en_US.aff"
. When you run your program the exception occurs, because the file can't be found nearby.What you could do is specifying a absolute path instead of a relative one: