forked from DistributedProofreaders/guiprep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fwordgen.pl
44 lines (40 loc) · 964 Bytes
/
fwordgen.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Storable qw(nstore);
my (%words,%fwords,@multi,$word,$hold,$last,$wt,$ws,$mv,$mmv,$hold1);
open (WLIST, "<2of4brif.txt");
while ($word = <WLIST>){
chomp $word;
$words{$word}='';
$wt++;
}
close WLIST;
open (OUT, ">dup.txt");
foreach $word (keys %words){
$hold = $word;
$last = chop $word;
if ($word =~ s/s/f/g){
$ws++;
if (exists $words{$word.$last}){
print OUT $hold,"\n";
$hold1 = $hold;
$last = chop $hold;
$hold =~ s/s/*/g;
$hold .= $last;
$mv++;
}
if (exists $fwords{$word.$last}){
push @multi, $word.$last;
print OUT $hold,"\n";
}
$fwords{$word.$last} = $hold;
}
}
foreach $word(@multi){
$hold = $word;
$last = chop $hold;
$hold =~ s/f/*/g;
$hold .= $last;
$fwords{$word} = $hold;
$mmv++;
}
print "$wt total words checked, $ws fcanno words, $mv words where fcanno is a regular word, $mmv words with more than 1 variation.";
nstore \%fwords, 'fcannos.bin';