From e0a0eb770bce799de95519338228b8bd0649bfe0 Mon Sep 17 00:00:00 2001 From: Iwona Christop Date: Sat, 28 May 2022 21:32:36 +0200 Subject: [PATCH] Fix filenames --- decode.py | 4 ++-- main.sh | 8 ++++---- wockyWoad.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/decode.py b/decode.py index 7ad36ca..936e672 100644 --- a/decode.py +++ b/decode.py @@ -7,6 +7,6 @@ categories = {0: 'news', 1: 'sport', 2: 'opinion', if __name__ == '__main__': for file in files: - predicted = io.read(file + '/out') - predicted = [categories[round(float(x))] for x in predicted] + predicted = io.read(file + '-out') + predicted = [categories[round(float(x))-1] for x in predicted] io.write(predicted, file + '/out.tsv') diff --git a/main.sh b/main.sh index c4d6ac5..88d3bdc 100755 --- a/main.sh +++ b/main.sh @@ -1,6 +1,6 @@ python3 wockyWoad.py -vw --oaa 7 train/vw-in -f vw.model -vw -i vw.model -t dev0-in -p dev-0/out --quiet -vw -i vw.model -t test-A-in -p test-A/out --quiet -vw -i vw.model -t test-B-in -p test-B/out --quiet +vw --oaa 7 train-in -f vw.model +vw -i vw.model -t dev0-in -p dev-0-out --quiet +vw -i vw.model -t test-A-in -p test-A-out --quiet +vw -i vw.model -t test-B-in -p test-B-out --quiet python3 decode.py diff --git a/wockyWoad.py b/wockyWoad.py index 20fc006..630dc33 100644 --- a/wockyWoad.py +++ b/wockyWoad.py @@ -33,7 +33,7 @@ def predictFuture(test): if __name__ == '__main__': ireland_news_train = trainingData('train/in.tsv.xz', 'train/expected.tsv.xz') - with open('train/vw-in', 'w', encoding='utf-8') as f: + with open('train-in', 'w', encoding='utf-8') as f: for target, text in zip(ireland_news_train['target'], ireland_news_train['data']): f.write(str(target + 1) + text + '\n')