import csv


def _load_txt_annotation(txt_file, delimiter='\t'):
    """
    Load a tab-delimited simplified annotation as a list of lists. Assumes
    first two elements are floats (start/end times) and the remaining item is a
    string (the label).

    Parameters
    ----------
    txt_file : str
        Path to simplified annotation txt file.

    Returns
    -------
    data : list
        List of annotation data, each row is one sound event represented as:
        [start_time, end_time, label].
    """
    data = []
    with open(txt_file, 'r') as f:
        reader = csv.reader(f, delimiter=delimiter)
        for row in reader:
            row = [float(x) if n <= 1 else x for n, x in enumerate(row)]
            data.append(row)
    return data