import csv


def load_csv(csv_filename):
    """Load csv file generated py ```generate_training_testing_csv.py``` and parse contents into ingredients and labels lists
    
    Parameters
    ----------
    csv_filename : str
        Name of csv file
    
    Returns
    -------
    list[str]
        List of ingredient strings
    list[dict]
        List of dictionaries, each dictionary the ingredient labels
    """
    labels, ingredients = [], []
    with open(csv_filename, 'r') as f:
        reader = csv.reader(f)
        next(reader) # skip first row
        for row in reader:
            ingredients.append(row[0])
            labels.append({'quantity': row[1].strip(), 
                             'unit': row[2].strip(), 
                             'item': row[3].strip(), 
                             'comment': row[4].strip()})
    return ingredients, labels