DD0101 commited on
Commit
5bd29a6
1 Parent(s): 9ab42c8

remove (" ", None)

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -127,7 +127,7 @@ def ner(text):
127
  for word, pred in zip(words, slot_preds):
128
  word = word.replace("_", " ")
129
  if pred == 'O':
130
- slot_tokens.extend([(word, None), (" ", None)])
131
 
132
  elif pred[0] == 'I': # token with label's prefix' "I-XXX": will be combined their corresponded "B-XXX"
133
  added_tokens = list(slot_tokens[-2])
@@ -135,10 +135,10 @@ def ner(text):
135
  slot_tokens[-2] = tuple(added_tokens)
136
 
137
  elif pred[0] == 'B': # token with label's prefix "B-XXX" : remove "B-"
138
- slot_tokens.extend([(word, pred[2:]), (" ", None)])
139
 
140
  else: # PAD or UNK tags
141
- slot_tokens.extend([(word, pred), (" ", None)])
142
 
143
  intent_label = intent_label_lst[intent_pred]
144
 
 
127
  for word, pred in zip(words, slot_preds):
128
  word = word.replace("_", " ")
129
  if pred == 'O':
130
+ slot_tokens.extend([(word, None))
131
 
132
  elif pred[0] == 'I': # token with label's prefix' "I-XXX": will be combined their corresponded "B-XXX"
133
  added_tokens = list(slot_tokens[-2])
 
135
  slot_tokens[-2] = tuple(added_tokens)
136
 
137
  elif pred[0] == 'B': # token with label's prefix "B-XXX" : remove "B-"
138
+ slot_tokens.extend([(word, pred[2:]))
139
 
140
  else: # PAD or UNK tags
141
+ slot_tokens.extend([(word, pred))
142
 
143
  intent_label = intent_label_lst[intent_pred]
144