khan123 commited on
Commit
141f72f
1 Parent(s): b1d0b95

add text encoding function

Browse files
Files changed (1) hide show
  1. utils/postprocess.py +6 -1
utils/postprocess.py CHANGED
@@ -5,4 +5,9 @@ def text_mapping(model_output,text_label):
5
  text,sent = random.sample(text_list,1)[0]
6
  return {'label' : model_output,
7
  'text' : text,
8
- 'sentiment' : sent}
 
 
 
 
 
 
5
  text,sent = random.sample(text_list,1)[0]
6
  return {'label' : model_output,
7
  'text' : text,
8
+ 'sentiment' : sent}
9
+
10
+ def text_encoding(output):
11
+ return {'label' : output['label'].encode(encoding='UTF-8', errors='strict'),
12
+ 'text' : output['text'].encode(encoding='UTF-8', errors='strict'),
13
+ 'sentiment' : output['sentiment'].encode(encoding='UTF-8', errors='strict')}