def ProcessLineForNonScoredWords(a):
    global num_lines, num_correct_lines, ref_change_stats
    try:
        assert (len(a) == 8)
        num_lines += 1
        duration = a[3]
        hyp_word = a[4]
        ref_word = a[6]
        edit_type = a[7]
        if (edit_type == 'ins'):
            assert (ref_word == '<eps>')
            if (hyp_word in non_scored_words):
                ref_change_stats[((ref_word + ' -> ') + hyp_word)] += 1
                ref_word = hyp_word
                edit_type = 'fix'
        elif (edit_type == 'del'):
            assert ((hyp_word == '<eps>') and (float(duration) == 0.0))
            if (ref_word in non_scored_words):
                ref_change_stats[((ref_word + ' -> ') + hyp_word)] += 1
                return []
        elif (edit_type == 'sub'):
            assert (hyp_word != '<eps>')
            if ((hyp_word in non_scored_words) and (ref_word in non_scored_words)):
                ref_change_stats[((ref_word + ' -> ') + hyp_word)] += 1
                ref_word = hyp_word
                edit_type = 'fix'
        else:
            assert ((edit_type == 'cor') or (edit_type == 'sil'))
            num_correct_lines += 1
        a[4] = hyp_word
        a[6] = ref_word
        a[7] = edit_type
        return a
    except Exception:
        logger.error('bad line in ctm-edits input: {0}'.format(a))
        raise RuntimeError
def ProcessLineForNonScoredWords(a):
    global num_lines, num_correct_lines, ref_change_stats
    try:
        assert (len(a) == 8)
        num_lines += 1
        duration = a[3]
        hyp_word = a[4]
        ref_word = a[6]
        edit_type = a[7]
        if (edit_type == 'ins'):
            assert (ref_word == '<eps>')
            if (hyp_word in non_scored_words):
                ref_change_stats[((ref_word + ' -> ') + hyp_word)] += 1
                ref_word = hyp_word
                edit_type = 'fix'
        elif (edit_type == 'del'):
            assert ((hyp_word == '<eps>') and (float(duration) == 0.0))
            if (ref_word in non_scored_words):
                ref_change_stats[((ref_word + ' -> ') + hyp_word)] += 1
                return []
        elif (edit_type == 'sub'):
            assert (hyp_word != '<eps>')
            if ((hyp_word in non_scored_words) and (ref_word in non_scored_words)):
                ref_change_stats[((ref_word + ' -> ') + hyp_word)] += 1
                ref_word = hyp_word
                edit_type = 'fix'
        else:
            assert ((edit_type == 'cor') or (edit_type == 'sil'))
            num_correct_lines += 1
        a[4] = hyp_word
        a[6] = ref_word
        a[7] = edit_type
        return a
    except Exception:
        logger.error('bad line in ctm-edits input: {0}'.format(a))
        raise RuntimeError