Hi Montse,
I encountered the same problem with the provided Perl client
(https://github.com/moses-smt/mosesdecoder/blob/master/contrib/server/client.perl).
I fixed it by using the attached Perl client (it uses a different library).
Hope it will work for you.
Marwen
Le 18/07/2012 14:29, Barry Haddow a écrit :
Hi Mon,
When using mosesserver, the clients have to encode the characters correctly
for transmission in xml-rpc. You may have to make some additional libraries
calls in the client to get the encoding correct. The supplied sample clients
should work correctly, but I have seen problems in the past with (eg) buggy
perl libraries.
To check what messages are being passed, you should set the XMLRPC_TRACE_XML
environment variable to 1 before launching the mosesserver. You could also run
mosesserver with -v 1 to monitor what it is receiving/sending. This should
tell you where the character encoding is being corrupted.
cheers - Barry
On Wednesday 18 Jul 2012 13:08:17 Montse Cuadros wrote:
Dear all,
We have been working with moses for translating some files, and recasing
them acording to a prebuilt models trained in moses.
We don't have problems when using moses in both cases.
Furthermore, we want to use the same models with mosesserver. Here the
problem starts.
We have compiled moses and mosesserver together with irstml, srlim and
rpc_xml and everything worked fine.
The problems have started when translating and recasing files from spanish
and french that have "ñ","í", ... ... and these kind of letters.
With moses we don't have problems with encodings and with mosesserver yes,
having them compiled together, with the same parameters, and with the same
configuration files.
Any clue of what is happening to us?
We will appreciate any suggestion.
Best,
Mon
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support
#!/usr/bin/perl
# Perl sample client for mosesserver (Created by Marwen AZOUZI)
use strict;
#use Data::Dumper;
use RPC::XML;
use RPC::XML::Client;
use Encode;
my $text = $ARGV[0];
my $client = RPC::XML::Client->new('http://127.0.0.1:8000/RPC2');
$RPC::XML::ENCODING = "UTF-8";
my $request = RPC::XML::request->new('translate',RPC::XML::struct->new({'text'
=> RPC::XML::string->new($text)}));
my $response = $client->send_request($request);
if (!$response) {
print $RPC::XML::ERROR, "\n";
} else {
print Encode::encode("utf-8",$response->{text}->value);
}
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support