gaepago_model / utils /postprocess.py
khan123's picture
Update utils/postprocess.py
5d38e69
raw
history blame
531 Bytes
import random
def text_mapping(model_output,text_label):
text_list = text_label[model_output]
text,sent = random.sample(text_list,1)[0]
return {'label' : model_output,
'text' : text,
'sentiment' : sent}
def text_encoding(output):
return {'label' : str(output['label'].encode(encoding='UTF-8', errors='strict')),
'text' : str(output['text'].encode(encoding='UTF-8', errors='strict')),
'sentiment' : str(output['sentiment'].encode(encoding='UTF-8', errors='strict'))}