ireland-news-headlines/decode.py

13 lines
386 B
Python
Raw Normal View History

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