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:
obrebski 2008-03-27 11:29:02 +00:00
parent c8e8fa8b58
commit e1942bef32

View File

@ -52,7 +52,6 @@ foreach $file ($systemconfigfile, $userconfigfile){
}
#########################################################
GetOptions("symbols=s" => \$symbols,
"help|h" => \$help);
@ -69,13 +68,11 @@ END
exit 0;
}
##################################################
-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;
@ -88,10 +85,7 @@ my $filenameprefix = $1;
##################################################
# Tworzymy katalog tymczasowy, gdzie wszystko bedzie umieszczane.
$tmp_root = tempdir( CLEANUP => 1 );
print "TMPROOT: $tmp_root\n";
my $tmp_root = File::Temp::tempdir( CLEANUP => 1 );
(undef, my $symfile) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sym" );
my $symfilenoext=$symfile;
@ -108,8 +102,8 @@ copy($symbols, $symfile);
# Analiza pliku slownika
print "preparing file...........................................\n";
print "... sed section .....\n";
print "preparing file...........................................";
#print "... sed section .....\n";
(undef, my $file_sed) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sed" );
`sed -r "s/([[:punct:]])/\[\\1\]/g" < $file > $file_sed`;
@ -122,8 +116,8 @@ print "OK\n";
open(IN, $file_sed);
$lineCount = 0;
$fileCount = 0;
my $lineCount = 0;
my $fileCount = 0;
open(FILE, ">$tmp_root/slo_$fileCount");
@ -146,11 +140,11 @@ while (<IN>) {
print "building partial automata";
#32 kropki, fileCount plikow
$filesPerDot = $fileCount/32;
$files=$filesPerDot;
$dots=0;
my $filesPerDot = $fileCount/32;
my $files=$filesPerDot;
my $dots=0;
for ($i=0; $i<=$fileCount; $i++) {
for (my $i=0; $i<=$fileCount; $i++) {
if ($files >= $filesPerDot) {
$files = 0;
@ -163,7 +157,7 @@ for ($i=0; $i<=$fileCount; $i++) {
}
if ($dots < 32) {
for ($i=0; $i<32 - $dots; $i++) {
for (my $i=0; $i<32 - $dots; $i++) {
print ".";
}
}
@ -175,14 +169,14 @@ unlink <$tmp_root/slo_*>;
print "building final automaton";
#35 kropek...
$ndots=33;
my $ndots=33;
$filesPerDot = $fileCount/$ndots;
$files=$filesPerDot;
$dots=0;
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) {
$files = 0;
@ -191,18 +185,18 @@ for ($i=1; $i<=$filecount; $i++) {
}
$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";
}
if ($dots < $ndots) {
for ($i=0; $i<$ndots - $dots; $i++) {
for (my $i=0; $i<$ndots - $dots; $i++) {
print ".";
}
}
`fsmunion $tmp_root/* > $tmp_root/slownik1.fsm`;
#`fsmunion $tmp_root/* > $tmp_root/slownik1.fsm`;
print "OK\n";