mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-26 11:28:48 +03:00
word penalty for XML options
This commit is contained in:
parent
83494418e2
commit
8edbfebbf1
@ -488,7 +488,7 @@ void Parameter::ConvertWeightArgsPhraseModel(const string &oldWeightName)
|
||||
ptType = "PhraseDictionaryOnDisk";
|
||||
break;
|
||||
case SCFG:
|
||||
ptType = "PhraseDictionarySCFG";
|
||||
ptType = "PhraseDictionaryMemory";
|
||||
break;
|
||||
case Compact:
|
||||
ptType = "PhraseDictionaryCompact";
|
||||
|
@ -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)) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user