File size: 765 Bytes
450a449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)