def ComputeSegmentCores(split_lines_of_utt):
    num_lines = len(split_lines_of_utt)
    line_is_in_segment_core = ([False] * num_lines)
    for i in range(num_lines):
        if ((split_lines_of_utt[i][7] == 'cor') and (split_lines_of_utt[i][4] == split_lines_of_utt[i][6])):
            line_is_in_segment_core[i] = True
    for i in range(1, num_lines):
        if (line_is_in_segment_core[(i - 1)] and (not line_is_in_segment_core[i])):
            edit_type = split_lines_of_utt[i][7]
            if ((not IsTainted(split_lines_of_utt[i])) and ((edit_type == 'cor') or (edit_type == 'sil') or (edit_type == 'fix'))):
                line_is_in_segment_core[i] = True
    for i in reversed(range(0, (num_lines - 1))):
        if (line_is_in_segment_core[(i + 1)] and (not line_is_in_segment_core[i])):
            edit_type = split_lines_of_utt[i][7]
            if ((not IsTainted(split_lines_of_utt[i])) and ((edit_type == 'cor') or (edit_type == 'sil') or (edit_type == 'fix'))):
                line_is_in_segment_core[i] = True
    segment_ranges = []
    cur_segment_start = None
    for i in range(0, num_lines):
        if line_is_in_segment_core[i]:
            if (cur_segment_start == None):
                cur_segment_start = i
        elif (cur_segment_start != None):
            segment_ranges.append((cur_segment_start, i))
            cur_segment_start = None
    if (cur_segment_start != None):
        segment_ranges.append((cur_segment_start, num_lines))
    return segment_ranges
def ComputeSegmentCores(split_lines_of_utt):
    num_lines = len(split_lines_of_utt)
    line_is_in_segment_core = ([False] * num_lines)
    for i in range(num_lines):
        if ((split_lines_of_utt[i][7] == 'cor') and (split_lines_of_utt[i][4] == split_lines_of_utt[i][6])):
            line_is_in_segment_core[i] = True
    for i in range(1, num_lines):
        if (line_is_in_segment_core[(i - 1)] and (not line_is_in_segment_core[i])):
            edit_type = split_lines_of_utt[i][7]
            if ((not IsTainted(split_lines_of_utt[i])) and ((edit_type == 'cor') or (edit_type == 'sil') or (edit_type == 'fix'))):
                line_is_in_segment_core[i] = True
    for i in reversed(range(0, (num_lines - 1))):
        if (line_is_in_segment_core[(i + 1)] and (not line_is_in_segment_core[i])):
            edit_type = split_lines_of_utt[i][7]
            if ((not IsTainted(split_lines_of_utt[i])) and ((edit_type == 'cor') or (edit_type == 'sil') or (edit_type == 'fix'))):
                line_is_in_segment_core[i] = True
    segment_ranges = []
    cur_segment_start = None
    for i in range(0, num_lines):
        if line_is_in_segment_core[i]:
            if (cur_segment_start == None):
                cur_segment_start = i
        elif (cur_segment_start != None):
            segment_ranges.append((cur_segment_start, i))
            cur_segment_start = None
    if (cur_segment_start != None):
        segment_ranges.append((cur_segment_start, num_lines))
    return segment_ranges