mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 13:23:25 +03:00
add -default-non-term-for-empty-range-only
This commit is contained in:
parent
5d61639763
commit
6b1e147cff
@ -201,6 +201,8 @@ Parameter::Parameter()
|
||||
|
||||
AddParam("placeholder-factor", "Which source factor to use to store the original text for placeholders. The factor must not be used by a translation or gen model");
|
||||
AddParam("no-cache", "Disable all phrase-table caching. Default = false (ie. enable caching)");
|
||||
AddParam("default-non-term-for-empty-range-only", "Don't add [X] to all ranges, just ranges where there isn't a source non-term. Default = false (ie. add [X] everywhere)");
|
||||
|
||||
}
|
||||
|
||||
Parameter::~Parameter()
|
||||
|
@ -425,6 +425,9 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
}
|
||||
if (m_useConsensusDecoding) m_mbr=true;
|
||||
|
||||
SetBooleanParameter( &m_defaultNonTermOnlyForEmptyRange, "default-non-term-for-empty-range-only", false );
|
||||
|
||||
|
||||
// Compact phrase table and reordering model
|
||||
SetBooleanParameter( &m_minphrMemory, "minphr-memory", false );
|
||||
SetBooleanParameter( &m_minlexrMemory, "minlexr-memory", false );
|
||||
|
@ -197,6 +197,7 @@ protected:
|
||||
|
||||
FactorType m_placeHolderFactor;
|
||||
bool m_useLegacyPT;
|
||||
bool m_defaultNonTermOnlyForEmptyRange;
|
||||
|
||||
FeatureRegistry m_registry;
|
||||
|
||||
@ -761,6 +762,9 @@ public:
|
||||
m_treeStructure = treeStructure;
|
||||
}
|
||||
|
||||
bool GetDefaultNonTermOnlyForEmptyRange() const
|
||||
{ return m_defaultNonTermOnlyForEmptyRange; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -265,7 +265,10 @@ int TreeInput::Read(std::istream& in,const std::vector<FactorType>& factorOrder)
|
||||
// default label
|
||||
for (size_t startPos = 0; startPos < sourceSize; ++startPos) {
|
||||
for (size_t endPos = startPos; endPos < sourceSize; ++endPos) {
|
||||
AddChartLabel(startPos, endPos, staticData.GetInputDefaultNonTerminal(), factorOrder);
|
||||
NonTerminalSet &list = GetLabelSet(startPos, endPos);
|
||||
if (list.size() == 0 || !staticData.GetDefaultNonTermOnlyForEmptyRange()) {
|
||||
AddChartLabel(startPos, endPos, staticData.GetInputDefaultNonTerminal(), factorOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user