change label format
Browse files- preprocess.py +3 -2
preprocess.py
CHANGED
@@ -48,9 +48,10 @@ class DataProcessor(object):
|
|
48 |
if not line: continue
|
49 |
if '\t' not in line: continue
|
50 |
content, label = line.rsplit('\t', 1)
|
51 |
-
|
|
|
52 |
contents.append(content)
|
53 |
-
labels.append(
|
54 |
|
55 |
#random shuffle
|
56 |
index = list(range(len(labels)))
|
|
|
48 |
if not line: continue
|
49 |
if '\t' not in line: continue
|
50 |
content, label = line.rsplit('\t', 1)
|
51 |
+
mapped_label = labels_map.get(label)
|
52 |
+
if mapped_label is not None and isinstance(mapped_label, int) and mapped_label >= 0:
|
53 |
contents.append(content)
|
54 |
+
labels.append(mapped_label)
|
55 |
|
56 |
#random shuffle
|
57 |
index = list(range(len(labels)))
|