Discussion:
[Aspell-user] dictionary locations
Shawn Riordan
2010-09-18 10:03:06 UTC
Permalink
This is probably a basic question.
But I am stumped.

How does Aspell find it's dictionaries?
I found a link to a list of dictionaries.
(ftp://ftp.gnu.org/gnu/aspell/dict/0index.html)
and grabbed both the 5.0 and 6.0 english dictionaries.
But they gave me no hints about where to unzip them.
So, I put them in my program's debug directory.
But whenever I run my code, I get "No word lists can be found for language
"en_US"".

Here is my code:

AspellConfig *pASCnfg = new_aspell_config();

aspell_config_replace(pASCnfg, "lang", "en_US");

AspellCanHaveError *pASCHE = new_aspell_speller(pASCnfg);

if(aspell_error_number(pASCHE) != 0)
{
// this always trips with "No word lists can be found for language
"en_US""
MessageBoxA(NULL,aspell_error_message(pASCHE),"foo",MB_OK);
}

What am I doing wrong?
Do I need to tell Aspell where to look for the dictionaries?
Anthony Dardis
2010-09-19 17:31:34 UTC
Permalink
I'm having a problem like Shawn Riordan's. I'm on Mac OS X 10.5.8. Aspell
is installed and works correctly through Aquamacs. I want to use the C API
to use Aspell in a little programming puzzle (Euler Project Problem 59).
I've installed the en_US dictionary, and aspell works correctly from the
command line. But when I run this code (basically exactly from the Aspell
C API doc):


AspellConfig * spell_config = new_aspell_config();
aspell_config_replace(spell_config, "lang", "en_US");
AspellCanHaveError * possible_err = new_aspell_speller(spell_config);
AspellSpeller * spell_checker = 0;
if (aspell_error_number(possible_err) != 0) {
printf ("%s\nl", aspell_error_message(possible_err));
return EXIT_FAILURE;
}
else
spell_checker = to_aspell_speller(possible_err);

I get


No word lists can be found for the language "en_US".
Shawn Riordan
2010-09-19 19:12:12 UTC
Permalink
I solved my problem by switching to Hunspell.
The spell check engine used by Firefox, Chrome and Open Office.

It's dictionaries are available pre-built.
You can put them anywhere you want.
You just pass the full path and filename of the dictionary to the
constructor of the Hunspell class.

It's all terribly easy.

I only needed to use 3 methods on the hunspell class, to give my application
the ability to check spelling on words and supply suggestions.
It took less than a day to finish that feature.

My only hiccup was that the compiler in MS Visual Studio was unhappy with a
method named "near()" in one of hunspell's classes.
For now, I have just gone through and renamed it "nearx()". I may go back
and look at it some more later.
Post by Anthony Dardis
I'm having a problem like Shawn Riordan's. I'm on Mac OS X 10.5.8. Aspell
is installed and works correctly through Aquamacs. I want to use the C API
to use Aspell in a little programming puzzle (Euler Project Problem 59).
I've installed the en_US dictionary, and aspell works correctly from the
command line. But when I run this code (basically exactly from the Aspell C
AspellConfig * spell_config = new_aspell_config();
aspell_config_replace(spell_config, "lang", "en_US");
AspellCanHaveError * possible_err = new_aspell_speller(spell_config);
AspellSpeller * spell_checker = 0;
if (aspell_error_number(possible_err) != 0) {
printf ("%s\nl", aspell_error_message(possible_err));
return EXIT_FAILURE;
}
else
spell_checker = to_aspell_speller(possible_err);
I get
No word lists can be found for the language "en_US".
_______________________________________________
Aspell-user mailing list
http://lists.gnu.org/mailman/listinfo/aspell-user
Anthony Dardis
2010-09-21 02:39:59 UTC
Permalink
Followup: I got the aspell-0.60.5 source package to try to figure out
what's going on. I compiled example-c.c from the examples folder. It
throws the same error. I tried adding (to the code below)

aspell_config_replace (spell_config, "dict-dir", "/sw/share/aspell");

since that seemed to be where the dictionary files are, and then got this:

The file "/usr/local/lib/aspell-0.60//en_phonet.dat" can not be opened for
reading.

(earlier it reported that it couldn't open
/usr/local/lib/aspell-0.60/en.dat for reading; there was no such file
there, so I copied one over from the source package; then it moved on to
this further reading failure.)

Kinda stumped here. Is there an env variable or PATH value that needs to
be set?

Also, I checked with Fink Commander to see what version I'm running, and
used it to make sure

aspell-dev aspell-shlibs aspell-en and aspell

are all the most current.


-------------earlier message

I'm having a problem like Shawn Riordan's. I'm on Mac OS X 10.5.8. Aspell
is installed and works correctly through Aquamacs. I want to use the C API
to use Aspell in a little programming puzzle (Euler Project Problem 59).
I've installed the en_US dictionary, and aspell works correctly from the
command line. But when I run this code (basically exactly from the Aspell
C API doc):


AspellConfig * spell_config = new_aspell_config();
aspell_config_replace(spell_config, "lang", "en_US");
AspellCanHaveError * possible_err = new_aspell_speller(spell_config);
AspellSpeller * spell_checker = 0;
if (aspell_error_number(possible_err) != 0) {
printf ("%s\nl", aspell_error_message(possible_err));
return EXIT_FAILURE;
}
else
spell_checker = to_aspell_speller(possible_err);

I get


No word lists can be found for the language "en_US".
Anthony Dardis
2010-09-21 14:34:34 UTC
Permalink
My code and Aspell find the dictionary on Ubuntu 10.04, so I guess there's
some issue about paths on Mac OS X.

Loading...