-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprepare-test-files.bash
executable file
·40 lines (31 loc) · 1.03 KB
/
prepare-test-files.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash -x
# Prepare test input and expected output files
# Args:
# $1 - Number of lines of input to take from the original input files
if [ $# -eq 1 ]; then
N=$1
else
N=5
fi
data_folder=data
dataset_name=official
for test_label in words sentences; do
echo $test_label
dataset_folder=$dataset_name-$test_label
original_test_file=$data_folder/$dataset_folder/$test_label.tsv
input_file=$data_folder/$test_label.input
output_test_file=$data_folder/$test_label.tsv
head ${original_test_file} -n $N | cut -f 1 > ${input_file}
head ${original_test_file} -n $N > ${output_test_file}
done
data_folder=data
dataset_name=trec
for test_label in phrases; do
echo $test_label
dataset_folder=$dataset_name-$test_label
original_test_file=$data_folder/$dataset_folder/$test_label.tsv
input_file=$data_folder/$test_label.input
output_test_file=$data_folder/$test_label.tsv
head ${original_test_file} -n $N | cut -f 1 > ${input_file}
head ${original_test_file} -n $N > ${output_test_file}
done