stm2seg.pl 524 Bytes
#!/usr/bin/perl -w

use strict;
use warnings;


if (@ARGV < 1)
{
	die "<input : stm file>\n";
}

my $RemoveTags=0;

open STM, $ARGV[0];

if (@ARGV > 1 && $ARGV[1] == "1")
{
	$RemoveTags=1;
}

foreach (<STM>)
{

	if (!($_=~/ignore_time_segment_in_scoring/))
	{
		if ($_=~/(.*?) .*? .*? (.*?) (.*?) \<.*?\> (.*?)( \(.*?\))*$/)
		{
			my $utterance_id=$1;
			my $start=$2;
			my $end=$3;

			 $utterance_id=~s/_/-/g;

			printf "%s-%s-%s %s %s %s\n", $utterance_id, $start*100, $end*100, $utterance_id, $start, $end;
		}
	}

}