Skip to content

Commit c319474

Browse files
committed
bugfix: Use the entity name if corrected is null
1 parent c79d1e1 commit c319474

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/preprocessing/labelling_data_split.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,17 @@ def extract_parquet_file(labelled_file_path: str):
327327

328328
for ent_type in corrected_entities.keys():
329329
for entity in corrected_entities[ent_type].keys():
330+
if corrected_entities[ent_type][entity]['corrected_name']:
331+
entity_text = corrected_entities[ent_type][entity]['corrected_name']
332+
else:
333+
entity_text = entity
330334
for sentence in corrected_entities[ent_type][entity]['sentence']:
331335
if (sentence['char_index']['start'] != -1 and
332336
sentence['char_index']['end'] != -1):
333337
all_sentences[sentence['sentid']] = sentence['text']
334338
output_files[sentence['sentid']].append({
335339
"value": {
336-
"text": corrected_entities[ent_type][entity]['corrected_name'],
340+
"text": entity_text,
337341
"start": sentence['char_index']['start'],
338342
"end": sentence['char_index']['end'],
339343
"labels": [ent_type]

0 commit comments

Comments
 (0)