Hi Andreas

The code for writing the word alignment is in IOWrapper.cpp, the function 
OutputAlignment(). The OutputCollectors are simply used to make sure the 
output is written in the correct order when using multiple threads.

The moses server already has an option for returning the phrase alignment. If 
you look at mosesserver.cpp, in Translator::execute(), you can see how it 
deals with the align flag.

To get the word alignment from the moses server, it should just be a matter of 
accessing the alignments as in OutputAlignment(), and writing them into the 
xmlrpc return object, using a suitable data structure,

best regards - Barry

On Tuesday 01 March 2011 10:31, Andreas Kull wrote:
> Hi,
>
> I want to modify mosesserver.cpp so that it sends the phrase and word
> alignment information, i.e.:
>
> 8 ||| this is a test  ||| d: 0 -0.0427415 0 0 -0.0140452 0 0 lm:
> -22.709 w: -4 tm: -3.52722 -6.8957 -1.49922 -3.4347 1.99979 |||
> -10.0429 ||| 0-2=0-2 3=3 ||| 0-0 1-1 2-2 3-3
>
> >> 0-2=0-2 3=3 ||| 0-0 1-1 2-2 3-3
>
> Unfortunately, I'm a bit lost in code. Could you give me a hint which
> class/function I need to call to retrieve this information? Is it even
> possible?
>
> I looked at moses/src/main.cpp and it seems that this information is
> stored in an OutputCollector, correct? Which function is used to write
> the two last segments (phrase/word alignment)?
>
> My goal is to reinsert inline XML tags with the alignment information, e.g.
>
> User input: <b> this is </b> a test => Internal datastructure: <b> :
> 0-1 => Moses input: this is a test => User output: <b> das ist </b>
> ein test
>
>
> Regards,
> Andreas
>
> _______________________________________________
> Moses-support mailing list
> [email protected]
> http://mailman.mit.edu/mailman/listinfo/moses-support

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support

Reply via email to