add decoder arg -no-cache for mira tuning

This commit is contained in:
Hieu Hoang 2013-11-21 11:52:20 +00:00
parent 0f3f675698
commit 749bd7fc8f
3 changed files with 21 additions and 0 deletions

View File

@ -200,6 +200,9 @@ Parameter::Parameter()
AddParam("alternate-weight-setting", "aws", "alternate set of weights to used per xml specification");
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)");
}
Parameter::~Parameter()

View File

@ -522,6 +522,7 @@ bool StaticData::LoadData(Parameter *parameter)
m_registry.Construct(feature, line);
}
NoCache();
OverrideFeatures();
LoadFeatureFunctions();
@ -1053,6 +1054,20 @@ bool StaticData::LoadAlternateWeightSettings()
return true;
}
void StaticData::NoCache()
{
bool noCache;
SetBooleanParameter( &noCache, "no-cache", false );
if (noCache) {
const std::vector<PhraseDictionary*> &pts = PhraseDictionary::GetColl();
for (size_t i = 0; i < pts.size(); ++i) {
PhraseDictionary &pt = *pts[i];
pt.SetParameter("cache-size", "0");
}
}
}
void StaticData::OverrideFeatures()
{
const PARAM_VEC &params = m_parameter->GetParam("feature-overwrite");
@ -1092,5 +1107,6 @@ void StaticData::CheckLEGACYPT()
m_useLegacyPT = false;
}
} // namespace

View File

@ -216,6 +216,8 @@ protected:
//! load decoding steps
bool LoadDecodeGraphs();
void NoCache();
bool m_continuePartialTranslation;
std::string m_binPath;