def generate_output_csv(evaluation_results, filename='results.csv'):
    """Generate the evaluation results in the format

    Parameters
    ----------
    evaluation_results : list of dictionaries
        Each dictionary contains the keys 'filename' and 'results', where
        'results' itself is a list of dictionaries. Each of the results has
        the keys 'latex' and 'probability'

    Examples
    --------
    MfrDB3907_85801, a, b, c, d, e, f, g, h, i, j
    scores, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1
    MfrDB3907_85802, 1, |, l, COMMA, junk, x, X, \times
    scores, 10, 8.001, 2, 0.5, 0.1, 0,-0.5, -1, -100
    """
    with open(filename, 'w') as f:
        for result in evaluation_results:
            for i, entry in enumerate(result['results']):
                if entry['semantics'] == ',':
                    result['results']['semantics'] = 'COMMA'
            f.write("%s, " % result['filename'])
            f.write(", ".join([entry['semantics'] for entry in result['results']]))
            f.write("\n")
            f.write("%s, " % "scores")
            f.write(", ".join([str(entry['probability']) for entry in result['results']]))
            f.write("\n")
Generate the evaluation results in the format

    Parameters
    ----------
    evaluation_results : list of dictionaries
        Each dictionary contains the keys 'filename' and 'results', where
        'results' itself is a list of dictionaries. Each of the results has
        the keys 'latex' and 'probability'

    Examples
    --------
    MfrDB3907_85801, a, b, c, d, e, f, g, h, i, j
    scores, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1
    MfrDB3907_85802, 1, |, l, COMMA, junk, x, X, \times
    scores, 10, 8.001, 2, 0.5, 0.1, 0,-0.5, -1, -100