mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
27 lines
647 B
Python
Executable File
27 lines
647 B
Python
Executable File
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# python port of client.perl
|
|
|
|
import xmlrpclib
|
|
import datetime
|
|
|
|
url = "http://localhost:8080/RPC2"
|
|
proxy = xmlrpclib.ServerProxy(url)
|
|
|
|
text = u"il a souhaité que la présidence trace à nice le chemin pour l' avenir ."
|
|
params = {"text":text, "align":"true", "report-all-factors":"true"}
|
|
|
|
result = proxy.translate(params)
|
|
|
|
print result['text']
|
|
|
|
if 'id' in result:
|
|
print "Segment ID:%s" % (result['id'])
|
|
|
|
if 'align' in result:
|
|
print "Phrase alignments:"
|
|
aligns = result['align']
|
|
for align in aligns:
|
|
print "%s,%s,%s" %(align['tgt-start'], align['src-start'], align['src-end'])
|