6 |
my $affix_file='/usr/lib/ispell/english.aff'; |
my $affix_file='/usr/lib/ispell/english.aff'; |
7 |
my @test_words=( 'cars', 'dogs' ); |
my @test_words=( 'cars', 'dogs' ); |
8 |
|
|
9 |
|
my $findaffix_file='./findaffix.out'; |
10 |
|
|
11 |
my $loaded = 0; |
my $loaded = 0; |
12 |
|
|
13 |
BEGIN { $| = 1; print "1..4\n"; } |
BEGIN { $| = 1; print "1..6\n"; } |
14 |
END {print "not ok 1\n" unless $loaded;} |
END {print "not ok 1\n" unless $loaded;} |
15 |
|
|
16 |
use Lingua::Spelling::Alternative; |
use Lingua::Spelling::Alternative; |
25 |
|
|
26 |
### test load affix |
### test load affix |
27 |
|
|
|
|
|
28 |
if ( -e $affix_file ) { |
if ( -e $affix_file ) { |
29 |
my $ok = $a->load_affix($affix_file); |
my $ok = $a->load_affix($affix_file); |
30 |
print 'not ' if (! $ok); |
print 'not ' if (! $ok); |
38 |
print "ok 4 # - Skip\n"; |
print "ok 4 # - Skip\n"; |
39 |
} |
} |
40 |
|
|
41 |
|
undef $a; |
42 |
|
|
43 |
|
### test load findaffix |
44 |
|
|
45 |
|
if ( -e $findaffix_file ) { |
46 |
|
my $a = new Lingua::Spelling::Alternative( DEBUG => 1 ) ; |
47 |
|
|
48 |
|
my $ok = $a->load_findaffix($findaffix_file); |
49 |
|
print 'not ' if (! $ok); |
50 |
|
print "ok 5\n"; |
51 |
|
|
52 |
|
my @words = $a->alternatives(@test_words); |
53 |
|
print 'not ' if (! @words); |
54 |
|
print "ok 6 # - ",join(", ",@test_words)," -> ",join(", ",@words),"\n"; |
55 |
|
} else { |
56 |
|
print "ok 5 # - Skip, findaffix file '$findaffix_file' not found\n"; |
57 |
|
print "ok 6 # - Skip\n"; |
58 |
|
} |
59 |
|
|