Skip to content

Commit

Permalink
Corrected problem with sclite-based alignment and it works now with e…
Browse files Browse the repository at this point in the history
…ncodings other than latin. It has not been tested

yet with utf-8. Fixed another issue with the filtering of the alignments from HVite.
  • Loading branch information
nassosoassos committed Oct 27, 2013
1 parent 862af6d commit 291a286
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions lib/SailTools/AlignText.pm
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ sub align_transcriptions {
}
my $hyp_start_times = $hyp_trans->{start_times};
my $hyp_end_times = $hyp_trans->{end_times};

my $ref_start_times = $ref_trans->{start_times};
my $ref_end_times = $ref_trans->{end_times};
my $ref_uncertainties = $ref_trans->{uncertainties};
Expand Down Expand Up @@ -300,29 +301,26 @@ sub read_sclite_alignment_file {
my $ref_word = $run_ref_words[$word_counter];
my $hyp_word = $run_hyp_words[$word_counter];

if ($ref_word =~ /[a-z]/) {
if ($ref_word eq $hyp_word) {
push(@ref_words, uc($ref_word));
push(@hyp_words, uc($hyp_word));
push(@alignment_map, $hyp_index);
$hyp_index++;
$ref_index++;
}
elsif ($ref_word =~ /[A-Z]/) {
elsif ($ref_word =~ /\*+/) {
# In case stars have been found
push(@hyp_words, uc($hyp_word));
$hyp_index++;
}
else {
push(@ref_words, uc($ref_word));
push(@alignment_map, -1);
$ref_index++;

if ($hyp_word =~ /[A-Z]/) {
push(@hyp_words, uc($hyp_word));
$hyp_index++;
}
}
else {
# In case stars have been found
if ($hyp_word =~ /[A-Z]/) {
push(@hyp_words, uc($hyp_word));
$hyp_index++;
}
if ($hyp_word !~ /^\*+/) {
push(@hyp_words, uc($hyp_word));
$hyp_index++;
}
}
}
$found_ref_and_hyp = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/SailTools/SailRecognizeSpeech.pm
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ sub filter_transcriptions {
}
my $model = $elements[2];
if (defined($model)) {
if (grep(/$model/,@filtered_models_arr)) {
if (grep(/^$model$/,@filtered_models_arr)) {
if ($end_time>0) {
push(@transcription, "$start_time $end_time $label");
}
Expand Down

0 comments on commit 291a286

Please sign in to comment.