- Timestamp:
- 03/20/08 12:08:21 (17 years ago)
- Branches:
- master, help
- Children:
- c8e8fa8
- Parents:
- 20b4e44
- git-author:
- pawelk <pawelk@…> (03/20/08 12:08:21)
- git-committer:
- pawelk <pawelk@…> (03/20/08 12:08:21)
- Location:
- app
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
app/TODO
r20b4e44 r389de9a 8 8 * mar nie obsluguje plikow konfiguracyjnych [JW] 9 9 10 * compiledic - plik tymczasowe [PK]10 * DONE compiledic - plik tymczasowe [PK] 11 11 12 12 * ser i grp - parametr tags (zeby bral wskazany program tag2re) [TO] 13 13 14 * lista zaleznosci dla komend system w perlu [PK]14 * DONE lista zaleznosci dla komend system w perlu [PK] 15 15 16 16 * polaczyc sen'y [TO] 17 17 18 * poprawic utt_make_conf (wykrywanie slownikow) [PK]18 * DONE poprawic utt_make_conf (wykrywanie slownikow) [PK] 19 19 20 20 * generowanie i sprawdzanie zaleznosci dla tarballa [PK] -
app/dist/common/utt_make_config.pl
rd593c5e r389de9a 12 12 13 13 prepareUttUsrHome($usr_home); 14 conf_utt(catfile($usr_home, 'utt.conf'), $sys_home); 15 14 16 conf_cor(catfile($usr_home, 'cor.conf'), $sys_home); 15 17 conf_grp(catfile($usr_home, 'grp.conf'), $sys_home); … … 17 19 conf_lem(catfile($usr_home, 'lem.conf'), $sys_home); 18 20 conf_ser(catfile($usr_home, 'ser.conf'), $sys_home); 19 conf_utt(catfile($usr_home, 'utt.conf'), $sys_home);20 21 21 22 print "UTT user configuration created in $usr_home\n"; … … 27 28 my $dir = shift; 28 29 29 if(-d $dir) { 30 print "Old configuration will be deleted!\n"; 31 my $cnt = unlink <$dir/*>; 32 print "$cnt files deleted.\n"; 30 print "Preparing user configuration.\n"; 31 32 if(-d $dir) { 33 print "Old configuration detected. "; 34 my $cnt = unlink <$dir/*>; 35 print "($cnt files deleted)\n"; 36 } 37 else { 38 print "Creating directory $dir\n"; 39 if(1 != mkdir $dir) { 40 die "Unable to create UTT user configuration!\n"; 33 41 } 34 else { 35 print "Creating directory $dir\n"; 36 if(1 != mkdir $dir) { 37 die "Unable to create UTT user configuration!\n"; 38 } 39 } 42 } 40 43 } 41 44 … … 114 117 my $utt_file = shift; 115 118 my $utthome = shift; 119 120 my $lang = getUserLanguage(abs_path(catdir($utthome, "share/utt"))); 121 116 122 open(FILE, ">$utt_file"); 117 123 118 124 print FILE makeConfigHeader(); 119 print FILE "# user locale \n";120 print FILE "language=", findLocale(), "\n";125 print FILE "# user locale (dictionary)\n"; 126 print FILE "language=", $lang, "\n"; 121 127 122 128 close FILE; 129 } 130 131 sub getUserLanguage() { 132 my $dict_dir = shift; 133 134 print "Setup dictionaries.\n"; 135 136 opendir(DIR, $dict_dir) || die "Install dictionary first!\n"; 137 @files = grep(/[^\.{1,2}]/ && -d "$dict_dir/$_", readdir(DIR)); 138 closedir DIR; 139 my $cnt = scalar @files; 140 print "$cnt dictionary(ies) found.\n"; 141 if(0 == $cnt) { 142 die("Install dictionary first!\n"); 143 } 144 145 foreach my $file (@files) { 146 print "Do you select dictionary $file [yes/no]? "; 147 my $ans = <STDIN>; 148 if($ans =~ /y(es)?/i) { 149 return $file; 150 } 151 } 152 die "No dictionary selected - setup failed!\n"; 123 153 } 124 154 -
app/src/compiledic/compiledic
r20b4e44 r389de9a 11 11 use File::Basename; 12 12 use File::Temp; 13 use File::Copy; 13 14 use Getopt::Long; 14 15 … … 51 52 `lexmakelab $symfilenoext`; 52 53 53 # Analiza pliku s³ownika 54 # Tworzymy katalog tymczasowy, gdzie wszystko bedzie umieszczane. 55 $tmp_root = tempdir( CLEANUP => 1 ); 54 56 55 print "preparing file...........................................";56 57 57 `sed -r "s/([[:punct:]])/\[\\1\]/g" < $file > temp1`; 58 # Analiza pliku slownika 58 59 59 `cp temp1 temp2`; 60 print "preparing file...........................................\n"; 61 print "... sed section .....\n"; 62 (undef, my $file_sed) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sed" ); 63 `sed -r "s/([[:punct:]])/\[\\1\]/g" < $file > $file_sed`; 60 64 61 65 print "OK\n"; 62 66 63 #dzielimy plik na wiele cz ê¶ci, uruchamiamy lexcomplex dla ka¿dej64 #cz ê¶ci osobno, nastêpnie ³±czymy to za pomoc±programu fsmunion67 #dzielimy plik na wiele czesci, uruchamiamy lexcomplex dla kazdej 68 #czesci osobno, nastepnie laczymy to za pomoca programu fsmunion 65 69 66 #print "Dziel ê s³ownik na mniejsze czê¶ci...";70 #print "Dziele slownik na mniejsze czesci..."; 67 71 68 open(IN, "./temp2");72 open(IN, $file_sed); 69 73 70 74 $lineCount = 0; 71 75 $fileCount = 0; 72 76 73 `mkdir LemTEMP`; 74 75 open(FILE, ">LemTEMP/slo_0"); 77 open(FILE, ">$tmp_root/slo_$fileCount"); 76 78 77 79 while (<IN>) { … … 82 84 83 85 close(FILE); 84 # print "Tworz ênowy plik tymczasowy: slo_".$fileCount."\n";85 open(FILE, "> LemTEMP/slo_".$fileCount);86 # print "Tworze nowy plik tymczasowy: slo_".$fileCount."\n"; 87 open(FILE, ">$tmp_root/slo_".$fileCount); 86 88 } 87 89 … … 107 109 $files++; 108 110 109 $command = "lexcomplex -l $labfile -S $sclfile < LemTEMP/slo_".$i." > LemTEMP/slownik_".$i.".fsm"; 110 111 `$command`; 111 `lexcomplex -l $labfile -S $sclfile < $tmp_root/slo_$i > $tmp_root/slownik_$i.fsm`; 112 112 113 113 } … … 120 120 print "OK\n"; 121 121 122 `rm LemTEMP/slo_*`;122 unlink <$tmp_root/slo_*>; 123 123 124 124 print "building final automaton"; … … 130 130 $dots=0; 131 131 132 `cp LemTEMP/slownik_0.fsm slownik1.fsm`;132 copy("$tmp_root/slownik_0.fsm", "$tmp_root/slownik1.fsm"); 133 133 134 134 for ($i=1; $i<=$filecount; $i++) { … … 141 141 $files++; 142 142 143 $command = "fsmunion LemTEMP/slownik_".$i." slownik1.fsm > slownik2.fsm";143 `fsmunion $tmp_root/slownik_$i slownik1.fsm > $tmp_file/slownik2.fsm`; 144 144 145 `$command`; 146 147 `mv slownik2.fsm slownik1.fsm`; 145 move("$tmp_root/slownik2.fsm", "$tmp_root/slownik1.fsm") || die "Unable to move $tmp_root/slownik2.fsm!\n"; 148 146 } 149 147 … … 154 152 } 155 153 156 `fsmunion LemTEMP/* >slownik1.fsm`;154 `fsmunion $tmp_root/* > $tmp_root/slownik1.fsm`; 157 155 158 156 print "OK\n"; … … 160 158 print "removing epsilon-transitions............................."; 161 159 162 `fsmrmepsilon slownik1.fsm >slownik2.fsm`;160 `fsmrmepsilon $tmp_root/slownik1.fsm > $tmp_root/slownik2.fsm`; 163 161 164 `rm slownik1.fsm`;162 unlink ("$tmp_root/slownik1.fsm"); 165 163 166 164 print "OK\n"; … … 168 166 print "determinizing automaton.................................."; 169 167 170 `fsmdeterminize slownik2.fsm >slownik1.fsm`;168 `fsmdeterminize $tmp_root/slownik2.fsm > $tmp_root/slownik1.fsm`; 171 169 172 `rm slownik2.fsm`;170 unlink ("$tmp_root/slownik2.fsm"); 173 171 174 172 print "OK\n"; … … 176 174 print "minimizing automaton....................................."; 177 175 178 `fsmminimize slownik1.fsm >slownik.fsm`;176 `fsmminimize $tmp_root/slownik1.fsm > $tmp_root/slownik.fsm`; 179 177 180 178 #`rm slownik1.fsm`; … … 184 182 print "converting fsm format to bin............................."; 185 183 186 `fsmprint -i $labfile slownik.fsm >slownik.txt`;184 `fsmprint -i $labfile $tmp_root/slownik.fsm > $tmp_root/slownik.txt`; 187 185 188 `fsm2aut slownik.txt >slownik.aut`;186 `fsm2aut $tmp_root/slownik.txt > $tmp_root/slownik.aut`; 189 187 190 `aut2fsa < slownik.aut > $filenameprefix.bin`;188 `aut2fsa < $tmp_root/slownik.aut > $filenameprefix.bin`; 191 189 192 190 print "OK\n"; … … 194 192 print "removing temporary files................................."; 195 193 196 `rm LemTEMP/*`; 197 `rmdir LemTEMP`; 198 `rm temp2`; 199 `rm slownik.fsm`; 200 `rm slownik.txt`; 201 `rm slownik.aut`; 202 `rm labels.*`; 194 unlink <$tmp_root/*>; 195 unlink ($tmp_root); 203 196 204 197 print "OK\n"; -
app/src/ser/ser
r20b4e44 r389de9a 156 156 157 157 158 system "m4 \"--define=PATTERN=$flexpattern\" \"--define=DEFAULTACTION=$defaultaction\" $flextemplate > $tmpfile_l";158 `m4 "--define=PATTERN=$flexpattern" "--define=DEFAULTACTION=$defaultaction" $flextemplate > $tmpfile_l`; 159 159 160 160 if($flex) 161 161 { 162 #system "cat $tmpfile_l";163 162 if(open(FLEX, $tmpfile_l)) { 164 163 while(<FLEX>) { … … 173 172 } 174 173 175 system "flex -o$tmpfile_c $tmpfile_l";176 system "cc -O3 -o $tmpfile_x $tmpfile_c -lfl";177 system "$tmpfile_x";174 `flex -o$tmpfile_c $tmpfile_l`; 175 `cc -O3 -o $tmpfile_x $tmpfile_c -lfl`; 176 `$tmpfile_x`; 178 177 179 #system "rm -f $tmpfile_l $tmpfile_c $tmpfile_x";180 178 unlink $tmpfile_l; 181 179 unlink $tmpfile_c; 182 180 unlink $tmpfile_x; 183
Note: See TracChangeset
for help on using the changeset viewer.