import json


def get_jsonl_x_y(file_dir, cat2bin):
    """
    Load the X and y for the model from a JSONL file
    Use cat2bin to convert categories used for tagging into 0 and 1
    """
    X = []
    y = []
    with open(file_dir, 'r') as json_file:
        for json_str in list(json_file):
            data = json.loads(json_str)
            X.append(data['text'])
            y.append(cat2bin[data['label']])

    return X, y