wzkariampuzha commited on
Commit
c231f46
1 Parent(s): 0319b48

Update extract_abs.py

Browse files
Files changed (1) hide show
  1. extract_abs.py +2 -1
extract_abs.py CHANGED
@@ -141,7 +141,8 @@ def parse_info(sentences:List[str], model_outputs:List[List[Union[Dict[str,str],
141
  for output in model_outputs:
142
  #This abstracts the labels so that models with different types and numbers of labels can be used.
143
  for label in labels:
144
- output_dict[label]+=[entity_dict['word'] for entity_dict in output if entity_dict['entity_group'] ==label]
 
145
 
146
  if 'DIS' not in output_dict.keys() and extract_diseases:
147
  output_dict['DIS'] = []
 
141
  for output in model_outputs:
142
  #This abstracts the labels so that models with different types and numbers of labels can be used.
143
  for label in labels:
144
+ #This sub removes the ## which denotes that the token is not a the beginning of a word
145
+ output_dict[label]+=[re.sub('##','',entity_dict['word']) for entity_dict in output if entity_dict['entity_group'] ==label]
146
 
147
  if 'DIS' not in output_dict.keys() and extract_diseases:
148
  output_dict['DIS'] = []