Actually, the incorrect source phrase is used for more than logging.  It
makes it all the way to lexical reordering:

          const Phrase *sourcePhrase = transOpt.GetSourcePhrase();
          if (sourcePhrase) {
            Scores score = lexreordering.GetProb(*sourcePhrase,
transOpt.GetTargetPhrase());
            if (!score.empty())
              transOpt.CacheScores(lexreordering, score);

These are parts of Moses far afield.  Hieu, the bug goes back to you in
1338.  Want to fix it?

On 10/14/11 20:48, Kenneth Heafield wrote:
> Hi,
> 
>       Apparently target phrases keep track of their source phrases?  This is
> incorrect with e.g. PhraseTableMemory (this is the code from revision 4364):
> 
>     Phrase sourcePhrase(Input, 0);
>     sourcePhrase.CreateFromString( input, phraseVector);
>     //target
>     TargetPhrase targetPhrase(Output);
>     targetPhrase.SetSourcePhrase(&sourcePhrase);
> 
> I'm currently refactoring it, but have provided the old version to make
> it clear this isn't my fault.
> 
> The last line stores a pointer to a stack allocated object in
> targetPhrase.  Furthermore, the sourcePhrase object does not even exist
> in copy form, so there's nothing correct for it to point to.
> 
> I tried to remove it, apparently it makes its way to TranslationOption
> and Hypothesis, GetSourcePhraseStringRep in particular.  That is called
> only from Manager.cpp and used for logging purposes in e.g.:
> 
> outputWordGraphStream << "\tw=" << hypo->GetSourcePhraseStringRep() <<
> "|" << hypo->GetCurrTargetPhrase();
> 
> On the basis that no logging is better than incorrect logging, I'm going
> to stop tracking the source phrase in the target phrase.
> 
> Kenneth
> _______________________________________________
> Moses-support mailing list
> [email protected]
> http://mailman.mit.edu/mailman/listinfo/moses-support

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

Reply via email to