Hi Prashant

If you build Moses without threads then it should process one sentence at a 
time. This is not the default build, so run ./bjam --help to see the 
appropriate build options.

If you run multi-threaded Moses without the -threads argument, then it will 
use one thread for translation and one thread for reading in the input file, 
which is why you get the behaviour you observe.

Instead of doing this in-band signalling to Moses, you could use the Moses API 
directly, as is done by the mira implementation (see last year's mtm paper, 
and the miramerge branch)

cheers - Barry

On Thursday 05 April 2012 16:54:53 Prashant Mathur wrote:
> Hi all,
> 
> We are trying to update feature weights dynamically during decoding. We
> are doing this by adding additional lines of input, delimited with a
> special token to tell Moses to update weights.
> 
> For example,
> ----
> First sentence.
> @CMD@ weight-l=0.5
> Change the LM weight for this sentence.
> ----
> While debugging our new code, we noticed that several lines of the input
> were read before being translated.
> 
> For instance, this is the input file:
> sentence0
> @CMD@ weight-l=0.5
> sentence1
> @CMD@ weight-l=0.3
> sentence2
> 
> Whenever a @CMD@ line is read, we execute the corresponding command to
> change the weights. So we would expect all three sentences to be
> translated with different weights.
> Instead what happens is that all the commands are executed before
> translating *any* sentence, so that all sentences are translated with
> the last modified weights (i.e weight-l=0.3)
> 
> This happens when the inputfile is given as an argument (to -i) and also
> when it is read from the stdin.
> Only if we type the lines to the console one by one do we get the
> expected result.
> 
> Is there any way to force Moses to read and process each line at a time?
> 
 
--
Barry Haddow
University of Edinburgh
+44 (0) 131 651 3173

-- 
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