(letter_case, reverse_letter_case)
return start_points, lengths
Extract two or more character pairs from the case mapping tables.

    :param letter_case: case mappings dictionary which contains the conversions.
    :param reverse_letter_case: Comparable case mapping table which contains the return direction of the conversion.
    :return: A table with the start points, and another table with the lengths of the ranges.
Extract two or more character pairs from the case mapping tables.
Extract two or more character pairs from the case mapping tables .
def extract_character_pair_ranges(letter_case, reverse_letter_case):
    """
    Extract two or more character pairs from the case mapping tables.

    :param letter_case: case mappings dictionary which contains the conversions.
    :param reverse_letter_case: Comparable case mapping table which contains the return direction of the conversion.
    :return: A table with the start points, and another table with the lengths of the ranges.
    """

    start_points = []
    lengths = []
    in_range = False
    element_counter = -1

    for letter_id in sorted(letter_case.keys()):
        # Only extract character pairs
        if not is_bidirectional_conversion(letter_id, letter_case, reverse_letter_case):
            in_range = False
            continue

        if ord(letter_case[letter_id]) == letter_id + 1:
            prev_letter_id = letter_id - 2

            if not is_bidirectional_conversion(prev_letter_id, letter_case, reverse_letter_case):
                in_range = False

            if in_range:
                lengths[element_counter] += 2
            else:
                element_counter += 1
                start_points.append(letter_id)
                lengths.append(2)
                in_range = True

        else:
            in_range = False

    # Remove all found case mapping from the conversion tables after the scanning method
    for idx, letter_id in enumerate(start_points):
        conv_length = lengths[idx]

        for incr in range(0, conv_length, 2):
            del letter_case[letter_id + incr]
            del reverse_letter_case[letter_id + 1 + incr]

    return start_points, lengths
def extract_character_pair_ranges ( letter_case , reverse_letter_case ) : start_points = [ ] lengths = [ ] in_range = False element_counter = - 1 for letter_id in sorted ( letter_case . keys ( ) ) : # Only extract character pairs if not is_bidirectional_conversion ( letter_id , letter_case , reverse_letter_case ) : in_range = False continue if ord ( letter_case [ letter_id ] ) == letter_id + 1 : prev_letter_id = letter_id - 2 if not is_bidirectional_conversion ( prev_letter_id , letter_case , reverse_letter_case ) : in_range = False if in_range : lengths [ element_counter ] += 2 else : element_counter += 1 start_points . append ( letter_id ) lengths . append ( 2 ) in_range = True else : in_range = False # Remove all found case mapping from the conversion tables after the scanning method for idx , letter_id in enumerate ( start_points ) : conv_length = lengths [ idx ] for incr in range ( 0 , conv_length , 2 ) : del letter_case [ letter_id + incr ] del reverse_letter_case [ letter_id + 1 + incr ] return start_points , lengths