def split_sents(notes, nlp):
    """
    Split the text in pd.Series into sentences.

    Parameters
    ----------
    notes: pd.Series
        series with text
    nlp: spacy language model

    Returns
    -------
    notes: pd.DataFrame
        df with the sentences; a column with the original note index is added
    """
    print(f'Splitting the text in "{notes.name}" to sentences. This might take a while.', flush=True)
    to_sentence = lambda txt: [str(sent) for sent in nlp(txt).sents]
    sents = notes.apply(to_sentence).explode().rename('text').reset_index().rename(columns={'index': 'note_index'})
    print(f'Done! Number of sentences: {sents.shape[0]}')
    return sents