Ubuntu8.10下moses测试平台搭建全记录

  实验室换了新机器,重新安装了最新的ubuntu8.10,这样不得不重新搭建moses测试平台。拿自己写的<<Moses相关介绍>>作参考,感觉写得不够细,这里把安装的全过程记录下来,属于一个step-by-step的过程,希望对大家有用。

一、在用户52nlp目录下建立moses平台主目录mtworkdir:
  52nlp@52nlp-desktop:~$ mkdir mtworkdir
  52nlp@52nlp-desktop:~$ cd mtworkdir/

二、安装语言模型工具SRILM:
1、建立srilm目录:
  52nlp@52nlp-desktop:~/mtworkdir$ mkdir srilm
  52nlp@52nlp-desktop:~/mtworkdir$ cd srilm/
2.下载最新的的srilm包(目前最新版本为 srilm-1.5.7.tar.gz)
  52nlp@52nlp-desktop:~/mtworkdir/srilm$ wget   'ftp://ftp.speech.sri.com/pub/people/stolcke/srilm/srilm-1.5.7.tar.gz'
  显示信息如下:
=> `srilm-1.5.7.tar.gz'
正在解析主机 ftp.speech.sri.com... 130.107.33.205
正在连接 ftp.speech.sri.com|130.107.33.205|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /pub/people/stolcke/srilm ... 完成。
==> SIZE srilm-1.5.7.tar.gz ... 完成。
==> PASV ... 完成。 ==> RETR srilm-1.5.7.tar.gz ... 完成。
长度:48526656 (46M) (非正式数据)
出现下载进度条,等待约一段时间之后,下载完毕
3.解压:tar -zxvf srilm-1.5.7.tar.gz
4.首先确认srilm依赖的这些工具是否已安装:
 A template-capable ANSI-C/C++ compiler, preferably gcc version 3.4.3 or higher.
 GNU make, to control compilation and installation.
 GNU gawk, required for many of the utility scripts.
 GNU gzip to unpack the distribution, and to allow SRILM programs to handle “.Z” and “.gz” compressed datafiles (highly recommended).
 bzip2 to handle “.bz2″ compressed files (optional).
 p7zip to handle “7-zip” compressed files (optional).
 The Tcl embeddable scripting language library (only required for some of the test executables).
 除了上面这些工具外,还需要装一个csh。Ubuntu8.10自带的软件不多,安装时用apt-get或新利得都行。
5. 修改MakeFile:
 在以上工具都安装完毕后,首先修改srilm/MakeFile:
   cp Makefile Makefile.bak(备份)
   vi Makefile
 修改或在第7行下面加上一行
 # SRILM = /home/speech/stolcke/project/srilm/devel (原)
 SRILM = $(PWD) (修改)
 再修改srilm/common/Makefile.machine.i686:
  cd common/
  cp Makefile.machine.i686 Makefile.machine.i686.bak
  vi Makefile.machine.i686
 将第15行 # Use the GNU C compiler下的三行修改如下:
  GCC_FLAGS = -mtune=pentium3 -Wreturn-type -Wimplicit
  CC = gcc $(GCC_FLAGS)
  CXX = g++ $(GCC_FLAGS) -DINSTANTIATE_TEMPLATES
 注:我的新机器的cpu是intel64位,所以尝试了一下64位的编译方法,不太成功,这里的方法对于64位机器也是可以的。
 将51行 # Tcl support (standard in Linux) 下的两行修改如下:
  TCL_INCLUDE = -I/usr/include/tcl8.5
  TCL_LIBRARY = -L/usr/lib/tcl8.5
 注:我装的是tcl8.5,如果是其他版本,请相应修改。
6.回到srilm目录下编译:
  cd ..
  make World
 顺利的话,srilm就编译通过了。如果出现问题,很可能就是相应的依赖工具没有装完全,请回到第4步检查。
7.进入srilm/test目录下进行测试:
 编译通过不等于编译成功,必须利用srilm提供的测试模块进行测试
 首先声明srilm编译成功后工具报所在的环境变量:
  export  PATH=$PATH:/home/52nlp/mtworkdir/srilm/bin/i686:
/home/52nlp/mtworkdir/srilm/bin
 然后进入test测试:
  cd test
  make all
 出现如下信息:
*** Running test class-ngram-simple ***
0.50user 0.11system 0:00.61elapsed 100%CPU  (0avgtext+0avgdata 0maxresident)k
0inputs+1288outputs (0major+4684minor)pagefaults 0swaps
class-ngram-simple: stdout output IDENTICAL.
class-ngram-simple: stderr output IDENTICAL.
....
 需要等待一段时间,如果出现多是IDENTICAL,很少的DIFFERS,就证明srilm编译成功了!

三、安装翻译模型训练工具Giza++,mkcls

1、 在mtworkdir目录下下载并解压Giza++:
  cd /home/52nlp/mtworkdir
  wget http://ling.umd.edu/~redpony/software/giza++.gcc41.tar.gz
  tar -zxvf giza++.gcc41.tar.gz
 解压后得到GIZA++-v2/目录
2、编译Giza++:
  cd GIZA++v2
  make
 以前这一步都比较顺利,没想到这一次出了问题:编译过程中提示stream.h文件无法找到,开始以为自己的编译环境没有配置完全,但是检查了几项必要的都安装了。在Google上搜这个问题,国内好像还没有人遇到过,最终在Google code giza-pp的issue上找到了的答案(http://code.google.com/p/giza-pp/issues/detail?id=7):
  Cannot compile with gcc 4.3 or greater
 Giza++不能被gcc,g++4.3或更高版本编译。这个问题也是最近被发现的,属于一个bug,而ubutu8.10默认安装的gcc,g++都是4.3版本,这个帖子里提出了几种解决方案,我用了最简单的一种:
 安装g++-4.1: sudo apt-get install g++-4.1
 修改GIZA++-v2里的Makefile:vi Makefile
 将第5行CXX=g++
 替换为:CXX=g++-4.1
 OK, 可以重新make了:
  make
  make snt2cooc.out
 一切顺利!
3、下载解压并编译mkcls:
  cd ..(重新进入mtworkdir目录)
  wget http://ling.umd.edu/~redpony/software/mkcls.gcc41.tar.gz
  tar -zxvf mkcls.gcc41.tar.gz
  cd mkcls-v2
  make
 这一步一般没啥问题。
4、建立bin目录,并将giza++,mkcls工具拷贝到bin目录下:
  cd ..
  mkdir -p bin
  cp GIZA++-v2/GIZA++ bin/
  cp GIZA++-v2/snt2cooc.out bin/
  cp mkcls-v2/mkcls bin/

四、安装解码器Moses及相关脚本
1、建立目录,通过svn下载moses:
  mkdir -p moses
  svn co  https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder
/trunk moses
 ubuntu8.10下需自行安装svn.
2、下载完成后编译:
  cd moses
  ./regenerate-makefiles.sh
  ./configure --with-srilm=/home/52nlp/mtworkdir/srilm
  make -j 4
  cd ..
 注:srilm指向绝对路径。
3、安装Moses训练脚本
 建立训练脚本目录:
  mkdir -p bin/moses-scripts
  修改makefile:
  vi moses/scripts/Makefile
  将第13、14行修改如下:
  TARGETDIR=/home/52nlp/mtworkdir/bin/moses-scripts
  BINDIR=/home/52nlp/mtworkdir/bin
 编译:
  cd moses/scripts/
  make release
  cd ../..
 使用时需要声明环境:
  export SCRIPTS_ROOTDIR=/home/52nlp/mtworkdir/bin/moses-scripts
/scripts-20090113-1019
4、安装Moses附加脚本及评测工具
 下载scripts.tgz并解压:
  wget http://www.statmt.org/wmt07/scripts.tgz
  tar -zxvf scripts.tgz
 这些脚本包括:
  Tokenizer scripts/tokenizer.perl
  Lowercaser scripts/lowercase.perl
  SGML-Wrapper scripts/wrap-xml.perl
 下载NIST,BLEU评测工具:
  wget ftp://jaguar.ncsl.nist.gov/mt/resources/mteval-v11b.pl

  完整的安装过程结束,这次安装中最大的问题是Giza++不能被gcc,g++4.3或更高版本编译,以后肯定会有很多人遇到这个问题,希望放在这里对大家有所帮助。

注:原创文章,转载请注明出处“我爱自然语言处理”:www.52nlp.cn

本文链接地址:
http://www.52nlp.cn/ubuntu-moses-platform-build-process-record/

Ubuntu8.10下moses测试平台搭建全记录》上有157条评论

  1. 陈亮

    checking for trigram_init in -loolm... no
    configure: error: Cannot find SRILM's library in /home/chenliang/mtworkdir/srilm/lib/i686

    请问我为什么会这样呢?谢了。

    [回复]

    52nlp 回复:

    我不太清楚,不过看起来是路径的问题,另一篇文章:

    http://www.52nlp.cn/%E5%AE%89%E8%A3%85srilm%E7%9A%84%E4%B8%80%E7%82%B9%E6%96%B0%E5%8F%98%E5%8C%96

    li_bopr读者的问题和你这个相似,可以借鉴一下:
    已经解决了,谢谢!修改srilm下sbin下的machine-type文件中
    else if (`uname -m` == i686) then
    set MACHINE_TYPE = i686
    为:
    else if (`uname -m` == i686) then
    set MACHINE_TYPE = i686-gcc4

    不然Moses找不到i686-gcc4目录,然后报找不到srilm

    [回复]

  2. halin

    各位前 背们 好 , 本人最j近刚刚接处moses而 配置srilm时有 如下错 误:

    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM=/home/meirong/mtworkdir/srilm MACHINE_TYPE=i686-gcc4 OPTION= release-scripts) || exit 1; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/utils/src'

    [回复]

    52nlp 回复:

    你的这一段没有错误,最好把第一个出现error的地方贴出来。

    [回复]

    halin 回复:

    以下 是 运 行 make World后 的 结果,不 知道为 什 么 ,

    mkdir include lib bin
    mkdir: 无法创建目录"include": 文件已存在
    mkdir: 无法创建目录"lib": 文件已存在
    mkdir: 无法创建目录"bin": 文件已存在
    make: [dirs] 错误 1 (忽略)
    make init
    make[1]: 正在进入目录 `/home/meirong/mtworkdir/srilm'
    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM=/home/meirong/mtworkdir/srilm MACHINE_TYPE=i686-gcc4 OPTION= init) || exit 1; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    cd ..; /home/meirong/mtworkdir/srilm/sbin/make-standard-directories
    make ../obj/i686-gcc4/STAMP ../bin/i686-gcc4/STAMP
    make[3]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[3]: “../obj/i686-gcc4/STAMP”是最新的。
    make[3]: “../bin/i686-gcc4/STAMP”是最新的。
    make[3]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    cd ..; /home/meirong/mtworkdir/srilm/sbin/make-standard-directories
    make ../obj/i686-gcc4/STAMP ../bin/i686-gcc4/STAMP
    make[3]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[3]: “../obj/i686-gcc4/STAMP”是最新的。
    make[3]: “../bin/i686-gcc4/STAMP”是最新的。
    make[3]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    cd ..; /home/meirong/mtworkdir/srilm/sbin/make-standard-directories
    make ../obj/i686-gcc4/STAMP ../bin/i686-gcc4/STAMP
    make[3]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[3]: “../obj/i686-gcc4/STAMP”是最新的。
    make[3]: “../bin/i686-gcc4/STAMP”是最新的。
    make[3]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    cd ..; /home/meirong/mtworkdir/srilm/sbin/make-standard-directories
    make ../obj/i686-gcc4/STAMP ../bin/i686-gcc4/STAMP
    make[3]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[3]: “../obj/i686-gcc4/STAMP”是最新的。
    make[3]: “../bin/i686-gcc4/STAMP”是最新的。
    make[3]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    cd ..; /home/meirong/mtworkdir/srilm/sbin/make-standard-directories
    make ../obj/i686-gcc4/STAMP ../bin/i686-gcc4/STAMP
    make[3]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[3]: “../obj/i686-gcc4/STAMP”是最新的。
    make[3]: “../bin/i686-gcc4/STAMP”是最新的。
    make[3]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    cd ..; /home/meirong/mtworkdir/srilm/sbin/make-standard-directories
    make ../obj/i686-gcc4/STAMP ../bin/i686-gcc4/STAMP
    make[3]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[3]: “../obj/i686-gcc4/STAMP”是最新的。
    make[3]: “../bin/i686-gcc4/STAMP”是最新的。
    make[3]:正在离开目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[1]:正在离开目录 `/home/meirong/mtworkdir/srilm'
    make release-headers
    make[1]: 正在进入目录 `/home/meirong/mtworkdir/srilm'
    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM=/home/meirong/mtworkdir/srilm MACHINE_TYPE=i686-gcc4 OPTION= release-headers) || exit 1; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 没有什么可以做的为 `release-headers'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 没有什么可以做的为 `release-headers'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 没有什么可以做的为 `release-headers'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 没有什么可以做的为 `release-headers'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 没有什么可以做的为 `release-headers'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[2]: 没有什么可以做的为 `release-headers'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[1]:正在离开目录 `/home/meirong/mtworkdir/srilm'
    make depend
    make[1]: 正在进入目录 `/home/meirong/mtworkdir/srilm'
    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM=/home/meirong/mtworkdir/srilm MACHINE_TYPE=i686-gcc4 OPTION= depend) || exit 1; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    rm -f Dependencies.i686-gcc4
    gcc -mtune=pentium3 -Wreturn-type -Wimplicit -Wimplicit-int -I /usr/include/tcl8.5 -I. -I../../include -MM ./option.c ./zio.c ./fcheck.c ./fake-rand48.c ./version.c ./ztest.c | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    g++ -mtune=pentium3 -Wreturn-type -Wimplicit -DINSTANTIATE_TEMPLATES -I /usr/include/tcl8.5 -I. -I../../include -MM ./Debug.cc ./File.cc ./tclmain.cc ./testFile.cc | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    /home/meirong/mtworkdir/srilm/sbin/generate-program-dependencies ../bin/i686-gcc4 ../obj/i686-gcc4 "" ztest testFile | sed -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    rm -f Dependencies.i686-gcc4
    gcc -mtune=pentium3 -Wreturn-type -Wimplicit -Wimplicit-int -I /usr/include/tcl8.5 -I. -I../../include -MM ./qsort.c | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    g++ -mtune=pentium3 -Wreturn-type -Wimplicit -DINSTANTIATE_TEMPLATES -I /usr/include/tcl8.5 -I. -I../../include -MM ./MemStats.cc ./LHashTrie.cc ./SArrayTrie.cc ./Array.cc ./IntervalHeap.cc ./Map.cc ./SArray.cc ./LHash.cc ./Map2.cc ./Trie.cc ./CachedMem.cc ./testArray.cc ./testMap.cc ./benchHash.cc ./testHash.cc ./testSizes.cc ./testCachedMem.cc ./testMap2.cc ./testTrie.cc | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    /home/meirong/mtworkdir/srilm/sbin/generate-program-dependencies ../bin/i686-gcc4 ../obj/i686-gcc4 "" testArray testMap benchHash testHash testSizes testCachedMem testMap2 testTrie | sed -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    rm -f Dependencies.i686-gcc4
    gcc -mtune=pentium3 -Wreturn-type -Wimplicit -Wimplicit-int -I /usr/include/tcl8.5 -I. -I../../include -MM ./matherr.c | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    g++ -mtune=pentium3 -Wreturn-type -Wimplicit -DINSTANTIATE_TEMPLATES -I /usr/include/tcl8.5 -I. -I../../include -MM ./Prob.cc ./Counts.cc ./XCount.cc ./Vocab.cc ./VocabMap.cc ./VocabMultiMap.cc ./VocabDistance.cc ./SubVocab.cc ./MultiwordVocab.cc ./TextStats.cc ./LM.cc ./LMClient.cc ./LMStats.cc ./RefList.cc ./Bleu.cc ./NBest.cc ./NBestSet.cc ./NgramLM.cc ./NgramStatsInt.cc ./NgramStatsShort.cc ./NgramStatsLong.cc ./NgramStatsLongLong.cc ./NgramStatsFloat.cc ./NgramStatsDouble.cc ./NgramStatsXCount.cc ./NgramCountLM.cc ./Discount.cc ./ClassNgram.cc ./SimpleClassNgram.cc ./DFNgram.cc ./SkipNgram.cc ./HiddenNgram.cc ./HiddenSNgram.cc ./VarNgram.cc ./DecipherNgram.cc ./TaggedVocab.cc ./TaggedNgram.cc ./TaggedNgramStats.cc ./StopNgram.cc ./StopNgramStats.cc ./MultiwordLM.cc ./BayesMix.cc ./LoglinearMix.cc ./AdaptiveMix.cc ./AdaptiveMarginals.cc ./CacheLM.cc ./DynamicLM.cc ./HMMofNgrams.cc ./WordAlign.cc ./WordLattice.cc ./WordMesh.cc ./simpleTrigram.cc ./NgramStats.cc ./Trellis.cc ./testBinaryCounts.cc ./testHash.cc ./testProb.cc ./testXCount.cc ./testParseFloat.cc ./testVocabDistance.cc ./testNgram.cc ./testNgramAlloc.cc ./testMultiReadLM.cc ./hoeffding.cc ./tolower.cc ./testLattice.cc ./testError.cc ./testNBest.cc ./testMix.cc ./testTaggedVocab.cc ./testVocab.cc ./ngram.cc ./ngram-count.cc ./ngram-merge.cc ./ngram-class.cc ./disambig.cc ./anti-ngram.cc ./nbest-lattice.cc ./nbest-mix.cc ./nbest-optimize.cc ./nbest-pron-score.cc ./segment.cc ./segment-nbest.cc ./hidden-ngram.cc ./multi-ngram.cc | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    /home/meirong/mtworkdir/srilm/sbin/generate-program-dependencies ../bin/i686-gcc4 ../obj/i686-gcc4 "" testBinaryCounts testHash testProb testXCount testParseFloat testVocabDistance testNgram testNgramAlloc testMultiReadLM hoeffding tolower testLattice testError testNBest testMix testTaggedVocab testVocab ngram ngram-count ngram-merge ngram-class disambig anti-ngram nbest-lattice nbest-mix nbest-optimize nbest-pron-score segment segment-nbest hidden-ngram multi-ngram | sed -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    rm -f Dependencies.i686-gcc4
    g++ -mtune=pentium3 -Wreturn-type -Wimplicit -DINSTANTIATE_TEMPLATES -I /usr/include/tcl8.5 -I. -I../../include -MM ./FDiscount.cc ./FNgramStats.cc ./FNgramStatsInt.cc ./FNgramSpecs.cc ./FNgramSpecsInt.cc ./FactoredVocab.cc ./FNgramLM.cc ./ProductVocab.cc ./ProductNgram.cc ./wmatrix.cc ./pngram.cc ./fngram-count.cc ./fngram.cc | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    /home/meirong/mtworkdir/srilm/sbin/generate-program-dependencies ../bin/i686-gcc4 ../obj/i686-gcc4 "" pngram fngram-count fngram | sed -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    rm -f Dependencies.i686-gcc4
    g++ -mtune=pentium3 -Wreturn-type -Wimplicit -DINSTANTIATE_TEMPLATES -I /usr/include/tcl8.5 -I. -I../../include -MM ./Lattice.cc ./LatticeAlign.cc ./LatticeExpand.cc ./LatticeIndex.cc ./LatticeNBest.cc ./LatticeNgrams.cc ./LatticeReduce.cc ./HTKLattice.cc ./LatticeLM.cc ./LatticeDecode.cc ./testLattice.cc ./lattice-tool.cc | sed -e "s&^[^ ]&../obj/i686-gcc4"'$(OBJ_OPTION)'"/\1&g" -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    /home/meirong/mtworkdir/srilm/sbin/generate-program-dependencies ../bin/i686-gcc4 ../obj/i686-gcc4 "" testLattice lattice-tool | sed -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    rm -f Dependencies.i686-gcc4
    /home/meirong/mtworkdir/srilm/sbin/generate-program-dependencies ../bin/i686-gcc4 ../obj/i686-gcc4 "" | sed -e "s&\.o&.o&g" >> Dependencies.i686-gcc4
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[1]:正在离开目录 `/home/meirong/mtworkdir/srilm'
    make release-libraries
    make[1]: 正在进入目录 `/home/meirong/mtworkdir/srilm'
    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM=/home/meirong/mtworkdir/srilm MACHINE_TYPE=i686-gcc4 OPTION= release-libraries) || exit 1; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 没有什么可以做的为 `release-libraries'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 没有什么可以做的为 `release-libraries'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 没有什么可以做的为 `release-libraries'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 没有什么可以做的为 `release-libraries'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 没有什么可以做的为 `release-libraries'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[2]: 没有什么可以做的为 `release-libraries'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[1]:正在离开目录 `/home/meirong/mtworkdir/srilm'
    make release-programs
    make[1]: 正在进入目录 `/home/meirong/mtworkdir/srilm'
    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM=/home/meirong/mtworkdir/srilm MACHINE_TYPE=i686-gcc4 OPTION= release-programs) || exit 1; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 没有什么可以做的为 `release-programs'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 没有什么可以做的为 `release-programs'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 没有什么可以做的为 `release-programs'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 没有什么可以做的为 `release-programs'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 没有什么可以做的为 `release-programs'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[2]: 没有什么可以做的为 `release-programs'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[1]:正在离开目录 `/home/meirong/mtworkdir/srilm'
    make release-scripts
    make[1]: 正在进入目录 `/home/meirong/mtworkdir/srilm'
    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM=/home/meirong/mtworkdir/srilm MACHINE_TYPE=i686-gcc4 OPTION= release-scripts) || exit 1; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/misc/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/dstruct/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/flm/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 没有什么可以做的为 `release-scripts'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/srilm/lattice/src'
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/srilm/utils/src'
    make[2]: 没有什么可以做的为 `release-scripts'

    [回复]

    52nlp 回复:

    抱歉,这一段我还是没有看到什么错误,是否在“/home/meirong/mtworkdir/srilm ”下找到bin之类的可执行文件的目录?或者你觉得那里有错?

  3. meirong

    您 好 : 最近碰到了很 困扰的 问题.
    安装 moses训练脚本make release完 后 在 moses-scripts training中 一直看不到 train-factored-phrase-model.perl文件,不知道是 什呒么原因

    期待您 的 回复 : 谢谢!
    root@meirong-desktop:/home/meirong/mtworkdir/moses/scripts# make release
    # Compile the parts
    make all
    make[1]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts'
    # Building memscore may fail e.g. if boost is not available.
    # We ignore this because traditional scoring will still work and memscore isn't used by default.
    cd training/memscore ; \
    ./configure && make \
    || ( echo "WARNING: Building memscore failed."; \
    echo 'training/memscore/memscore' >> ../../release-exclude )
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking for g++... g++
    checking whether the C++ compiler works... yes
    checking for C++ compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking for style of include used by make... GNU
    checking dependency style of g++... gcc3
    checking for gcc... gcc
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking dependency style of gcc... gcc3
    checking for boostlib >= 1.35.0... yes
    checking for cos in -lm... yes
    checking for gzopen in -lz... yes
    checking for cblas_dgemm in -lgslcblas... no
    checking for gsl_blas_dgemm in -lgsl... no
    checking how to run the C++ preprocessor... g++ -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking n_gram.h usability... no
    checking n_gram.h presence... no
    checking for n_gram.h... no
    checking for size_t... yes
    checking for ptrdiff_t... yes
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts/training/memscore'
    make all-am
    make[3]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts/training/memscore'
    make[3]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts/training/memscore'
    make[2]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts/training/memscore'
    touch release-exclude # No files excluded by default
    pwd=`pwd`; \
    for subdir in training/phrase-extract training/symal training/mbr training/lexical-reordering ems/biconcor; do \
    make -C $subdir || exit 1; \
    echo "### Compiler $subdir"; \
    cd $pwd; \
    done
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts/training/phrase-extract'
    make[2]: 没有什么可以做的为 `all'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts/training/phrase-extract'
    ### Compiler training/phrase-extract
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts/training/symal'
    make[2]: 没有什么可以做的为 `all'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts/training/symal'
    ### Compiler training/symal
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts/training/mbr'
    make[2]: 没有什么可以做的为 `all'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts/training/mbr'
    ### Compiler training/mbr
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts/training/lexical-reordering'
    make[2]: 没有什么可以做的为 `all'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts/training/lexical-reordering'
    ### Compiler training/lexical-reordering
    make[2]: 正在进入目录 `/home/meirong/mtworkdir/moses/scripts/ems/biconcor'
    make[2]: 没有什么可以做的为 `all'。
    make[2]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts/ems/biconcor'
    ### Compiler ems/biconcor
    ## All files that need compilation were compiled
    make[1]:正在离开目录 `/home/meirong/mtworkdir/moses/scripts'
    mkdir -p /home/meirong/mtworkdir/moses-scripts/scripts-20110122-1708
    cat ./released-files \
    | grep -v -x -f release-exclude \
    | rsync -r --files-from - . /home/meirong/mtworkdir/moses-scripts/scripts-20110122-1708/
    sed 's#^my \$BINDIR\s*=.*#my \$BINDIR="/home/meirong/mtworkdir/bin";#' training/train-model.perl > /home/meirong/mtworkdir/moses-scripts/scripts-20110122-1708/training/train-model.perl
    ## Remember, only files listed in released-files are released!!
    ## Don't forget to set your SCRIPTS_ROOTDIR with:
    export SCRIPTS_ROOTDIR=/home/meirong/mtworkdir/moses-scripts/scripts-20110122-1708
    root@meirong-desktop:/home/meirong/mtworkdir/moses/scripts# export SCRIPTS_ROOTDIR=/home/meirong/mtworkdir/moses-scripts/scripts-20110122-1708/

    [回复]

    52nlp 回复:

    看上面的记录好像没什么问题,按说这类脚本也仅仅是一个"copy"的过程,很奇怪,好像很多人都遇到了这类问题。我也没什么好办法,再重装试试吧,抱歉。

    [回复]

  4. wcr2011

    您好,最近搭建moses环境碰到了以下的问题,不知何原因。想请教您!
    等您的回信, 谢谢!
    root@ubuntu:/home/wcr/mtworkdir/moses/moses# make -j 4
    make all-recursive
    make[1]: 正在进入目录 `/home/wcr/mtworkdir/moses/moses'
    Making all in moses/src
    make[2]: 正在进入目录 `/home/wcr/mtworkdir/moses/moses/moses/src'
    g++ -DHAVE_CONFIG_H -I. -I../.. -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/home/wcr/mtworkdir/srilm//include -g -O2 -MT BitmapContainer.o -MD -MP -MF .deps/BitmapContainer.Tpo -c -o BitmapContainer.o BitmapContainer.cpp
    g++ -DHAVE_CONFIG_H -I. -I../.. -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/home/wcr/mtworkdir/srilm//include -g -O2 -MT ConfusionNet.o -MD -MP -MF .deps/ConfusionNet.Tpo -c -o ConfusionNet.o ConfusionNet.cpp
    g++ -DHAVE_CONFIG_H -I. -I../.. -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/home/wcr/mtworkdir/srilm//include -g -O2 -MT DecodeGraph.o -MD -MP -MF .deps/DecodeGraph.Tpo -c -o DecodeGraph.o DecodeGraph.cpp
    g++ -DHAVE_CONFIG_H -I. -I../.. -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/home/wcr/mtworkdir/srilm//include -g -O2 -MT DecodeStep.o -MD -MP -MF .deps/DecodeStep.Tpo -c -o DecodeStep.o DecodeStep.cpp
    ConfusionNet.cpp:188: warning: ignoring #pragma warning
    ConfusionNet.cpp:193: warning: ignoring #pragma warning
    In file included from FactorTypeSet.h:28,
    from Dictionary.h:25,
    from DecodeStep.h:26,
    from DecodeGraph.cpp:24:
    Util.h: In function ‘T Scan(const std::string&) [with T = int]’:
    Util.h:76: error: ‘atoi’ was not declared in this scope
    Util.h: In function ‘T Scan(const std::string&) [with T = float]’:
    Util.h:83: error: ‘atof’ was not declared in this scope
    In file included from Factor.h:31,
    from Word.h:28,
    from ConfusionNet.h:7,
    from ConfusionNet.cpp:3:
    Util.h: In function ‘T Scan(const std::string&) [with T = int]’:
    Util.h:76: error: ‘atoi’ was not declared in this scope
    Util.h: In function ‘T Scan(const std::string&) [with T = float]’:
    Util.h:83: error: ‘atof’ was not declared in this scope
    In file included from FactorTypeSet.h:28,
    from Dictionary.h:25,
    from DecodeStep.h:26,
    from DecodeStep.cpp:22:
    Util.h: In function ‘T Scan(const std::string&) [with T = int]’:
    Util.h:76: error: ‘atoi’ was not declared in this scope
    Util.h: In function ‘T Scan(const std::string&) [with T = float]’:
    Util.h:83: error: ‘atof’ was not declared in this scope
    In file included from ConfusionNet.h:7,
    from ConfusionNet.cpp:3:
    Word.h: In copy constructor ‘Word::Word(const Word&)’:
    Word.h:49: error: ‘memcpy’ is not a member of ‘std’
    Word.h: In constructor ‘Word::Word()’:
    Word.h:54: error: ‘memset’ is not a member of ‘std’
    In file included from Phrase.h:30,
    from InputType.h:27,
    from ConfusionNet.h:8,
    from ConfusionNet.cpp:3:
    WordsBitmap.h: In constructor ‘WordsBitmap::WordsBitmap(size_t)’:
    WordsBitmap.h:57: error: ‘malloc’ was not declared in this scope
    WordsBitmap.h: In copy constructor ‘WordsBitmap::WordsBitmap(const WordsBitmap&)’:
    WordsBitmap.h:64: error: ‘malloc’ was not declared in this scope
    WordsBitmap.h: In destructor ‘WordsBitmap::~WordsBitmap()’:
    WordsBitmap.h:72: error: ‘free’ was not declared in this scope
    In file included from Phrase.h:29,
    from PhraseDictionary.h:29,
    from PhraseDictionaryMemory.h:25,
    from DecodeStep.cpp:23:
    Word.h: In copy constructor ‘Word::Word(const Word&)’:
    Word.h:49: error: ‘memcpy’ is not a member of ‘std’
    Word.h: In constructor ‘Word::Word()’:
    Word.h:54: error: ‘memset’ is not a member of ‘std’
    In file included from Phrase.h:30,
    from PhraseDictionary.h:29,
    from PhraseDictionaryMemory.h:25,
    from DecodeStep.cpp:23:
    WordsBitmap.h: In constructor ‘WordsBitmap::WordsBitmap(size_t)’:
    WordsBitmap.h:57: error: ‘malloc’ was not declared in this scope
    WordsBitmap.h: In copy constructor ‘WordsBitmap::WordsBitmap(const WordsBitmap&)’:
    WordsBitmap.h:64: error: ‘malloc’ was not declared in this scope
    WordsBitmap.h: In destructor ‘WordsBitmap::~WordsBitmap()’:
    WordsBitmap.h:72: error: ‘free’ was not declared in this scope
    make[2]: *** [DecodeGraph.o] 错误 1
    make[2]: *** 正在等待未完成的任务....
    In file included from Phrase.h:29,
    from Hypothesis.h:27,
    from BitmapContainer.h:27,
    from BitmapContainer.cpp:26:
    Word.h: In copy constructor ‘Word::Word(const Word&)’:
    Word.h:49: error: ‘memcpy’ is not a member of ‘std’
    Word.h: In constructor ‘Word::Word()’:
    Word.h:54: error: ‘memset’ is not a member of ‘std’
    In file included from PrefixTree.h:14,
    from PrefixTreeMap.h:8,
    from LexicalReorderingTable.h:15,
    from LexicalReordering.h:15,
    from Hypothesis.h:36,
    from BitmapContainer.h:27,
    from BitmapContainer.cpp:26:
    FilePtr.h: At global scope:
    FilePtr.h:34: warning: type qualifiers ignored on function return type
    FilePtr.h:35: warning: type qualifiers ignored on function return type
    FilePtr.h:39: warning: type qualifiers ignored on function return type
    In file included from PrefixTree.h:14,
    from PrefixTreeMap.h:8,
    from LexicalReorderingTable.h:15,
    from LexicalReordering.h:15,
    from Hypothesis.h:36,
    from TranslationOption.h:29,
    from TranslationOptionCollection.h:26,
    from TranslationOptionCollectionConfusionNet.h:4,
    from ConfusionNet.cpp:9:
    FilePtr.h: At global scope:
    FilePtr.h:34: warning: type qualifiers ignored on function return type
    FilePtr.h:35: warning: type qualifiers ignored on function return type
    FilePtr.h:39: warning: type qualifiers ignored on function return type
    In file included from PrefixTree.h:14,
    from PrefixTreeMap.h:8,
    from LexicalReorderingTable.h:15,
    from LexicalReordering.h:15,
    from Hypothesis.h:36,
    from SentenceStats.h:28,
    from StaticData.h:34,
    from DecodeStep.cpp:25:
    FilePtr.h: At global scope:
    FilePtr.h:34: warning: type qualifiers ignored on function return type
    FilePtr.h:35: warning: type qualifiers ignored on function return type
    FilePtr.h:39: warning: type qualifiers ignored on function return type
    BitmapContainer.cpp: In constructor ‘BackwardsEdge::BackwardsEdge(const BitmapContainer&, BitmapContainer&, const TranslationOptionList&, const SquareMatrix&)’:
    BitmapContainer.cpp:144: warning: comparison between signed and unsigned integer expressions
    ConfusionNet.cpp:184: warning: unused parameter ‘factorsToPrint’
    make[2]: *** [DecodeStep.o] 错误 1
    make[2]: *** [BitmapContainer.o] 错误 1
    make[2]: *** [ConfusionNet.o] 错误 1
    make[2]:正在离开目录 `/home/wcr/mtworkdir/moses/moses/moses/src'
    make[1]: *** [all-recursive] 错误 1
    make[1]:正在离开目录 `/home/wcr/mtworkdir/moses/moses'
    make: *** [all] 错误 2

    [回复]

    52nlp 回复:

    抱歉,好久没有碰moses,很多问题都有点忘了。看你贴的log,是从这一行开始的:
    Util.h:76: error: ‘atoi’ was not declared in this scope
    ...
    好像之前这里有人遇到过类似的问题,但是不知道最后是怎么解决的。感觉和编译环境关系密切,再好好检查一下吧,实在抱歉帮不上什么忙。

    [回复]

    wcr2011 回复:

    我安装了2010-08-13版本的, 没有再出现这样的问题!

    [回复]

    52nlp 回复:

    谢谢给出解决问题 的方法!

  5. meirong

    个人通过搭建moses环境发现:moses2008版本之后的新版本中的训练脚本里没有了train-factored-phrase-model.perl,而只有train-model.perl.请问这是什么原因? 这两个脚本之间有什么联系吗? 菜鸟期待您的解答! 谢谢

    [回复]

    52nlp 回复:

    不太清楚啊,如果没有前者,就用这个试试吧,或者看看Moses的官方主页的相关文档,那个才是最全面的。

    [回复]

    52nlp 回复:

    我刚看到wcr2011下面的问题,应该用train-model.perl替换了。

    [回复]

  6. wcr2011

    /home/wcr/mtworkdir/bin/moses-scripts/scripts-20110223-1108/training/train-model.perl -scripts-root-dir /home/wcr/mtworkdir/bin/moses-scripts/scripts-20110223-1108 -root-dir /home/wcr/mtworkdir/www/ -corpus /home/wcr/mtworkdir/www/corpus/yuliao -e lt -f ch -alignment-factors 0-0 grow-diag-final-and -reordering msd-bidirectional-fe -lm 0:3:/home/wcr/mtworkdir/www/corpus/lt-lm.txt &>/home/wcr/mtworkdir/www/training.out &

    用上面的命令 训练短语模型时 model文件夹出不来呢!不知道什么原因,请教一下!谢谢啦!

    [回复]

    52nlp 回复:

    单给这个我是看不出来的,你要分析一下训练过程中的log是怎么提示的,看看哪一步出错了。

    [回复]

  7. wcr2011

    🙂 是不是说在上面命令中输出的training.out的内容啊!
    提示的错误是:
    Hmm Training Started at: Sat Feb 26 10:41:48 2011

    -----------
    Hmm: Iteration 1
    ERROR: Execution of: /home/wcr/mtworkdir/bin/GIZA++ -CoocurrenceFile ./giza.mg-ch/mg-ch.cooc -c ./corpus/mg-ch-int-train.snt -m1 5 -m2 0 -m3 3 -m4 3 -model1dumpfrequency 1 -model4smoothfactor 0.4 -nodumps 1 -nsmooth 4 -o ./giza.mg-ch/mg-ch -onlyaldumps 1 -p0 0.999 -s ./corpus/ch.vcb -t ./corpus/mg.vcb
    died with signal 6, without coredump

    我对训练过程不是很明白啊!所以不知道 训练过程中的log是不是就指这个啊!:-)

    [回复]

    52nlp 回复:

    我好久没碰Moses,这个问题以前似乎也没碰到过,不实际去处理这个问题,可能很难知道这个问题的所在。不过搜了一下,你的问题可能和这个问题很像:[Moses-support] Problem with training example on run-through
    http://www.mail-archive.com/moses-support@mit.edu/msg01487.html

    看了一下下面的解决方法,第一种可能是你的训练句对过长,建议用Moses里面提供的的 脚本“clean-corpus-n.perl ... 1 40”将你的句对过滤在1到40长以内。如果这个方法不行,另外一个解决方法是利用g++4.1重新编译你的Giza++:

    There's some discussion of the GIZA buffer overflow problem on the GIZA
    website.
    http://code.google.com/p/giza-pp/updates/list

    The problems seems to arise with recent versions of g++. If you could
    recompile with an earlier version (g++ 4.1) then it should be ok,

    [回复]

    wcr2011 回复:

    谢谢了!呵呵

    [回复]

  8. wcr2011

    补充一下上面的问题啊!
    运行以下命令之后是:
    root@ubuntu:/home/wcr/mtworkdir/www-ct# /home/wcr/mtworkdir/bin/moses-scripts/scripts-20110223-1108/training/train-model.perl -scripts-root-dir /home/wcr/mtworkdir/bin/moses-scripts/scripts-20110223-1108/ -corpus /home/wcr/mtworkdir/www-ct/corpus/yuliao -f ch -e mg -alignment grow-diag-final-and -reordering msd-bidirectional-fe -lm 0:3:/home/wcr/mtworkdir/www-ct/corpus/ct-lm.txt >& /home/wcr/mtworkdir/www-ct/training.out &
    [1] 2353
    root@ubuntu:/home/wcr/mtworkdir/www-ct# *** glibc detected *** /home/wcr/mtworkdir/bin/GIZA++: double free or corruption (out): 0x089e5260 ***
    ======= Backtrace: =========
    /lib/libc.so.6(+0x6c501)[0x82e501]
    /lib/libc.so.6(+0x6dd70)[0x82fd70]
    /lib/libc.so.6(cfree+0x6d)[0x832e5d]
    /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x9ce441]
    /home/wcr/mtworkdir/bin/GIZA++[0x80d4650]
    /home/wcr/mtworkdir/bin/GIZA++[0x80ca7ef]
    /home/wcr/mtworkdir/bin/GIZA++[0x80cc760]
    /home/wcr/mtworkdir/bin/GIZA++[0x806e2c2]
    /home/wcr/mtworkdir/bin/GIZA++[0x807188c]
    /lib/libc.so.6(__libc_start_main+0xe7)[0x7d8ce7]
    /home/wcr/mtworkdir/bin/GIZA++[0x804a521]
    ======= Memory map: ========
    001e8000-001e9000 r-xp 00000000 00:00 0 [vdso]
    007c2000-00919000 r-xp 00000000 07:00 395526 /lib/libc-2.12.1.so
    00919000-0091b000 r--p 00157000 07:00 395526 /lib/libc-2.12.1.so
    0091b000-0091c000 rw-p 00159000 07:00 395526 /lib/libc-2.12.1.so
    0091c000-0091f000 rw-p 00000000 00:00 0
    00924000-00a03000 r-xp 00000000 07:00 3949 /usr/lib/libstdc++.so.6.0.14
    00a03000-00a07000 r--p 000de000 07:00 3949 /usr/lib/libstdc++.so.6.0.14
    00a07000-00a08000 rw-p 000e2000 07:00 3949 /usr/lib/libstdc++.so.6.0.14
    00a08000-00a0f000 rw-p 00000000 00:00 0
    00b46000-00b6a000 r-xp 00000000 07:00 395523 /lib/libm-2.12.1.so
    00b6a000-00b6b000 r--p 00023000 07:00 395523 /lib/libm-2.12.1.so
    00b6b000-00b6c000 rw-p 00024000 07:00 395523 /lib/libm-2.12.1.so
    00cc6000-00ce2000 r-xp 00000000 07:00 395505 /lib/ld-2.12.1.so
    00ce2000-00ce3000 r--p 0001b000 07:00 395505 /lib/ld-2.12.1.so
    00ce3000-00ce4000 rw-p 0001c000 07:00 395505 /lib/ld-2.12.1.so
    00ec3000-00edd000 r-xp 00000000 07:00 392153 /lib/libgcc_s.so.1
    00edd000-00ede000 r--p 00019000 07:00 392153 /lib/libgcc_s.so.1
    00ede000-00edf000 rw-p 0001a000 07:00 392153 /lib/libgcc_s.so.1
    08048000-080e9000 r-xp 00000000 07:00 37644 /home/wcr/mtworkdir/bin/GIZA++
    080e9000-080ea000 rw-p 000a1000 07:00 37644 /home/wcr/mtworkdir/bin/GIZA++
    0898d000-08a50000 rw-p 00000000 00:00 0 [heap]
    b7700000-b7721000 rw-p 00000000 00:00 0
    b7721000-b7800000 ---p 00000000 00:00 0
    b78d2000-b78d5000 rw-p 00000000 00:00 0
    b78e1000-b78e4000 rw-p 00000000 00:00 0
    bfb31000-bfb52000 rw-p 00000000 00:00 0 [stack]

    到这儿,往下就没有了,运行还没有结束就这样啊!
    按回车的话,
    [1]+ Exit 1 /home/wcr/mtworkdir/bin/moses-scripts/scripts-20110223-1108/training/train-model.perl -scripts-root-dir /home/wcr/mtworkdir/bin/moses-scripts/scripts-20110223-1108/ -corpus /home/wcr/mtworkdir/www-ct/corpus/yuliao -f ch -e mg -alignment grow-diag-final-and -reordering msd-bidirectional-fe -lm 0:3:/home/wcr/mtworkdir/www-ct/corpus/ct-lm.txt &>/home/wcr/mtworkdir/www-ct/training.out
    root@ubuntu:/home/wcr/mtworkdir/www-ct#
    不知道在哪里出问题呢!帮我看看吧!呵呵 谢谢啦!

    [回复]

    52nlp 回复:

    建议有问题多Google,我现在也是通过Google来找解决方法的。

    [回复]

  9. 夏天

    请教一下啊!我是初学者。所有该安装的都安装了。但是srilm编译始终不同过,哪里出现错误了,帮忙看一下。谢谢啊。我是菜鸟‵‵
    root@ubuntu:~/mtworkdir/srilm# make World
    mkdir include lib bin
    mkdir: cannot create directory `include': File exists
    mkdir: cannot create directory `lib': File exists
    mkdir: cannot create directory `bin': File exists
    make: [dirs] Error 1 (ignored)
    make init
    make[1]: Entering directory `/root/mtworkdir/srilm'
    for subdir in misc dstruct lm flm lattice utils; do \
    (cd $subdir/src; make SRILM= MACHINE_TYPE=i686-gcc4 OPTION= MAKE_PIC= init) || exit 1; \
    done
    make[2]: Entering directory `/root/mtworkdir/srilm/misc/src'
    Makefile:24: /common/Makefile.common.variables: No such file or directory
    Makefile:139: /common/Makefile.common.targets: No such file or directory
    make[2]: *** No rule to make target `/common/Makefile.common.targets'. Stop.
    make[2]: Leaving directory `/root/mtworkdir/srilm/misc/src'
    make[1]: *** [init] Error 1
    make[1]: Leaving directory `/root/mtworkdir/srilm'
    make: *** [World] Error 2

    [回复]

    52nlp 回复:

    抱歉,查了一下,我也没有找到好的解决方法,你在从前往后检查一下srilm的安装过程吧,特别是依赖工具一个都不能少,问题常常出在这个地方。

    [回复]

    夏天 回复:

    好的 我再看看 :)

    [回复]

  10. wcr2011

    上面的问题,通过从google上找到了答案了!谢谢您!呵呵

    现在我还想请教您问题啊?google上也没有找到答案!
    我搭建完环境后,在moses运行过程中,在调整moses参数步骤上,出现了一个问题!
    运行命令:
    /home/wcr/mtworkdir/scripts/reuse-weights.perl /home/wcr/mtworkdir/tuning/mert/moses.ini /home/wcr/mtworkdir/tuning/moses.weight-reused.ini

    之后,在tuning中产生的moses.weight-reused.ini的内容为空!我在前面的哪个步骤上做得操作不对了吗?为什么出现这种情况呢?
    帮我看看吧!谢谢了!

    [回复]

    52nlp 回复:

    这一步应该是之前生成的moses.ini为空吧,再检查一下路径是否正确。

    [回复]

    wcr2011 回复:

    呵呵 我重新下载了scripts之后,通过了!

    [回复]

  11. mces89

    你好,我在执行到make -j 4的时候报了如下的错误,不知道是什么问题导致?
    mces89@ubuntu:~/mtworkdir/moses$ make -j 4
    make all-recursive
    make[1]: 正在进入目录 `/home/mces89/mtworkdir/moses'
    Making all in kenlm
    make[2]: 正在进入目录 `/home/mces89/mtworkdir/moses/kenlm'
    /bin/bash ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DTRACE_ENABLE=1 -I/home/mces89/mtworkdir/srilm/include -I/home/mces89/mtworkdir/moses/kenlm -g -O2 -MT file_piece.lo -MD -MP -MF .deps/file_piece.Tpo -c -o file_piece.lo `test -f 'util/file_piece.cc' || echo './'`util/file_piece.cc
    libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DTRACE_ENABLE=1 -I/home/mces89/mtworkdir/srilm/include -I/home/mces89/mtworkdir/moses/kenlm -g -O2 -MT file_piece.lo -MD -MP -MF .deps/file_piece.Tpo -c util/file_piece.cc -o file_piece.o
    util/file_piece.cc:19: fatal error: zlib.h: 没有那个文件或目录
    compilation terminated.
    make[2]: *** [file_piece.lo] 错误 1
    make[2]:正在离开目录 `/home/mces89/mtworkdir/moses/kenlm'
    make[1]: *** [all-recursive] 错误 1
    make[1]:正在离开目录 `/home/mces89/mtworkdir/moses'
    make: *** [all] 错误 2

    [回复]

    52nlp 回复:

    可能是zilib的问题吧:“fatal error: zlib.h: 没有那个文件或目录”,看看Google能不能解决:
    http://www.google.com.hk/search?hl=&q=fatal+error%3A+zlib.h%3A+%E6%B2%A1%E6%9C%89%E9%82%A3%E4%B8%AA%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95&sourceid=navclient-ff&rlz=1B3GGLL_zh-CNCN392CN393&ie=UTF-8

    [回复]

    mces89 回复:

    谢谢,已经解决了,少装了两个包...

    [回复]

    hsh 回复:

    少装了两个包?什么意思?

  12. mces89

    ubuntu10.10 32位系统,srilm是1.5.12版本。按照上面说的编译srilm操作,编译没有问题,但是测试全部都是differs,不知道是什么问题?

    [回复]

    52nlp 回复:

    如果编译没有问题,即使测试是differs我觉得也没啥问题,可能的问题就是你测试的路径有问题。

    [回复]

    mces89 回复:

    哦,这个问题我后来把machine type改成i686-gcc4后解决了。然后我在按照moses那个steps步骤做到training phrase model的时候报了如下错误:

    *** buffer overflow detected ***: /home/mces89/tools/bin/GIZA++ terminated
    ======= Backtrace: =========
    [0x817af49]
    [0x817aefd]
    [0x817ad18]
    [0x815cd3e]
    [0x8187ed5]
    [0x817adb4]
    [0x817ad0d]
    [0x806ce9d]
    [0x806d903]
    [0x8073b70]
    [0x8147b3f]
    [0x8048201]
    ======= Memory map: ========
    00efd000-00efe000 r-xp 00000000 00:00 0 [vdso]
    08048000-081fc000 r-xp 00000000 08:01 1574807 /home/mces89/tools/bin/GIZA++
    081fc000-081fe000 rw-p 001b3000 08:01 1574807 /home/mces89/tools/bin/GIZA++
    081fe000-08206000 rw-p 00000000 00:00 0
    09fcc000-0a040000 rw-p 00000000 00:00 0 [heap]
    bfd7f000-bfda0000 rw-p 00000000 00:00 0 [stack]
    ERROR: Execution of: /home/mces89/tools/bin/GIZA++ -CoocurrenceFile work/giza.fr-en/fr-en.cooc -c work/corpus/fr-en-int-train.snt -m1 5 -m2 0 -m3 3 -m4 3 -model1dumpfrequency 1 -model4smoothfactor 0.4 -nodumps 1 -nsmooth 4 -o work/giza.fr-en/fr-en -onlyaldumps 1 -p0 0.999 -s work/corpus/en.vcb -t work/corpus/fr.vcb
    died with signal 6, without coredump
    ^C
    [1]+ Exit 1 nohup nice moses-scripts/scripts-20110329-2046/training/train-model.perl -scripts-root-dir moses-scripts/scripts-20110329-2046/ -root-dir work -corpus work/corpus/news-commentary.lowercased -f fr -e en -alignment grow-diag-final-and -reordering msd-bidirectional-fe -lm 0:3:/home/mces89/tools/work/lm/news-commentary.lm &>work/training.out
    我的giza++是用g++4.4编译的。网上搜了下,也没搞清楚。不知道这个错误是指哪儿有问题?

    [回复]

  13. mamtily

    到第四单元的第二步骤
    2、下载完成后编译:
      cd moses
      ./regenerate-makefiles.sh 的时候
    adam@adam-MS-7191:~/mtworkdir/moses$ ./regenerate-makefiles.sh
    Calling /usr/bin/aclocal...
    Calling /usr/bin/autoconf...
    Calling /usr/bin/automake...
    OnDiskPt/src/Makefile.am:1: library used but `RANLIB' is undefined
    OnDiskPt/src/Makefile.am:1:
    OnDiskPt/src/Makefile.am:1: The usual way to define `RANLIB' is to add `AC_PROG_RANLIB'
    OnDiskPt/src/Makefile.am:1: to `configure.in' and run `autoconf' again.
    kenlm/Makefile.am:1: Libtool library used but `LIBTOOL' is undefined
    kenlm/Makefile.am:1:
    kenlm/Makefile.am:1: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
    kenlm/Makefile.am:1: to `configure.in' and run `aclocal' and `autoconf' again.
    moses/src/Makefile.am:1: Libtool library used but `LIBTOOL' is undefined
    moses/src/Makefile.am:1:
    moses/src/Makefile.am:1: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
    moses/src/Makefile.am:1: to `configure.in' and run `aclocal' and `autoconf' again.
    automake failed

    前面一次执行的时候说没装automake.装好automake1.9以后就是上面命令行。
    不知道哪里错了,请帮个忙。

    [回复]

    52nlp 回复:

    是不是还需要安装“autoconf”呢?

    [回复]

  14. yunyin

    以下两句话
    TCL_INCLUDE = -I/usr/include/tcl8.5
    TCL_LIBRARY = -L/usr/lib/tcl8.5
    tcl8.5是文件夹还是什么,我实在搞不过去一直在这里错
    g++ -mtune=pentium3 -Wreturn-type -Wimplicit -DINSTANTIATE_TEMPLATES -D_FILE_OFFSET_BITS=64 -I/usr/include/tcl8.5 -I. -I../../include -c -g -O3 -o ../obj/i686/Debug.o Debug.cc
    make[2]: g++:命令未找到
    make[2]: *** [../obj/i686/Debug.o] 错误 127
    make[2]:正在离开目录 `/home/yunyin/nlptools/srilm/misc/src'
    make[1]: *** [release-libraries] 错误 1
    make[1]:正在离开目录 `/home/yunyin/nlptools/srilm'
    make: *** [World] 错误 2
    另外就是我的版本是10.10,我一直装不上g++4.1.1这个很让我纠结,不知道为什么,关系树上已经没有这个东西了貌似,应该怎么装,我装了好久了
    谢谢...刚开始学习

    [回复]

  15. yunyin

    你好,我想问下在配置的所有情况下,总共需要哪些环境配置
    在配置过程中的环境我配置了,但是不知道是路径的问题还是什么
    我只能根据moses的路径进行运行,而不是直接使用命令运行

    [回复]

    52nlp 回复:

    这个需要声明环境变量,例如:
      export SCRIPTS_ROOTDIR=/home/52nlp/mtworkdir/bin/moses-scripts
    /scripts-20090113-1019

    [回复]

  16. wcr2011

    翻译模型训练:
    train-model.perl -scripts-root-dir /home/bin/moses-scripts/scripts-20110315-0953/ -root-dir /home/wcr/ -corpus /home/wcr/corpus/train -f en -e ch -alignment grow-diag-final-and -reordering msd-bidirectional-fe -lm 0:3:/home/lm/ch-bz-lm.txt:0 -lm 1:3:/home/lm/bz-lm.txt:0 -translation-factors 0-0,1
    这里 目标语言是加词性标注的, ch-bz-lm.txt是用带词性标注的语料训练出来的语言模型 bz-lm.txt是抽取词性标注后训练出来的语言模型
    -lm 0:3:/....../ch-bz-lm.txt:0 -lm 1:3:/...../bz-lm.txt:0
    3表示三元模型型吧!? 0,1分别表示什么?我这里这样写对吗?
    运行后,出来的moses配置文件moses.ini中,
    mapping
    0 T 0
    不是应该o T 0,1吗?
    请帮我分析分析^_^

    [回复]

  17. wcr2011

    /home/wcr/bin/moses-scripts/scripts-20110315-0953/training/train-model.perl -scripts-root-dir /home/wcr/moses-scripts/scripts-20110315-0953/ -root-dir /home/wcr/mg-ch-bz/ -corpus /home/wcr/mg-ch-bz/corpus/train -f mg -e ch -alignment grow-diag-final-and -reordering msd-bidirectional-fe -lm 0:3:/home/wcr/mg-ch-bz/lm/ch-bz-lm.txt:0 -lm 1:3:/home/wcr/mg-ch-bz/lm/bz-lm.txt:0 -translation-factors 0-0,1 >& /home/wcr/mg-ch-bz/training.out &

    这里ch-bz-lm.txt 是"表面词形|词性"的语言模型 bz-lm.txt是"词性标注"的语言模型
    这里的0,1代表什么呢?
    运行该命令后生成的moses.ini配置文件中
    [mapping]
    0 T 0
    应该是0 T 0,1 不是吗?

    [回复]

    52nlp 回复:

    0代表的是“表面词形”,1代表的是“词性”吧?
    抱歉,我好长时间没有碰Moses,都有点忘了;建议好好看一下Moses官方关于factor model的例子及文档,印象写得很清楚。

    [回复]

  18. wcr2011

    用层次短语模型的情况下,最小错误率训练为什么结果都零呢?
    运行命令如下:
    /home/.../mtworkdir/bin/moses-scripts/scripts-20110907-2221/training/mert-moses.pl /home/.../hb-3/tuning/ch /home/.../hb-3/tuning/references /home/.../mtworkdir/moses/moses-chart-cmd/src/moses_chart /home/.../hb-3/model/moses.ini --working-dir /home/.../hb-3/tuning/mert -rootdir /home/.../mtworkdir/bin/moses-scripts/scripts-20110907-2221/ --decoder-flags "-v 0" >& /home/.../hb-3/tuning/mert.out &

    很快能运行完,里头出来两个run.moses.ini,其结果为0.00000
    我在哪里出问题了呢?

    [回复]

    52nlp 回复:

    印象mert训练需要一定的时间,这样很快的训练完,是不是那个指定有问题?建议检查一下它的log输出,看是否有error方面的log. 另外层次短语的训练我还没玩过,所以以上回答仅限猜测!

    [回复]

    wcr2011 回复:

    好的!谢谢!

    [回复]

  19. dqxiao2012

    在ubuntu10.10 上装g++-4.1
    包已经被废弃了,下了gcc4.1.2 源代码中,编译总是出错,
    照google上的第一个评论改后,还是出现错误。
    Pointer.h:27: fatal error: stream.h: 没有那个文件或目录

    [回复]

    52nlp 回复:

    这个是装哪个模块出的问题?giza++?如果是giza++,可用的是最新的包,印象giza++之前存在一个bug,被最新的包修复了。

    [回复]

    dqxiao2012 回复:

    感谢,已经最新的包确实修复了该问题。

    [回复]

发表评论

电子邮件地址不会被公开。 必填项已用*标注