<commit_before>from spych.utils import textfile


def write_label_file(path, entries):
    """
    Writes an audacity label file.

    entries:

    [
        [start (seconds), end (seconds), label],
        [0.2, 2.2, 'hallo'],
        ...
    ]

    :param path: Path to write the file to.
    :param entries: List with entries to write.
    :return:
    """

    textfile.write_separated_lines(path, entries, separator=' ')<commit_msg>function for reading audacity label file<commit_after>from spych.utils import textfile


def write_label_file(path, entries):
    """
    Writes an audacity label file.

    entries:

    [
        [start (seconds), end (seconds), label],
        [0.2, 2.2, 'hallo'],
        ...
    ]

    :param path: Path to write the file to.
    :param entries: List with entries to write.
    :return:
    """

    textfile.write_separated_lines(path, entries, separator=' ')


def read_label_file(path):
    """
    Reads the labels from an audacity label file.

    :param path: Path to the label file.
    :return: List of labels (start [sec], end [sec], label)
    """
    return textfile.read_separated_lines(path, separator='\t', max_columns=3)
{'fraction_non_alphanumeric': 0.12139219015280135, 'fraction_numerical': 0.007640067911714771, 'mean_word_length': 2.695924764890282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6685238', 'n_tokens_mistral': 381, 'n_tokens_neox': 360, 'n_words': 115}