Skip to content

Commit

Permalink
[scripts] updated_fix_subsegment_feats.pl to handle row_start >= file…
Browse files Browse the repository at this point in the history
… length (#3915)
  • Loading branch information
popcornell committed Feb 7, 2020
1 parent 2c216c9 commit 2c4f1da
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions egs/wsj/s5/utils/data/fix_subsegment_feats.pl
Expand Up @@ -83,12 +83,16 @@ END
my $row_start = $1;
my $row_end = $2;
my $col_range = $3;


if ($row_start >= $utt2max_frames{$utt}) {
print STDERR "Removing $utt because row_start $row_start >= file max length $utt2max_frames{$utt}\n";
next;
}
if ($row_end >= $utt2max_frames{$utt}) {
print STDERR "Fixed row_end for $utt from $row_end to $utt2max_frames{$utt}-1\n";
$row_end = $utt2max_frames{$utt} - 1;
}

}
if ($row_start ne "") {
$range = "$row_start:$row_end";
} else {
Expand All @@ -98,6 +102,5 @@ END
if ($col_range ne "") {
$range .= ",$col_range";
}

print ("$utt " . join(" ", @F) . "[" . $range . "]\n");
}

0 comments on commit 2c4f1da

Please sign in to comment.