thomwolf commited on
Commit
6c7dea5
·
2 Parent(s): 2436d1d 48d8384

Merge pull request #4 from hiepph/fix-csv

Browse files

fix: Minor bug in writing test_sentence.csv

Files changed (1) hide show
  1. examples/score_texts_emojis.py +3 -3
examples/score_texts_emojis.py CHANGED
@@ -49,7 +49,7 @@ prob = model(tokenized)
49
 
50
  for prob in [prob]:
51
  # Find top emojis for each sentence. Emoji ids (0-63)
52
- # correspond to the mapping in emoji_overview.png
53
  # at the root of the torchMoji repo.
54
  print('Writing results to {}'.format(OUTPUT_PATH))
55
  scores = []
@@ -64,8 +64,8 @@ for prob in [prob]:
64
  scores.append(t_score)
65
  print(t_score)
66
 
67
- with open(OUTPUT_PATH, 'wb') as csvfile:
68
- writer = csv.writer(csvfile, delimiter=',', lineterminator='\n')
69
  writer.writerow(['Text', 'Top5%',
70
  'Emoji_1', 'Emoji_2', 'Emoji_3', 'Emoji_4', 'Emoji_5',
71
  'Pct_1', 'Pct_2', 'Pct_3', 'Pct_4', 'Pct_5'])
 
49
 
50
  for prob in [prob]:
51
  # Find top emojis for each sentence. Emoji ids (0-63)
52
+ # correspond to the mapping in emoji_overview.png
53
  # at the root of the torchMoji repo.
54
  print('Writing results to {}'.format(OUTPUT_PATH))
55
  scores = []
 
64
  scores.append(t_score)
65
  print(t_score)
66
 
67
+ with open(OUTPUT_PATH, 'w') as csvfile:
68
+ writer = csv.writer(csvfile, delimiter=str(','), lineterminator='\n')
69
  writer.writerow(['Text', 'Top5%',
70
  'Emoji_1', 'Emoji_2', 'Emoji_3', 'Emoji_4', 'Emoji_5',
71
  'Pct_1', 'Pct_2', 'Pct_3', 'Pct_4', 'Pct_5'])