emanuelaboros commited on
Commit
08dfe16
·
verified ·
1 Parent(s): b7624fb

Update generic_ner.py

Browse files
Files changed (1) hide show
  1. generic_ner.py +9 -2
generic_ner.py CHANGED
@@ -87,10 +87,17 @@ def get_entities(tokens, tags, confidences, text):
87
  for indices in find_entity_indices(text, original_string):
88
  entity_start_position = indices[0]
89
  entity_end_position = indices[1]
90
- if '_'.join([original_label, original_string, entity_start_position]) in already_done:
 
 
 
91
  continue
92
  else:
93
- already_done.append('_'.join([original_label, original_string, entity_start_position]))
 
 
 
 
94
  entities.append(
95
  {
96
  "entity": original_label,
 
87
  for indices in find_entity_indices(text, original_string):
88
  entity_start_position = indices[0]
89
  entity_end_position = indices[1]
90
+ if (
91
+ "_".join([original_label, original_string, str(entity_start_position)])
92
+ in already_done
93
+ ):
94
  continue
95
  else:
96
+ already_done.append(
97
+ "_".join(
98
+ [original_label, original_string, str(entity_start_position)]
99
+ )
100
+ )
101
  entities.append(
102
  {
103
  "entity": original_label,