def chunk_text(corpus, length, step):
    """
        Cut the given corpus into a series of offset sequences.
    """
    # A list of sequences
    sequences = []
    # For each sequence, record the next character in the corpus
    next_chars = []
    for i in range(0, len(corpus) - length, step):
        sequences.append(corpus[i:i + length])
        next_chars.append(corpus[i + length])
    return sequences, next_chars