import json import polars as pl test = pl.read_ndjson("data/raw_test.jsonl") train = pl.read_ndjson("data/raw_train.jsonl") print(test) print(train) unique_test_labels = test.select("label").unique() unique_train_labels = train.select("label").unique() print("Unique labels in test data:", unique_test_labels) print("Unique labels in train data:", unique_train_labels) unique_concatenated = pl.concat([unique_test_labels, unique_train_labels]).unique() print("Unique labels in both test and train data:", unique_concatenated) print(unique_concatenated) labels = {} for idx, value in enumerate(unique_concatenated.rows()): print(idx, value[0]) labels[value[0]] = idx print(labels) with open("data/labels.json", "w") as f: json.dump(labels, f)