- Timestamp:
- 03/26/08 14:16:40 (17 years ago)
- Branches:
- master, help
- Children:
- e1942be
- Parents:
- 389de9a
- git-author:
- obrebski <obrebski@…> (03/26/08 14:16:40)
- git-committer:
- obrebski <obrebski@…> (03/26/08 14:16:40)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/src/compiledic/compiledic
r389de9a rc8e8fa8 14 14 use Getopt::Long; 15 15 16 my $systemconfigfile=''; 16 17 my $linesPerFile = 20000; 18 19 20 my $systemconfigfile='/usr/local/etc/utt/compiledic.conf'; 17 21 my $userconfigfile=home()."/.utt/compiledic.conf"; 18 22 19 23 Getopt::Long::Configure('no_ignore_case_always'); 20 24 21 $symfile='~/.utt/pl/pl_PL.iso-8859-2.sym'; 22 $symfilenoext = $symfile; 23 $symfilenoext =~ s/\.sym$//; 24 $labfile = $symfilenoext . '.lab'; 25 $sclfile = $symfilenoext . '.scl'; 25 #my $symfile='~/.utt/pl/pl_PL.iso-8859-2.sym'; 26 my $symbols=0; 27 my $help=0; 28 29 30 31 #read configuration files########################### 32 my $file; 33 foreach $file ($systemconfigfile, $userconfigfile){ 34 if(open(CONFIG, $file)){ 35 while (<CONFIG>) { 36 chomp; 37 s/#.*//; 38 s/^\s+//; 39 s/\s+$//; 40 next unless length; 41 my ($name, $value) = split(/\s*=\s*/, $_, 2); 42 if($name eq "symbols"){ 43 $symbols=$value; 44 } 45 elsif(($name eq "help")or($name eq "h")){ 46 $help=1; 47 } 48 49 } 50 close CONFIG; 51 } 52 } 53 ######################################################### 54 55 56 GetOptions("symbols=s" => \$symbols, 57 "help|h" => \$help); 58 59 if($help) 60 { 61 print <<'END' 62 Usage: compiledic [OPTIONS] dictionaryfile 63 64 Options: 65 --help -h Help. 66 --symbols=FILE Symbol file. 67 END 68 ; 69 exit 0; 70 } 71 72 26 73 27 74 ################################################## 28 $linesPerFile = 20000; 29 30 if (@ARGV < 1) { 31 print "usage: ", basename($0), " dictionary_file\n"; 32 exit; 33 } 34 35 my $file = shift; # @ARGV; 36 my $filenameprefix; 37 38 if ($file =~ /(.*)\.dic/) 39 { 40 $filenameprefix = $1; 41 } 42 else 43 { 44 print "The input file must have .dic extension."; 45 exit(1); 46 } 47 48 # Przygotowanie etykiet 49 50 #`makeLabels.pl > labels.sym`; 51 52 `lexmakelab $symfilenoext`; 75 76 -f $symbols or die("Symbol file not found."); 77 78 @ARGV < 1 or die("Source dictionary not given."); 79 80 my $file = shift; 81 82 -f $file or die("Source dictionary not found."); 83 84 $file =~ /(.*)\.dic/ or die("The input file must have .dic extension."); 85 86 my $filenameprefix = $1; 87 88 ################################################## 53 89 54 90 # Tworzymy katalog tymczasowy, gdzie wszystko bedzie umieszczane. 55 91 $tmp_root = tempdir( CLEANUP => 1 ); 92 93 print "TMPROOT: $tmp_root\n"; 94 95 96 (undef, my $symfile) = File::Temp::tempfile( DIR => $tmp_root, SUFFIX => ".sym" ); 97 my $symfilenoext=$symfile; 98 $symfilenoext =~ s/\.sym$//; 99 my $labfile = $symfilenoext . '.lab'; 100 my $sclfile = $symfilenoext . '.scl'; 101 102 copy($symbols, $symfile); 103 104 # Przygotowanie etykiet 105 106 `lexmakelab $symfilenoext`; 56 107 57 108
Note: See TracChangeset
for help on using the changeset viewer.