install_ngram.sh 660 字节
Newer Older
H
Hui Zhang 已提交
1 2
#!/bin/bash

H
Hui Zhang 已提交
3 4 5
set -e
set -x

H
Hui Zhang 已提交
6

H
Hui Zhang 已提交
7 8 9
# need support c++17, so need gcc >= 8
# openfst
ngram=ngram-1.3.13
H
Hui Zhang 已提交
10
openfst=openfst-1.8.1
H
Hui Zhang 已提交
11 12
shared=true

H
Hui Zhang 已提交
13 14 15
export CPLUS_INCLUDE_PATH=$PWD/${openfst}/install/include/:$CPLUS_INCLUDE_PATH
export LD_LIBRARY_PATH=$PWD/${openfst}/install/lib/:$LD_LIBRARY_PATH

H
Hui Zhang 已提交
16 17 18 19 20 21 22 23 24
test -e ${ngram}.tar.gz || wget http://www.openfst.org/twiki/pub/GRM/NGramDownload/${ngram}.tar.gz
test -d ${ngram} || tar -xvf ${ngram}.tar.gz && chown -R root:root ${ngram}

if [ $shared == true ];then
    pushd ${ngram} && ./configure --enable-shared && popd
else
    pushd ${ngram} && ./configure --enable-static && popd
fi
pushd ${ngram} && make -j &&  make install && popd