mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
Small changes to Parameters and StaticData
This commit is contained in:
parent
46596ed49a
commit
8137aeae43
@ -171,6 +171,32 @@ int main(int argc, char** argv)
|
||||
|
||||
// execute task
|
||||
#ifdef WITH_THREADS
|
||||
#ifdef PT_UG
|
||||
/*
|
||||
bool spe = params.isParamSpecified("spe-src");
|
||||
if (spe) {
|
||||
// simulated post-editing: always run single-threaded!
|
||||
task->Run();
|
||||
delete task;
|
||||
string src,trg,aln;
|
||||
UTIL_THROW_IF2(!getline(ioWrapper->spe_src,src), "[" << HERE << "] "
|
||||
<< "missing update data for simulated post-editing.");
|
||||
UTIL_THROW_IF2(!getline(ioWrapper->spe_trg,trg), "[" << HERE << "] "
|
||||
<< "missing update data for simulated post-editing.");
|
||||
UTIL_THROW_IF2(!getline(ioWrapper->spe_aln,aln), "[" << HERE << "] "
|
||||
<< "missing update data for simulated post-editing.");
|
||||
BOOST_FOREACH (PhraseDictionary* pd, PhraseDictionary::GetColl())
|
||||
{
|
||||
Mmsapt* sapt = dynamic_cast<Mmsapt*>(pd);
|
||||
if (sapt) sapt->add(src,trg,aln);
|
||||
VERBOSE(1,"[" << HERE << " added src] " << src << endl);
|
||||
VERBOSE(1,"[" << HERE << " added trg] " << trg << endl);
|
||||
VERBOSE(1,"[" << HERE << " added aln] " << aln << endl);
|
||||
}
|
||||
}
|
||||
else
|
||||
*/
|
||||
#endif
|
||||
pool.Submit(task);
|
||||
#else
|
||||
task->Run();
|
||||
|
@ -98,6 +98,10 @@ IOWrapper::IOWrapper(const std::vector<FactorType> &inputFactorOrder
|
||||
,m_detailTreeFragmentsOutputCollector(NULL)
|
||||
|
||||
,m_surpressSingleBestOutput(false)
|
||||
|
||||
,spe_src(NULL)
|
||||
,spe_trg(NULL)
|
||||
,spe_aln(NULL)
|
||||
{
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
|
||||
@ -202,6 +206,16 @@ IOWrapper::IOWrapper(const std::vector<FactorType> &inputFactorOrder
|
||||
m_singleBestOutputCollector = new Moses::OutputCollector(&std::cout);
|
||||
}
|
||||
|
||||
/*
|
||||
const Parameter ¶ms = staticData.GetParameter();
|
||||
bool spe = params.isParamSpecified("spe-src");
|
||||
if (spe) {
|
||||
spe_src->open(params.GetParam("spe-src")[0]);
|
||||
spe_trg->open(params.GetParam("spe-trg")[0]);
|
||||
spe_aln->open(params.GetParam("spe-aln")[0]);
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
IOWrapper::~IOWrapper()
|
||||
|
@ -268,6 +268,9 @@ public:
|
||||
// creates a map of TARGET positions which should be replaced by word using placeholder
|
||||
std::map<size_t, const Moses::Factor*> GetPlaceholders(const Moses::Hypothesis &hypo, Moses::FactorType placeholderFactor);
|
||||
|
||||
// post editing
|
||||
std::ifstream *spe_src, *spe_trg, *spe_aln;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -207,6 +207,10 @@ Parameter::Parameter()
|
||||
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)");
|
||||
AddParam("s2t", "Use specialized string-to-tree decoder.");
|
||||
AddParam("s2t-parsing-algorithm", "Which S2T parsing algorithm to use. 0=recursive CYK+, 1=scope-3 (default = 0)");
|
||||
|
||||
AddParam("spe-src", "Simulated post-editing. Source filename");
|
||||
AddParam("spe-trg", "Simulated post-editing. Target filename");
|
||||
AddParam("spe-aln", "Simulated post-editing. Alignment filename");
|
||||
}
|
||||
|
||||
Parameter::~Parameter()
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
return m_setting[paramName];
|
||||
}
|
||||
/** check if parameter is defined (either in moses.ini or as switch) */
|
||||
bool isParamSpecified(const std::string ¶mName) {
|
||||
bool isParamSpecified(const std::string ¶mName) const {
|
||||
return m_setting.find( paramName ) != m_setting.end();
|
||||
}
|
||||
|
||||
|
@ -268,6 +268,10 @@ public:
|
||||
return m_parameter->GetParam(paramName);
|
||||
}
|
||||
|
||||
const Parameter &GetParameter() const {
|
||||
return *m_parameter;
|
||||
}
|
||||
|
||||
const std::vector<FactorType> &GetInputFactorOrder() const {
|
||||
return m_inputFactorOrder;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user