def preprocess(matrix, index):
    """
    Takes as list of lists (in other words a matrix), and returns a list of
    preprocessed sentences for all elements at the index specified for the
    inner list.

    For BERT models, dropping punctuation affects accuracy. See
    https://www.aclweb.org/anthology/2020.pam-1.15.pdf.  The BERT models
    should also handle case or uncased situations automatically.

    Transformer models generally are not able to embed text with more than 512
    tokens and will automatically truncate longer text inputs.  (The exception
    to rule is for models such as Longformer or Bert-AL, or Reformer. However
    Bert-AL and Reformer are unavailable as HuggingFace models, and Longformer
    performs poorly.)

    Parameters:
        matrix (list): a list of lists
        index (int): index of inner list starting at 0
    """

    def remove_endline(text):
        text_split = text.split()
        return " ".join(text_split)

    return_list = [remove_endline(row[index]) for row in matrix]
    return return_list