Fix two labels back to back

#1
by nbroad - opened
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -86,7 +86,7 @@ def render_sample(subset, pii_type):
86
  for index, label in enumerate(sample['labels']):
87
  if label.startswith('B-'):
88
  if in_entity: # End the previous entity
89
- ents.append(Span(doc, start, end, label[2:]))
90
  start, end = index, index + 1 # Start a new entity
91
  in_entity = True
92
  elif label.startswith('I-') and in_entity:
 
86
  for index, label in enumerate(sample['labels']):
87
  if label.startswith('B-'):
88
  if in_entity: # End the previous entity
89
+ ents.append(Span(doc, start, end, sample['labels'][start][2:]))
90
  start, end = index, index + 1 # Start a new entity
91
  in_entity = True
92
  elif label.startswith('I-') and in_entity: