saily commited on
Commit
6411950
·
1 Parent(s): 15a5072

change label format

Browse files
Files changed (1) hide show
  1. 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
- if(labels_map.get(label)>=0) :
 
52
  contents.append(content)
53
- labels.append(int(labels_map.get(label)))
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)))