File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ]
You can’t perform that action at this time.
0 commit comments