当前位置: 首页 > news >正文

财富半岛建设购物网站域名批量查询工具

财富半岛建设购物网站,域名批量查询工具,wordpress问卷,网站建站的步骤流程文章目录一、安装依赖包mosesdecoder安装 mgiza二、数据预处理三、训练本文参考:How to train your Bicleaner https://github.com/bitextor/bicleaner/wiki/How-to-train-your-Bicleaner 一、安装依赖包 这个过程主要依赖于 mosesdecodermgiza mosesdecoder git…

文章目录

    • 一、安装依赖包
      • mosesdecoder
      • 安装 mgiza++
    • 二、数据预处理
    • 三、训练


本文参考:How to train your Bicleaner
https://github.com/bitextor/bicleaner/wiki/How-to-train-your-Bicleaner


一、安装依赖包

这个过程主要依赖于

  • mosesdecoder
  • mgiza++

mosesdecoder

  • github : https://github.com/moses-smt/mosesdecoder
  • 官方说明:http://www2.statmt.org/moses/?n=Development.GetStarted
    官方介绍了 windows, macOS 和各版本 ubuntu 的安装细节,这里以 ubuntu 为例

1、安装依赖

sudo apt-get install [package name]

Packages:

   g++ git subversionautomakelibtoolzlib1g-devlibicu-devlibboost-all-devlibbz2-devliblzma-devpython-devgraphvizimagemagickmakecmakelibgoogle-perftools-dev (for tcmalloc)autoconfdoxygen

2、安装

./bjam -j4

如果手动安装了 boost,也可以指定 boost 位置
boost 安装教程:https://blog.csdn.net/lovechris00/article/details/125423796

./bjam --with-boost=~/workspace/temp/boost_1_64_0 -j8

3、安装成功测试

cd ~/mosesdecoder
wget http://www.statmt.org/moses/download/sample-models.tgz
tar xzf sample-models.tgz
cd sample-models# 运行
~/mosesdecoder/bin/moses -f phrase-model/moses.ini < phrase-model/in > out

得到如下结果,代表安装成功
翻译结果:Translating: das ist ein kleines haus

Defined parameters (per moses.ini or switch):config: phrase-model/moses.ini 
...
----5---10---15---20---25---30---35---40---45---50---55---60---65---70---75---80---85---90---95--100
**The ARPA file is missing <unk>.  Substituting log10 probability -100.000.
**************************************************************************************************
FeatureFunction: LM start: 0 end: 0
line=Distortion
...
----5---10---15---20---25---30---35---40---45---50---55---60---65---70---75---80---85---90---95--100
****************************************************************************************************
Created input-output object : [0.685] seconds
Translating: das ist ein kleines haus 
...
Name:moses	VmPeak:193088 kB	VmRSS:11404 kB	RSSMax:37844 kB	user:0.684	sys:0.008	CPU:0.692	real:0.692

git clone https://github.com/moses-smt/mosesdecoder.git

安装 mgiza++

这里使用 linux 环境为例

# 安装 libboost (mgiza++ 的编译依赖于它)
sudo apt-get install -y cmake libboost-all-dev# 下载mgiza、安装 
git clone https://github.com/moses-smt/mgiza.gitcd mgiza/mgizappcmake . && make && make installcp scripts/merge_alignment.py bin/

二、数据预处理

上文给出的方式是使用 shell,主要实现对文本 tokenize 和 lower 的过程;
这里我使用 python 实现;
假设你有两个文件:raw.zh, raw.en


处理中文
这里使用 jieba 分词

import os ,sys     
import jieba def process(file_path): save_path = file_path + '_low.txt' print('\n-- start : ',file_path) for line in open(file_path):zh_toks = jieba.cut(line.strip())zh_text = ' '.join(zh_toks).lower() with open(save_path, 'a') as fa:fa.write(zh_text + '\n' )print('-- end : ', file_path, save_path)    if __name__ == '__main__':file_path = sys.argv[1]print('-- ', file_path)process(file_path)

处理英文

import os ,sys    
import nltk  def process(file_path): save_path = file_path + '_low.txt' print('\n-- start : ',file_path) for line in open(file_path):en_toks = nltk.word_tokenize(line.strip())en_text = ' '.join(en_toks).lower() with open(save_path, 'a') as fa:fa.write(en_text + '\n' )print('-- end : ', file_path, save_path)    if __name__ == '__main__':file_path = sys.argv[1]print('-- ', file_path)process(file_path)

处理后修改两个文件,以语种作为后缀;假设处理后的文件名为 clean.zh, clean.en;
除了语种后缀外,前面必须一致,方便后续处理;


三、训练

  • 使用 mosesdecoder 的 train-model.perl 文件来训练;
  • 需要添加 mgiza 的bin目录
  • --root-dir: 数据文件所在的根目录
  • -corpus 设置文件名前缀;这里为 clean
  • -e, -f 设置语种
/home/xx/mosesdecoder/scripts/training/train-model.perl \
--alignment grow-diag-final-and \
--root-dir /home/xx/data/230303  -\
-corpus clean -e en -f zh \
--mgiza -mgiza-cpus=16 --parallel --first-step 1 --last-step 4 \
--external-bin-dir /home/xx/scode/mgiza/mgizapp/bin

  • 40万条数据可能要训练2小时以上;为了测试,可以尝试训练 1w到5w条数据即可。
  • 如果报找不到 symal 之类,可能是 mosesdecoder 编译不成功导致

生成成功后,我们可以在 root-dir 下得到 model 文件夹,包含以下三个文件

  • aligned.grow-diag-final-and
  • lex.e2f
  • lex.f2e

伊织 2023-03-03

http://www.dt0577.cn/news/7531.html

相关文章:

  • 企查查在线查询入口石家庄seo代理商
  • 婚纱网站论文网店推广方法有哪些
  • 找个做网站的微博营销的特点
  • 怎么给购物网站做推广上海网站设计公司
  • 做网站最好的软件软文广告平台
  • 网站建设排名北京电脑培训学校哪家最好
  • 海口网站建设方案推广移动建站优化
  • 网站备案真实性核验委托书厦门seo报价
  • 做棋牌网站建设多少钱软文写作兼职
  • 商城网站建设abc百度一下官网首页
  • 网站建设部署与发布试题网店网络推广方案
  • 如何自己做官网首页东莞关键词seo优化
  • 企业天眼查佛山seo整站优化
  • 杭州余杭做网站公司百度推广点击软件
  • 视频在线制作免费生成优化大师手机版下载
  • 广州最好的网站建设公司抖音优化是什么意思
  • 做企业网站费用华为手机软文范文300
  • wordpress 聘用天津百度快速排名优化
  • wordpress多站点 seo排名优化方案
  • 中山网站建设方案托管网络搜索工具
  • 做兼职什么网站最靠谱网站友链查询源码
  • 旅游网站制作视频百度云免费发帖推广网站
  • 学生作业制作网站台州seo排名外包
  • b2b服务商网站大全自己做网络推广怎么做
  • 网站建设sem如何检测网站是否安全
  • 网站建设多少钱一个月凡科官网免费制作小程序
  • 南澳做网站东莞seo优化排名
  • logo查询有没有注册过合肥seo培训
  • 外贸网站设计的公司网络推广营销软件
  • 上海专业高端网站建中国站长之家