首页 > 编程学习 > ARM 安装 SRILM

ARM 安装 SRILM

发布时间:2022/1/17 12:40:54

ARM 安装 SRILM

ARM 平台下没有提供 srilm 的编译方式,我们可以通过复制 x86 平台下的 Makefile 并做一定的修改就可以在 ARM 平台下使用。

下载 srilm

git clone https://github.com/BitSpeech/SRILM srilm

编译 srilm

# uname -m 查看系统架构
uname -m

# 修改 machine-type 脚本支持 armv8
# aarch64) MACHINE_TYPE=armv8

cp common/Makefile.machine.i686 common/Makefile.machine.armv8

删除 GCC_FLAGS 中所有不已 -W 开头的选项,删除完后的内容应该是

GCC_FLAGS=-Wall -Wno-unused-variable -Wno-uninitialized

kaldi/tools 目录下执行 ./install_srilm.sh 文件安装 srilm

若没有安装 kaldi,将下方的 shell 脚本保存为 install_srilm.sh 文件,并执行 ./install_srilm.sh 脚本即可安装。

#!/usr/bin/env bash
if [ ! -d liblbfgs-1.10 ];then
	echo Install libLBFGS first
	exit -1
fi

! which gawk 2>/dev/null && \
   echo "GNU awk is not installed so SRILM will probably not work correctly: refusing to install" && exit 1;

# mkdir -p srilm
cd srilm

# set the SRILM variable in the top-level Makefile to this directory.
cp Makefile tmpf

cat tmpf | awk -v pwd=`pwd` '/SRILM =/{printf("SRILM = %s\n", pwd); next;} {print;}' \
  > Makefile || exit 1;

mtype=`sbin/machine-type`

echo HAVE_LIBLBFGS=1 >> common/Makefile.machine.$mtype
grep ADDITIONAL_INCLUDES common/Makefile.machine.$mtype | \
    sed 's|$| -I$(SRILM)/../liblbfgs-1.10/include|' \
    >> common/Makefile.machine.$mtype

grep ADDITIONAL_LDFLAGS common/Makefile.machine.$mtype | \
    sed 's|$| -L$(SRILM)/../liblbfgs-1.10/lib/ -Wl,-rpath -Wl,$(SRILM)/../liblbfgs-1.10/lib/|' \
    >> common/Makefile.machine.$mtype

make || exit 1

echo >&2 "Installation of SRILM finished successfully"
Copyright © 2010-2022 ngui.cc 版权所有 |关于我们| 联系方式| 豫B2-20100000