Following Barry's introduction of TranslationSystem.cpp in r3394, the Moses
"Adding Feature Functions" tutorial (
http://www.statmt.org/moses/?n=Moses.FeatureFunctions) needs to be updated.
I just hit my head against this while attempting to bring my syntactic LM
branch up to date with trunk.
Namely, it is no longer sufficient to merely tell the ScoreIndexManager
about your feature in your feature's constructor:
const_cast<ScoreIndexManager&> \
(StaticData::Instance().GetScoreIndexManager()) \
.AddScoreProducer(this);
const_cast<StaticData&>(StaticData::Instance()) \
.SetWeightsForScoreProducer(this, weights);
In addition (AFAIK) you now have to make a call like this in StaticData.cpp:
// Add any other features here
m_translationSystems.find(config[0])->second.AddFeatureFunction(m_myCoolFeatureFunction);
If this last line is not added, the decoder will ignore your feature
function, even its model has been successfully loaded. All feature values
for that function will be zero during decoding.
Cheers,
Lane
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support