Beginner wrote:
I am sorry if this is a bit module specific, I am hoping someone on
the list has some experience of Text::Aspell and can help.
I am trying to use a custom dictionary. I can use the command line
aspell check --master="./dict.local" somefile
and words included in my dictionary like "Aberystwyth" are not
flagged as unknown.
With the following script:
======= spellcheck.pl ====
use strict;
use warnings;
use Text::Aspell;
my $word = "Aberystwyth";
my $speller = Text::Aspell->new;
die unless $speller;
$speller->set_option('master' , './dict.local');
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";
========
Outputs:
String=./spl-dict
Aberystwyth not found!
The script is a almost complete paste from the help docs for
Text::Aspell. I have tried other options (personal|size) from the
GNU/Aspell but they all seem to be ignored.
Does anyone have any ideas why this isn't working? Could this be due
to an environment variable?
Hey Dermot
Is the current directory for the Perl program the same as the one where
your custom dictionary lives? You may need to use an absolute path to
the dictionary file. Either way you should check the status of your
call to set_option:
my $status = $speller->set_option('master' , './dict.local');
die $speller->errstr unless defined $status;
Hope this helps,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/