word penalty for XML options

This commit is contained in:
Hieu Hoang 2013-04-26 17:49:11 +01:00
parent 83494418e2
commit 8edbfebbf1
4 changed files with 6 additions and 16 deletions

View File

@ -488,7 +488,7 @@ void Parameter::ConvertWeightArgsPhraseModel(const string &oldWeightName)
ptType = "PhraseDictionaryOnDisk";
break;
case SCFG:
ptType = "PhraseDictionarySCFG";
ptType = "PhraseDictionaryMemory";
break;
case Compact:
ptType = "PhraseDictionaryCompact";

View File

@ -236,18 +236,6 @@ void TargetPhrase::SetScore(const FeatureFunction* producer, const Scores &score
m_fullScore = m_scoreBreakdown.GetWeightedScore();
}
void TargetPhrase::SetWeights(const FeatureFunction* translationScoreProducer, const vector<float> &weightT)
{
// calling this function in case of confusion net input is undefined
CHECK(StaticData::Instance().GetInputType()==SentenceInput);
/* one way to fix this, you have to make sure the weightT contains (in
addition to the usual phrase translation scaling factors) the input
weight factor as last element
*/
}
TargetPhrase *TargetPhrase::MergeNext(const TargetPhrase &inputPhrase) const
{
if (! IsCompatible(inputPhrase)) {

View File

@ -95,9 +95,6 @@ public:
// used by for unknown word proc in chart decoding
void SetScore(const FeatureFunction* producer, const Scores &scoreVector);
void SetWeights(const FeatureFunction*, const std::vector<float> &weightT);
TargetPhrase *MergeNext(const TargetPhrase &targetPhrase) const;
// used for translation step

View File

@ -28,6 +28,7 @@
#include "StaticData.h"
#include "WordsRange.h"
#include "TargetPhrase.h"
#include "DummyScoreProducers.h"
namespace Moses
{
@ -341,7 +342,11 @@ bool ProcessAndStripXMLTags(string &line, vector<XmlOption*> &res, ReorderingCon
WordsRange range(startPos,endPos-1); // span covered by phrase
TargetPhrase targetPhrase;
targetPhrase.CreateFromString(Output, outputFactorOrder,altTexts[i],factorDelimiter);
targetPhrase.SetScore(scoreValue);
vector<float> wp(1, - targetPhrase.GetSize());
targetPhrase.SetScore(StaticData::Instance().GetWordPenaltyProducer() , wp);
// TODO: targetPhrase.SetSourcePhrase() ?
XmlOption *option = new XmlOption(range,targetPhrase);