forked from Maluuba/nlg-eval
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·60 lines (52 loc) · 1.77 KB
/
setup.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -e
function download () {
URL=$1
TGTDIR=.
if [ -n "$2" ]; then
TGTDIR=$2
mkdir -p $TGTDIR
fi
wget $URL -P $TGTDIR
}
function download_file() {
URL=$1
filename="${URL##*/}"
TGTDIR=.
if [ -n "$2" ]; then
TGTDIR=$2
fi
if [ ! -f "$TGTDIR/$filename" ]; then
download $@
fi
}
# glove data
if [ ! -f nlgeval/data/glove.6B.300d.txt ]
then
download http://nlp.stanford.edu/data/glove.6B.zip
unzip glove.6B.zip
rm -f glove.6B.50d.txt
rm -f glove.6B.100d.txt
rm -f glove.6B.200d.txt
rm -f glove.6B.zip
mkdir -p nlgeval/data
mv glove.6B.300d.txt nlgeval/data
fi
# skip-thoughts data
download_file http://www.cs.toronto.edu/~rkiros/models/dictionary.txt nlgeval/data
download_file http://www.cs.toronto.edu/~rkiros/models/utable.npy nlgeval/data
download_file http://www.cs.toronto.edu/~rkiros/models/btable.npy nlgeval/data
download_file http://www.cs.toronto.edu/~rkiros/models/uni_skip.npz nlgeval/data
download_file http://www.cs.toronto.edu/~rkiros/models/uni_skip.npz.pkl nlgeval/data
download_file http://www.cs.toronto.edu/~rkiros/models/bi_skip.npz nlgeval/data
download_file http://www.cs.toronto.edu/~rkiros/models/bi_skip.npz.pkl nlgeval/data
# multi-bleu.perl
download_file https://raw.githubusercontent.com/moses-smt/mosesdecoder/b199e654df2a26ea58f234cbb642e89d9c1f269d/scripts/generic/multi-bleu.perl nlgeval/multibleu
[ -e nlgeval/multibleu/multi-bleu.perl ] && chmod +x nlgeval/multibleu/multi-bleu.perl
# glove word vectors
download_file https://raw.githubusercontent.com/manasRK/glove-gensim/42ce46f00e83d3afa028fb6bf17ed3c90ca65fcc/glove2word2vec.py nlgeval/word2vec
if [ ! -f nlgeval/data/glove.6B.300d.model.bin ]
then
python2.7 -m nltk.downloader punkt
PYTHONPATH=`pwd` python2.7 nlgeval/word2vec/generate_w2v_files.py
fi