poprawiony compiledic, dziala
tyle, ze compiledic.conf dorobilem recznie i plik .sym umiescilem recznie w jakims tam katalogu (zostal znaleziony) git-svn-id: svn://atos.wmid.amu.edu.pl/utt@16 e293616e-ec6a-49c2-aa92-f4a8b91c5d16
This commit is contained in:
parent
c8e8fa8b58
commit
e1942bef32
@ -52,7 +52,6 @@ foreach $file ($systemconfigfile, $userconfigfile){
|
|||||||
}
|
}
|
||||||
#########################################################
|
#########################################################
|
||||||
|
|
||||||
|
|
||||||
GetOptions("symbols=s" => \$symbols,
|
GetOptions("symbols=s" => \$symbols,
|
||||||
"help|h" => \$help);
|
"help|h" => \$help);
|
||||||
|
|
||||||
@ -69,13 +68,11 @@ END
|
|||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
-f $symbols or die("Symbol file not found.");
|
-f $symbols or die("Symbol file not found.");
|
||||||
|
|
||||||
@ARGV < 1 or die("Source dictionary not given.");
|
@ARGV > 0 or die("Source dictionary not given.");
|
||||||
|
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
|
|
||||||
@ -88,10 +85,7 @@ my $filenameprefix = $1;
|
|||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
# Tworzymy katalog tymczasowy, gdzie wszystko bedzie umieszczane.
|
# Tworzymy katalog tymczasowy, gdzie wszystko bedzie umieszczane.
|
||||||
$tmp_root = tempdir( CLEANUP => 1 );
|
my $tmp_root = File::Temp::tempdir( CLEANUP => 1 );
|
||||||
|
|
||||||
print "TMPROOT: $tmp_root\n";
|
|
||||||
|
|
||||||
|
|
||||||
(undef, my $symfile) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sym" );
|
(undef, my $symfile) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sym" );
|
||||||
my $symfilenoext=$symfile;
|
my $symfilenoext=$symfile;
|
||||||
@ -108,8 +102,8 @@ copy($symbols, $symfile);
|
|||||||
|
|
||||||
# Analiza pliku slownika
|
# Analiza pliku slownika
|
||||||
|
|
||||||
print "preparing file...........................................\n";
|
print "preparing file...........................................";
|
||||||
print "... sed section .....\n";
|
#print "... sed section .....\n";
|
||||||
(undef, my $file_sed) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sed" );
|
(undef, my $file_sed) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sed" );
|
||||||
`sed -r "s/([[:punct:]])/\[\\1\]/g" < $file > $file_sed`;
|
`sed -r "s/([[:punct:]])/\[\\1\]/g" < $file > $file_sed`;
|
||||||
|
|
||||||
@ -122,8 +116,8 @@ print "OK\n";
|
|||||||
|
|
||||||
open(IN, $file_sed);
|
open(IN, $file_sed);
|
||||||
|
|
||||||
$lineCount = 0;
|
my $lineCount = 0;
|
||||||
$fileCount = 0;
|
my $fileCount = 0;
|
||||||
|
|
||||||
open(FILE, ">$tmp_root/slo_$fileCount");
|
open(FILE, ">$tmp_root/slo_$fileCount");
|
||||||
|
|
||||||
@ -146,11 +140,11 @@ while (<IN>) {
|
|||||||
print "building partial automata";
|
print "building partial automata";
|
||||||
|
|
||||||
#32 kropki, fileCount plikow
|
#32 kropki, fileCount plikow
|
||||||
$filesPerDot = $fileCount/32;
|
my $filesPerDot = $fileCount/32;
|
||||||
$files=$filesPerDot;
|
my $files=$filesPerDot;
|
||||||
$dots=0;
|
my $dots=0;
|
||||||
|
|
||||||
for ($i=0; $i<=$fileCount; $i++) {
|
for (my $i=0; $i<=$fileCount; $i++) {
|
||||||
|
|
||||||
if ($files >= $filesPerDot) {
|
if ($files >= $filesPerDot) {
|
||||||
$files = 0;
|
$files = 0;
|
||||||
@ -163,7 +157,7 @@ for ($i=0; $i<=$fileCount; $i++) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if ($dots < 32) {
|
if ($dots < 32) {
|
||||||
for ($i=0; $i<32 - $dots; $i++) {
|
for (my $i=0; $i<32 - $dots; $i++) {
|
||||||
print ".";
|
print ".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,14 +169,14 @@ unlink <$tmp_root/slo_*>;
|
|||||||
print "building final automaton";
|
print "building final automaton";
|
||||||
|
|
||||||
#35 kropek...
|
#35 kropek...
|
||||||
$ndots=33;
|
my $ndots=33;
|
||||||
$filesPerDot = $fileCount/$ndots;
|
$filesPerDot = $fileCount/$ndots;
|
||||||
$files=$filesPerDot;
|
$files=$filesPerDot;
|
||||||
$dots=0;
|
$dots=0;
|
||||||
|
|
||||||
copy("$tmp_root/slownik_0.fsm", "$tmp_root/slownik1.fsm");
|
copy("$tmp_root/slownik_0.fsm", "$tmp_root/slownik1.fsm");
|
||||||
|
|
||||||
for ($i=1; $i<=$filecount; $i++) {
|
for (my $i=1; $i<=$fileCount; $i++) {
|
||||||
|
|
||||||
if ($files >= $filesPerDot) {
|
if ($files >= $filesPerDot) {
|
||||||
$files = 0;
|
$files = 0;
|
||||||
@ -191,18 +185,18 @@ for ($i=1; $i<=$filecount; $i++) {
|
|||||||
}
|
}
|
||||||
$files++;
|
$files++;
|
||||||
|
|
||||||
`fsmunion $tmp_root/slownik_$i slownik1.fsm > $tmp_file/slownik2.fsm`;
|
`fsmunion $tmp_root/slownik_$i slownik1.fsm > $tmp_root/slownik2.fsm`;
|
||||||
|
|
||||||
move("$tmp_root/slownik2.fsm", "$tmp_root/slownik1.fsm") || die "Unable to move $tmp_root/slownik2.fsm!\n";
|
move("$tmp_root/slownik2.fsm", "$tmp_root/slownik1.fsm") || die "Unable to move $tmp_root/slownik2.fsm!\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dots < $ndots) {
|
if ($dots < $ndots) {
|
||||||
for ($i=0; $i<$ndots - $dots; $i++) {
|
for (my $i=0; $i<$ndots - $dots; $i++) {
|
||||||
print ".";
|
print ".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
`fsmunion $tmp_root/* > $tmp_root/slownik1.fsm`;
|
#`fsmunion $tmp_root/* > $tmp_root/slownik1.fsm`;
|
||||||
|
|
||||||
print "OK\n";
|
print "OK\n";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user