def PossiblyTruncateEndForJunkProportion(self):
    end_junk_duration = self.end_unk_padding
    last_split_line = self.split_lines_of_utt[(self.end_index - 1)]
    if IsTainted(last_split_line):
        last_duration = float(last_split_line[3])
        end_junk_duration += (last_duration * self.end_keep_proportion)
    if (end_junk_duration == 0.0):
        return
    candidate_end_index = None
    for i in reversed(range((self.start_index + 1), (self.end_index - 1))):
        this_split_line = self.split_lines_of_utt[i]
        this_edit_type = this_split_line[7]
        this_ref_word = this_split_line[6]
        if ((this_edit_type == 'sil') or ((this_edit_type == 'cor') and (this_ref_word in non_scored_words))):
            candidate_end_index = (i + 1)
            candidate_end_time = (float(this_split_line[2]) + float(this_split_line[3]))
            break
    if (candidate_end_index == None):
        return
    candidate_removed_piece_duration = (self.EndTime() - candidate_end_time)
    if ((end_junk_duration / candidate_removed_piece_duration) < args.max_junk_proportion):
        return
    self.end_index = candidate_end_index
    self.end_unk_padding = 0.0
    self.end_keep_proportion = 1.0
    self.debug_str += ',truncated-end-for-junk'
def PossiblyTruncateEndForJunkProportion(self):
    end_junk_duration = self.end_unk_padding
    last_split_line = self.split_lines_of_utt[(self.end_index - 1)]
    if IsTainted(last_split_line):
        last_duration = float(last_split_line[3])
        end_junk_duration += (last_duration * self.end_keep_proportion)
    if (end_junk_duration == 0.0):
        return
    candidate_end_index = None
    for i in reversed(range((self.start_index + 1), (self.end_index - 1))):
        this_split_line = self.split_lines_of_utt[i]
        this_edit_type = this_split_line[7]
        this_ref_word = this_split_line[6]
        if ((this_edit_type == 'sil') or ((this_edit_type == 'cor') and (this_ref_word in non_scored_words))):
            candidate_end_index = (i + 1)
            candidate_end_time = (float(this_split_line[2]) + float(this_split_line[3]))
            break
    if (candidate_end_index == None):
        return
    candidate_removed_piece_duration = (self.EndTime() - candidate_end_time)
    if ((end_junk_duration / candidate_removed_piece_duration) < args.max_junk_proportion):
        return
    self.end_index = candidate_end_index
    self.end_unk_padding = 0.0
    self.end_keep_proportion = 1.0
    self.debug_str += ',truncated-end-for-junk'