On 10 Sep 2007 at 12:52, Chas Owens wrote:

> On 9/10/07, Beginner <[EMAIL PROTECTED]> wrote:
> snip
> > Does anyone have any ideas why this isn't working? Could this be
> due
> > to an environment variable?
> snip


> Are you sure you create (or updated) your dictionary correctly? 
..snip
It seems not.

I peppered my script with $speller->errstr. It was empty until the 
final statement that I have now modified to look like this:

....snip
my $lang = $ENV{'LANG'};
my $dir = getcwd;
my $dict = "local.dict";
my $word = "Aberystwyth";


$speller->set_option('lang' , 'en');
print $speller->errstr,"\n";
$speller->set_option('dict-dir' , $dir);
print $speller->errstr,"\n";
$speller->set_option('master' , $dict);
print $speller->errstr,"\n";
my $string = $speller->get_option('master');
print $speller->errstr,"\n";
print "String=$string\n";

print $speller->check( $word )
          ? "$word found\n"
          : "$word not found!\n";

print "Check returned ",$speller->check($word),"\n";;
print $speller->errstr,"\n";
 
And returns this:

Aberystwyth not found!
Use of uninitialized value in print at spellcheck.pl line 40.
Check returned
The file "/root/aspell/dict.local" is not in the proper format.

What seems odd is I can use the same dictionary form the command 
line:
aspell check -d ./dict.local badwords.txt and Aberystwyth is not 
flagged as unknown.

aspell -v
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.5)

So I recreated the local.dict again.

>cat wordlist
aardvark
abandonment
Aberystwyth
>aspell --lang=en create master ./dict.local < wordlist
> perl spellchecker.pl

...snip
String=local.dict
Aberystwyth not found!
Use of uninitialized value in print at spellcheck.pl line 40.
Check returned
The file "/root/aspell/local.dict" is not in the proper format.

>strings /root/aspell/local.dict
aspell default speller rowl 1.10
phonet
*BNTNMNT
abandonment
*BRST@
Aberystwyth
*TFK
aardvark


Again the file works form the command line (expect it hardly 
recognises any words now). I am a bit lost. Perhaps the maintainer 
can help?

Thanx,
Dp.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to