rayshunp commited on
Commit
63ca03f
·
verified ·
1 Parent(s): 67f834c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -89,12 +89,11 @@ def _merge_ner_entities(entities, original_text):
89
  merged = []
90
  for ent in entities:
91
  word = original_text[ent['start']:ent['end']]
 
92
  if merged and ent['start'] <= merged[-1]['end'] + 2:
93
- # Merge regardless of entity group — same word split across tokens
94
  merged[-1]['word'] = original_text[merged[-1]['start']:ent['end']]
95
  merged[-1]['end'] = ent['end']
96
  merged[-1]['score'] = (merged[-1]['score'] + float(ent['score'])) / 2
97
- # Keep the entity group with higher score
98
  if float(ent['score']) > merged[-1]['score']:
99
  merged[-1]['entity_group'] = ent['entity_group']
100
  else:
 
89
  merged = []
90
  for ent in entities:
91
  word = original_text[ent['start']:ent['end']]
92
+ print(f"NER TOKEN: '{word}' start={ent['start']} end={ent['end']} group={ent['entity_group']}") # ← add this
93
  if merged and ent['start'] <= merged[-1]['end'] + 2:
 
94
  merged[-1]['word'] = original_text[merged[-1]['start']:ent['end']]
95
  merged[-1]['end'] = ent['end']
96
  merged[-1]['score'] = (merged[-1]['score'] + float(ent['score'])) / 2
 
97
  if float(ent['score']) > merged[-1]['score']:
98
  merged[-1]['entity_group'] = ent['entity_group']
99
  else: