voxforge.org
VoxForge Dev

root/Trunk/Scripts/AcousticModel_scripts/HTK/manual_testing/ProcessJuliusOutput1pass.pl

Revision 2270, 2.0 kB (checked in by kmaclean, 1 year ago)

Flac audio processing updates & GPL v3 updates

Line 
1 #!/usr/bin/perl
2 ####################################################################
3 ###
4 ### script name : ProcessJuliusOutput1pass.pl
5 ### version: 0.1
6 ### created by: Ken MacLean
7 ### mail: contact@voxforge.org
8 ### Date: 2006.09.26
9 ### Command: perl ./ProcessJuliusOutput1pass.pl
10 ###   
11 ### Copyright (C) 2006 Ken MacLean
12 ###
13 ### This program is free software; you can redistribute it and/or
14 ### modify it under the terms of the GNU General Public License
15 ### as published by the Free Software Foundation; either version 3
16 ### of the License, or (at your option) any later version.
17 ###
18 ### This program is distributed in the hope that it will be useful,
19 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ### GNU General Public License for more details.
22 ###                                                             
23 ####################################################################
24
25 use strict;
26 my ($line, $label, $filein, $fileout, %seen);
27 my (@line_array, $line_array);
28 if (@ARGV != 2) {
29   print "usage: $0 filein fileout\n\n";
30   exit (0);
31 }
32 # read in command line arguments
33 ($filein, $fileout) = @ARGV;
34
35 open (FILEIN,"$filein") || die ("Unable to open $filein for reading");
36 open (FILEOUT,">$fileout") || die ("Unable to open $fileout for writing");
37
38 print (FILEOUT "#!MLF!#\n");
39 while ($line = <FILEIN>) {
40   chomp ($line);
41   if ($line =~ /input speechfile: /) {
42     $line =~ s/input speechfile: //;
43     $line =~ s/\.wav/\.rec/;
44     $line =~ s/wav\///;
45     print (FILEOUT "\"*\/$line\"\n");
46   } elsif ($line =~ /input MFCC file: /) {
47     $line =~ s/input MFCC file: //;
48     $line =~ s/\.mfc/\.rec/;
49     $line =~ s/mfcc\///;
50     print (FILEOUT "\"*\/$line\"\n");
51   } elsif ($line =~ /pass1_best: /) {
52     $line =~ s/pass1_best: //;
53     $line =~ s/<s> //;
54     $line =~ s/ <\/s>//;
55     $line =~ s/ <sp>//;
56     @line_array=split(/\s+/, $line);
57     foreach $line_array (@line_array) {
58       print (FILEOUT "$line_array\n");
59     }
60     print (FILEOUT "\.\n");
61   }
62
63 close(FILEIN);
64 close(FILEOUT);
Note: See TracBrowser for help on using the browser.