热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Mosesv1.0多语言ini文件-Mosesv1.0multilanguageinifile

Iwasworkingwithmosesserver0.91andeverythingworksfinebutnowthereisversion1.0andnothi

I was working with mosesserver 0.91 and everything works fine but now there is version 1.0 and nothing is same as before.

我使用的是mosesserver 0.91,一切正常,但现在有1.0版本,没有任何东西和以前一样。

Here is my situation:

这是我的情况:

I want to have multi language translation from arabic to english and from english to arabic. All data and configuration file I have works with 0.91 version of mosesserver. Here is my config file:

我想要从阿拉伯语翻译成英语,从英语翻译成阿拉伯语。我拥有的所有数据和配置文件都适用于0.91版本的mosesserver。这是我的配置文件:

-------------------------------------------------
#########################
### MOSES CONFIG FILE ###
#########################

# D - decoding path, R - reordering model, L - language model
[translation-systems]
ar-en D 0 R 0 L 0
en-ar D 1 R 1 L 1

# input factors
[input-factors]
0

# mapping steps
[mapping]
0 T 0
1 T 1

# translation tables: table type (hierarchical(0), textual (0), binary (1)), source-factors, target-factors, number of scores, file 
# OLD FORMAT is still handled for back-compatibility
# OLD FORMAT translation tables: source-factors, target-factors, number of scores, file 
# OLD FORMAT a binary table type (1) is assumed 
[ttable-file]
1 0 0 5 /mnt/models/ar-en/phrase-table/phrase-table
1 0 0 5 /mnt/models/en-ar/phrase-table/phrase-table

# no generation models, no generation-file section

# language models: type(srilm/irstlm), factors, order, file
[lmodel-file]
1 0 5 /mnt/models/ar-en/language-model/en.qblm.mm
1 0 5 /mnt/models/en-ar/language-model/ar.lm.d1.blm.mm


# limit on how many phrase translations e for each phrase f are loaded
# 0 = all elements loaded
[ttable-limit]
20

# distortion (reordering) files
[distortion-file]
0-0 wbe-msd-bidirectional-fe-allff 6 /mnt/models/ar-en/reordering-table/reordering-table.wbe-msd-bidirectional-fe.gz
0-0 wbe-msd-bidirectional-fe-allff 6 /mnt/models/en-ar/reordering-model/reordering-table.wbe-msd-bidirectional-fe.gz

# distortion (reordering) weight
[weight-d]
0.3
0.3

# lexicalised distortion weights
[weight-lr]
0.3
0.3
0.3
0.3
0.3
0.3
0.3
0.3
0.3
0.3
0.3
0.3

# language model weights
[weight-l]
0.5000
0.5000

# translation model weights
[weight-t]
0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2

# no generation models, no weight-generation section

# word penalty
[weight-w]
-1
-1

[distortion-limit]
12
---------------------------------------------------------

So please can someone help me and rewrite this config file so it can work in version 1.0. And i need some python sample code of translation. I am using xmlrpc in python and earler I sent http request with:

因此,请有人帮助我重写这个配置文件,以便它能在1.0版本中工作。我需要一些python的翻译示例代码。我正在使用python中的xmlrpc,以及发送http请求的earler:

import xmlrpclib

client = xmlrpclib.ServerProxy('http://localhost:8080')
client.translate({'text': 'some text', 'system': 'en-ar'})

but now seems there is no more 'system' parameter and moses use always default settings.

但是现在似乎没有更多的“系统”参数,而moses总是使用默认设置。

1 个解决方案

#1


2  

I fix it. This is new ini file:

我修好它。这是新的ini文件:

[input-factors]
 0

 # mapping steps
 [mapping]
 0 T 0
 1 T 1

 [distortion-limit]
 12

 # feature functions
 [feature]
 Distortion
 UnknownWordPenalty
 WordPenalty
 PhraseDictionaryBinary name=TranslationModel0 num-features=5 path=/mnt/models/ar-en/phrase-table/phrase-table input-factor=0 output-factor=0 table-limit=20
 LexicalReordering num-features=6 name=LexicalReordering0 type=wbe-msd-bidirectional-fe-allff input-factor=0 output-factor=0 path=/mnt/models/ar-en/reordering-table/reordering-table.wbe-msd-bidirectional-fe.gz 
 IRSTLM name=LM0 order=5 factor=0 path=/mnt/models/ar-en/language-model/en.qblm.mm
 PhraseDictionaryBinary name=TranslationModel1 num-features=5 path=/mnt/models/en-ar/phrase-table/phrase-table input-factor=0 output-factor=0 table-limit=20
 LexicalReordering num-features=6 name=LexicalReordering1 type=wbe-msd-bidirectional-fe-allff input-factor=0 output-factor=0 path=/mnt/models/en-ar/reordering-model/reordering-table.wbe-msd-bidirectional-fe.gz 
 IRSTLM name=LM1 order=5 factor=0 path=/mnt/models/en-ar/language-model/ar.lm.d1.blm.mm

 # core weights - not used
 [weight]
 Distortion0= 0
 WordPenalty0= 0
 TranslationModel0= 0 0 0 0 0
 LexicalReordering0= 0 0 0 0 0 0
 LM0= 0
 TranslationModel1= 0 0 0 0 0
 LexicalReordering1= 0 0 0 0 0 0
 LM1= 0

 [alternate-weight-setting]
 id=ar-en ignore-ff=LM1,LexicalReordering1 ignore-decoding-path=1
 Distortion0= 0.3
 WordPenalty0= -1
 TranslationModel0= 0.2 0.2 0.2 0.2 0.2
 LexicalReordering0= 0.3 0.3 0.3 0.3 0.3 0.3
 LM0= 0.5
 id=en-ar ignore-ff=LM0,LexicalReordering0 ignore-decoding-path=0
 Distortion0= 0.3
 WordPenalty0= -1
 TranslationModel1= 0.2 0.2 0.2 0.2 0.2
 LexicalReordering1= 0.3 0.3 0.3 0.3 0.3 0.3
 LM1= 0.5

