Blame view
tools/PACKAGE_MESURES_V1.0/script/MakeListForGVAlign.pl
1.12 KB
e6be5137b reinitialized pro... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
#!/usr/bin/perl -w use strict; use warnings; if (@ARGV < 2) { print "<fichier ctm> <rep out>" } else { my $Fic = $ARGV[0]; my $RepOut = $ARGV[1]; my $Name; my $Start; my $Duration; my $Word; my $MinStart=1000000000; my $NewZero; my $WordNum=0; my $BaseName; $ARGV[0]=~/(.*?)\.(.*)/; $BaseName = $1; $BaseName=~/.*\/(.*)/; $BaseName=$1; open (CTM, $Fic) or die "Ouverture de $Fic loupée"; foreach my $Ligne (<CTM>) { if ( $Ligne=~/(.+) (.+) (.+) (.+) (.+)/ ) { ($Name,$Start,$Duration,$Word)=($1,$3,$4,$5); $Start*=100; $Start=int($Start+.5); if ($Start < $MinStart) { $MinStart = $Start; } #print "--> Start : $Start , Minstart : $MinStart "; $NewZero=int($Start) - int($MinStart); #print "--> Start : $Start , Minstart : $MinStart , zero : $NewZero "; $Duration*=100; $Duration=int($Duration+.5); if ($Duration <= 5) { $Duration = 6; } $Word=~s/'/_/g; `echo "${BaseName}_${WordNum} ${BaseName} $NewZero $Duration" >> ${RepOut}/${BaseName}.gvalign`; `echo "$Word" > ${RepOut}/${BaseName}_${WordNum}.gv`; $WordNum++; } } close(CTM); } |