File size: 677 Bytes
d758c99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
if [ "$#" -ne 1 ]; then
    echo "Please specify directory containing Spider files."
    exit 1
fi

BASE=$(realpath $(dirname $0))

# Re-generate 'sql' to fix bad parsing
cp $1/tables.json ${BASE}
for input in train_others train_spider dev; do
    echo Procesing $input
    cp $1/${input}.json ${BASE}
    if [[ -e ${BASE}/${input}.json.patch ]]; then
        pushd ${BASE} >& /dev/null
        patch < ${input}.json.patch
        popd >& /dev/null
    fi
        python -m seq2struct.datasets.spider_lib.preprocess.parse_raw_json \
        --tables ${BASE}/tables.json \
        --input ${BASE}/${input}.json \
        --output ${BASE}/${input}.json
    echo
done