File size: 516 Bytes
327e3b5
 
 
 
 
 
 
141f72f
 
 
91419c9
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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' : output['label'].encode(encoding='UTF-8', errors='strict'),
            'text' : output['text'].encode(encoding='UTF-8', errors='strict'),
            'sentiment' : output['sentiment'].encode(encoding='UTF-8', errors='strict')}