fixed bug that caused entites_entities col to appear
@@ -52,7 +52,7 @@ def substitute_ner_converter_cols(c, cols, nlu_identifier):
- entities@<storage_ref>_confidence
"""
new_cols = {}
- new_base_name = 'entities' if nlu_identifier == 'UNIQUE' else f'entities_{nlu_identifier}'
+ new_base_name = 'entities' if nlu_identifier == 'UNIQUE' else f'entities_{nlu_identifier}' if 'entities' not in nlu_identifier else nlu_identifier
for col in cols:
if 'results' in col:
new_cols[col] = new_base_name
@@ -245,8 +245,6 @@ def substitute_transformer_token_classifier_cols(c, cols, nlu_identifier=True):
return new_cols
-
-
def substitute_coref_cols(c, cols, nlu_identifier=True):
"""
|ORIGIN_REFERENCE | CO_REFERENCES|
@@ -270,10 +268,14 @@ def substitute_coref_cols(c, cols, nlu_identifier=True):
elif '_types' in col:
continue
elif 'meta' in col:
- if 'head.sentence' in col: new_cols[col] = f'{new_base_name}_head_origin_sentence'
- elif 'head.end' in col: new_cols[col] = f'{new_base_name}_head_end'
- elif 'head.begin' in col: new_cols[col] = f'{new_base_name}_head_begin'
- elif '_head' in col: new_cols[col] = f'{new_base_name}_head'
+ if 'head.sentence' in col:
+ new_cols[col] = f'{new_base_name}_head_origin_sentence'
+ elif 'head.end' in col:
+ new_cols[col] = f'{new_base_name}_head_end'
+ elif 'head.begin' in col:
+ new_cols[col] = f'{new_base_name}_head_begin'
+ elif '_head' in col:
+ new_cols[col] = f'{new_base_name}_head'
else:
logger.info(f'Dropping unmatched metadata_col={col} for c={c}')
# new_cols[col]= f"{new_base_name}_confidence"
