ireland-news-headlines/decode.py
2022-05-28 21:32:36 +02:00

13 lines
386 B
Python

import inout as io
files = ['dev-0', 'test-A', 'test-B']
categories = {0: 'news', 1: 'sport', 2: 'opinion',
3: 'business', 4: 'culture', 5: 'lifestyle', 6: 'removed'}
if __name__ == '__main__':
for file in files:
predicted = io.read(file + '-out')
predicted = [categories[round(float(x))-1] for x in predicted]
io.write(predicted, file + '/out.tsv')