def encoding_sequence(text, sequence):
    """ Function to encode the character sequence into number sequence

    Args:
        text (string): cleaned text
        sequence (list): character sequence list

    Returns:
        dict: dictionary mapping of all unique input charcters to integers
        list: number encoded charachter sequences
    """

    mapping = dict((c, i) for i, c in enumerate(sorted(list(set(text)))))
    encoded_sequence = [[mapping[char]
                         for char in sub_sequence] for sub_sequence in sequence]

    return mapping, encoded_sequence