s443930
This commit is contained in:
parent
65d5471dc4
commit
40653583a6
25
.ipynb_checkpoints/inout-checkpoint.py
Normal file
25
.ipynb_checkpoints/inout-checkpoint.py
Normal 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])
|
@ -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')
|
||||||
|
149134
dev-0/.ipynb_checkpoints/expected-checkpoint.tsv
Normal file
149134
dev-0/.ipynb_checkpoints/expected-checkpoint.tsv
Normal file
File diff suppressed because it is too large
Load Diff
149134
dev-0/.ipynb_checkpoints/in-checkpoint.tsv
Normal file
149134
dev-0/.ipynb_checkpoints/in-checkpoint.tsv
Normal file
File diff suppressed because it is too large
Load Diff
149134
dev-0/.ipynb_checkpoints/out-checkpoint.tsv
Normal file
149134
dev-0/.ipynb_checkpoints/out-checkpoint.tsv
Normal file
File diff suppressed because it is too large
Load Diff
149134
dev-0/out.tsv
Normal file
149134
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
6
main.sh
Executable file
6
main.sh
Executable 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
149134
predicted-dev-0
Normal file
File diff suppressed because it is too large
Load Diff
148308
predicted-test-A
Normal file
148308
predicted-test-A
Normal file
File diff suppressed because it is too large
Load Diff
79119
predicted-test-B
Normal file
79119
predicted-test-B
Normal file
File diff suppressed because it is too large
Load Diff
148308
test-A/out.tsv
Normal file
148308
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
79119
test-B/out.tsv
Normal file
79119
test-B/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
149134
vw-dev0-targets
Normal file
149134
vw-dev0-targets
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user