import re


def convert_crfpp_output(crfpp_output):
    """
    Convert CRF++ command line output.

    This function takes the command line output of CRF++ and splits it into
    one [gold_label, pred_label] list per word per sentence.

    Parameters
    ----------
    crfpp_output : str
        Command line output obtained from a CRF++ command.

    Returns
    -------
    result : list
        List of [gold_label, pred_label] per word per sentence.
    """
    res = [[re.split(r'\t', token_output)[-2:] for token_output
            in re.split(r'\n', sentence_output)]
           for sentence_output in re.split(r'\n\n+', crfpp_output.strip())]
    return res