TensorFlow机器翻译之moses切词(附:ActivePerl安装)

使用moses切词

  • 英文分词

Perl  ***.perl    (perl xxx.pl)

perl moses_tokenizer.perl -no-escape -l en < train.tags.en-zh.en> train.txt.en

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

因为tokenizer.perl中没有找到nonbreaking_prefixes.en。路径问题,我把tokenizer.perl位置给移动了

1、可以把train.tags.en-zh.en移动到tokenizer.perl同目录下,切分完成之后把结果和train.tags.en-zh.en再移动到对应文件下。

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

2、可以把每一个的具体路径写出来

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

  • 中文分词

看了源代码,语言没有中文,如要给中文分词的话,需要自己配置。

注意: “<”  ">"是必须的!

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

按照TensorFlow实战Google深度学习框架书中写的运行结果不对,然后参考源代码结果也不对,对perl不是很了解。,

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

查了很多都没有对中文分词运行的例子。。。弄了半天,灵机一动,把源代码改了,加了一句“$text =~ s/\B/ /g;

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

再运行,就正确分词了。不过这样改了源代码如果是其他语言就不行,可以用完再改回来,哈哈哈(尬笑.jpg)。哪位大佬看到了,求指教

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

 

cmd打开:perl –v  测试一下有没有perl,没有需要安装ActivePerl

 

附:ActivePerl安装

据经验,Typical应该是默认安装到C盘。所以选择了Custom,自己选择路径

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

更改路径:

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

 

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

选择install:

TensorFlow机器翻译之moses切词(附:ActivePerl安装)

完成安装:

TensorFlow机器翻译之moses切词(附:ActivePerl安装)