Sample code for client is:

客户端示例代码为:

import xmlrpclib

client = xmlrpclib.ServerProxy('http://localhost:8080')
client.translate({'text': '%s' % ('en-ar', some_text)})

where "en-ar" is translation system which, in my case, translate from english to arabic (also i have other translation system "ar-en" (from arabic to english) as you can see from ini file).

en-ar是翻译系统,在我的例子中,它是从英语翻译到阿拉伯语(我还有其他翻译系统“ar-en”(从阿拉伯语翻译到英语),你可以从ini文件中看到)。


推荐阅读
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • Vagrant虚拟化工具的安装和使用教程
    本文介绍了Vagrant虚拟化工具的安装和使用教程。首先介绍了安装virtualBox和Vagrant的步骤。然后详细说明了Vagrant的安装和使用方法,包括如何检查安装是否成功。最后介绍了下载虚拟机镜像的步骤,以及Vagrant镜像网站的相关信息。 ... [详细]
  • 本文介绍了解决Netty拆包粘包问题的一种方法——使用特殊结束符。在通讯过程中,客户端和服务器协商定义一个特殊的分隔符号,只要没有发送分隔符号,就代表一条数据没有结束。文章还提供了服务端的示例代码。 ... [详细]
  • baresip android编译、运行教程1语音通话
    本文介绍了如何在安卓平台上编译和运行baresip android,包括下载相关的sdk和ndk,修改ndk路径和输出目录,以及创建一个c++的安卓工程并将目录考到cpp下。详细步骤可参考给出的链接和文档。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 本文介绍了计算机网络的定义和通信流程,包括客户端编译文件、二进制转换、三层路由设备等。同时,还介绍了计算机网络中常用的关键词,如MAC地址和IP地址。 ... [详细]
  • 关键词:Golang, Cookie, 跟踪位置, net/http/cookiejar, package main, golang.org/x/net/publicsuffix, io/ioutil, log, net/http, net/http/cookiejar ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 本文介绍了在Linux下安装和配置Kafka的方法,包括安装JDK、下载和解压Kafka、配置Kafka的参数,以及配置Kafka的日志目录、服务器IP和日志存放路径等。同时还提供了单机配置部署的方法和zookeeper地址和端口的配置。通过实操成功的案例,帮助读者快速完成Kafka的安装和配置。 ... [详细]
  • 本文详细介绍了如何使用MySQL来显示SQL语句的执行时间,并通过MySQL Query Profiler获取CPU和内存使用量以及系统锁和表锁的时间。同时介绍了效能分析的三种方法:瓶颈分析、工作负载分析和基于比率的分析。 ... [详细]
  • 解决nginx启动报错epoll_wait() reported that client prematurely closed connection的方法
    本文介绍了解决nginx启动报错epoll_wait() reported that client prematurely closed connection的方法,包括检查location配置是否正确、pass_proxy是否需要加“/”等。同时,还介绍了修改nginx的error.log日志级别为debug,以便查看详细日志信息。 ... [详细]
  • 本文探讨了在设置了HTTP客户端超时时间后,向HTTP服务器发送请求时出现两个请求的情况。其中一个请求正常,另一个请求无法获取请求参数。文章分析了可能导致此问题的原因,并提供了解决方案。 ... [详细]
  • centos安装Mysql的方法及步骤详解
    本文介绍了centos安装Mysql的两种方式:rpm方式和绿色方式安装,详细介绍了安装所需的软件包以及安装过程中的注意事项,包括检查是否安装成功的方法。通过本文,读者可以了解到在centos系统上如何正确安装Mysql。 ... [详细]
  • Hadoop2.6.0 + 云centos +伪分布式只谈部署
    3.0.3玩不好,现将2.6.0tar.gz上传到usr,chmod-Rhadoop:hadophadoop-2.6.0,rm掉3.0.32.在etcp ... [详细]
author-avatar
游泳
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有