Varun Wadhwa commited on
Commit
157e35b
·
unverified ·
1 Parent(s): bfb1e05
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -85,10 +85,10 @@ def align_labels_with_tokens(label, word_ids):
85
  if word_idx is None:
86
  aligned_label_ids.append(-100)
87
  elif word_idx != previous_word_idx: # Only label the first token of a given word.
88
- if label.startswith("B-"):
89
  print(word_idx)
90
- print(label)
91
- label = label.replace("B-", "I-")
92
  aligned_label_ids.append(label[word_idx])
93
  else:
94
  aligned_label_ids.append(-100)
 
85
  if word_idx is None:
86
  aligned_label_ids.append(-100)
87
  elif word_idx != previous_word_idx: # Only label the first token of a given word.
88
+ if label[word_idx].startswith("B-"):
89
  print(word_idx)
90
+ print(label[word_idx])
91
+ label[word_idx] = label[word_idx].replace("B-", "I-")
92
  aligned_label_ids.append(label[word_idx])
93
  else:
94
  aligned_label_ids.append(-100)