This commit is contained in:
s443930 2022-05-28 17:39:32 +02:00
parent 65d5471dc4
commit 40653583a6
18 changed files with 2913151 additions and 2 deletions

View File

@ -0,0 +1,25 @@
import csv, lzma
# Reads input from directory and returns a list
def read(dir):
X = []
if 'xz' in dir:
with lzma.open(dir) as f:
for line in f:
text = line.decode('utf-8')
text = text.replace('\n', '').split('\t')
X.append(text)
else:
with open(dir, encoding='utf-8') as f:
for line in f:
if 'tsv' in dir:
X.append(line.replace('\n', '').split('\t'))
else:
X.append(line.replace('\n', ''))
return X
# Takes the output (list) and writes it into directory
def write(output, dir):
with open(dir, 'w', newline='', encoding='utf-8') as f:
writer = csv.writer(f)
for row in output: writer.writerow([row])

View File

@ -13,6 +13,7 @@ if __name__ == '__main__':
files = ['dev-0', 'test-A', 'test-B'] files = ['dev-0', 'test-A', 'test-B']
for file in files: for file in files:
predicted = io.read(file) predicted = io.read('predicted-' + file)
predicted = [categories[round(float(x))] for x in predicted] predicted = [1 if float(x)-1 <= -0.5 else x for x in predicted]
predicted = [categories[round(float(x))-1] for x in predicted]
io.write(predicted, file + '/out.tsv') io.write(predicted, file + '/out.tsv')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

149134
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

6
main.sh Executable file
View File

@ -0,0 +1,6 @@
python3 rockyRoadtoDublin.py
vw vw-train -f vw.model
vw -i vw.model -t vw-dev0 -p predicted-dev-0 --quiet
vw -i vw.model -t vw-test-A -p predicted-test-A --quiet
vw -i vw.model -t vw-test-B -p predicted-test-B --quiet
python3 decode.py

149134
predicted-dev-0 Normal file

File diff suppressed because it is too large Load Diff

148308
predicted-test-A Normal file

File diff suppressed because it is too large Load Diff

79119
predicted-test-B Normal file

File diff suppressed because it is too large Load Diff

148308
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff

79119
test-B/out.tsv Normal file

File diff suppressed because it is too large Load Diff

149134
vw-dev0 Normal file

File diff suppressed because it is too large Load Diff

149134
vw-dev0-targets Normal file

File diff suppressed because it is too large Load Diff

148308
vw-test-A Normal file

File diff suppressed because it is too large Load Diff

79119
vw-test-B Normal file

File diff suppressed because it is too large Load Diff

1186898
vw-train Normal file

File diff suppressed because it is too large Load Diff

BIN
vw.model Normal file

Binary file not shown.