mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
Merge ../mosesdecoder into perf_moses2
This commit is contained in:
commit
ade04eb2d8
@ -101,6 +101,11 @@ namespace Moses
|
|||||||
if (!syntax.update(param)) return false;
|
if (!syntax.update(param)) return false;
|
||||||
return sanity_check();
|
return sanity_check();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
AllOptions::
|
||||||
|
update(std::map<std::string,xmlrpc_c::value>const& param)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -72,6 +72,11 @@ namespace Moses
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
CubePruningOptions::
|
||||||
|
update(std::map<std::string,xmlrpc_c::value>const& params)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,6 +95,11 @@ namespace Moses {
|
|||||||
xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
|
xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
InputOptions::
|
||||||
|
update(std::map<std::string,xmlrpc_c::value>const& param)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,11 @@ update(std::map<std::string,xmlrpc_c::value>const& param)
|
|||||||
enabled = (nbest_size > 0);
|
enabled = (nbest_size > 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
NBestOptions::
|
||||||
|
update(std::map<std::string,xmlrpc_c::value>const& param)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +43,11 @@ namespace Moses {
|
|||||||
// xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
|
// xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
OOVHandlingOptions::
|
||||||
|
update(std::map<std::string,xmlrpc_c::value>const& param)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,5 +24,10 @@ namespace Moses {
|
|||||||
if (m == param.end()) return dfltval;
|
if (m == param.end()) return dfltval;
|
||||||
return Scan<bool>(xmlrpc_c::value_string(m->second));
|
return Scan<bool>(xmlrpc_c::value_string(m->second));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
OptionsBaseClass::
|
||||||
|
check(std::map<std::string, xmlrpc_c::value> const& param,
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -128,11 +128,17 @@ namespace Moses {
|
|||||||
for (size_t i = 0; i < MAX_NUM_FACTORS; ++i)
|
for (size_t i = 0; i < MAX_NUM_FACTORS; ++i)
|
||||||
factor_order.push_back(i);
|
factor_order.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m = param.find("no-ReportSegmentation");
|
||||||
|
if (m == param.end() || !Scan<bool>(xmlrpc_c::value_string(m->second))) {
|
||||||
|
|
||||||
|
// If we are reporting alignment info, turn on ReportSegmentation, unless XML request explicitly says not to
|
||||||
|
m = param.find("align");
|
||||||
|
if (m != param.end() && Scan<bool>(xmlrpc_c::value_string(m->second)))
|
||||||
|
ReportSegmentation = 1;
|
||||||
|
|
||||||
m = param.find("align");
|
}
|
||||||
if (m != param.end() && Scan<bool>(xmlrpc_c::value_string(m->second)))
|
|
||||||
ReportSegmentation = 1;
|
|
||||||
|
|
||||||
PrintAlignmentInfo = check(param,"word-align",PrintAlignmentInfo);
|
PrintAlignmentInfo = check(param,"word-align",PrintAlignmentInfo);
|
||||||
|
|
||||||
m = param.find("factor-delimiter");
|
m = param.find("factor-delimiter");
|
||||||
@ -147,5 +153,10 @@ namespace Moses {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
ReportingOptions::
|
||||||
|
update(std::map<std::string, xmlrpc_c::value>const& param)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,11 @@ namespace Moses
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
SearchOptions::
|
||||||
|
update(std::map<std::string,xmlrpc_c::value>const& params)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,11 @@ namespace Moses {
|
|||||||
// xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
|
// xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
SyntaxOptions::
|
||||||
|
update(std::map<std::string,xmlrpc_c::value>const& param)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,13 +85,14 @@ void
|
|||||||
TranslationRequest::
|
TranslationRequest::
|
||||||
add_phrase_aln_info(Hypothesis const& h, vector<xmlrpc_c::value>& aInfo) const
|
add_phrase_aln_info(Hypothesis const& h, vector<xmlrpc_c::value>& aInfo) const
|
||||||
{
|
{
|
||||||
// if (!m_withAlignInfo) return;
|
if (!m_withAlignInfo) return;
|
||||||
if (!options()->output.ReportSegmentation) return;
|
// if (!options()->output.ReportSegmentation) return;
|
||||||
Range const& trg = h.GetCurrTargetWordsRange();
|
Range const& trg = h.GetCurrTargetWordsRange();
|
||||||
Range const& src = h.GetCurrSourceWordsRange();
|
Range const& src = h.GetCurrSourceWordsRange();
|
||||||
|
|
||||||
std::map<std::string, xmlrpc_c::value> pAlnInfo;
|
std::map<std::string, xmlrpc_c::value> pAlnInfo;
|
||||||
pAlnInfo["tgt-start"] = xmlrpc_c::value_int(trg.GetStartPos());
|
pAlnInfo["tgt-start"] = xmlrpc_c::value_int(trg.GetStartPos());
|
||||||
|
pAlnInfo["tgt-end"] = xmlrpc_c::value_int(trg.GetEndPos());
|
||||||
pAlnInfo["src-start"] = xmlrpc_c::value_int(src.GetStartPos());
|
pAlnInfo["src-start"] = xmlrpc_c::value_int(src.GetStartPos());
|
||||||
pAlnInfo["src-end"] = xmlrpc_c::value_int(src.GetEndPos());
|
pAlnInfo["src-end"] = xmlrpc_c::value_int(src.GetEndPos());
|
||||||
aInfo.push_back(xmlrpc_c::value_struct(pAlnInfo));
|
aInfo.push_back(xmlrpc_c::value_struct(pAlnInfo));
|
||||||
@ -356,6 +357,12 @@ parse_request(std::map<std::string, xmlrpc_c::value> const& params)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report alignment info if Moses config says to or if XML request says to
|
||||||
|
m_withAlignInfo = options()->output.ReportSegmentation || check(params, "align");
|
||||||
|
|
||||||
|
// Report word alignment info if Moses config says to or if XML request says to
|
||||||
|
m_withWordAlignInfo = options()->output.PrintAlignmentInfo || check(params, "word-align");
|
||||||
|
|
||||||
si = params.find("weights");
|
si = params.find("weights");
|
||||||
if (si != params.end())
|
if (si != params.end())
|
||||||
{
|
{
|
||||||
@ -465,8 +472,8 @@ pack_hypothesis(const Moses::Manager& manager,
|
|||||||
<< std::endl);
|
<< std::endl);
|
||||||
dest[key] = xmlrpc_c::value_string(target.str());
|
dest[key] = xmlrpc_c::value_string(target.str());
|
||||||
|
|
||||||
// if (m_withAlignInfo) {
|
if (m_withAlignInfo) {
|
||||||
if (options()->output.ReportSegmentation) {
|
// if (options()->output.ReportSegmentation) {
|
||||||
// phrase alignment, if requested
|
// phrase alignment, if requested
|
||||||
|
|
||||||
vector<xmlrpc_c::value> p_aln;
|
vector<xmlrpc_c::value> p_aln;
|
||||||
@ -475,8 +482,8 @@ pack_hypothesis(const Moses::Manager& manager,
|
|||||||
dest["align"] = xmlrpc_c::value_array(p_aln);
|
dest["align"] = xmlrpc_c::value_array(p_aln);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (m_withWordAlignInfo) {
|
if (m_withWordAlignInfo) {
|
||||||
if (options()->output.PrintAlignmentInfo) {
|
//if (options()->output.PrintAlignmentInfo) {
|
||||||
// word alignment, if requested
|
// word alignment, if requested
|
||||||
vector<xmlrpc_c::value> w_aln;
|
vector<xmlrpc_c::value> w_aln;
|
||||||
BOOST_REVERSE_FOREACH(Hypothesis const* e, edges)
|
BOOST_REVERSE_FOREACH(Hypothesis const* e, edges)
|
||||||
|
@ -38,8 +38,8 @@ TranslationRequest : public virtual Moses::TranslationTask
|
|||||||
|
|
||||||
Translator* m_translator;
|
Translator* m_translator;
|
||||||
std::string m_source_string, m_target_string;
|
std::string m_source_string, m_target_string;
|
||||||
// bool m_withAlignInfo;
|
bool m_withAlignInfo;
|
||||||
// bool m_withWordAlignInfo;
|
bool m_withWordAlignInfo;
|
||||||
bool m_withGraphInfo;
|
bool m_withGraphInfo;
|
||||||
bool m_withTopts;
|
bool m_withTopts;
|
||||||
bool m_withScoreBreakdown;
|
bool m_withScoreBreakdown;
|
||||||
|
@ -175,7 +175,7 @@ alias deps : ..//z ..//boost_iostreams ..//boost_filesystem : : : $(max-factors
|
|||||||
$(includes)
|
$(includes)
|
||||||
;
|
;
|
||||||
|
|
||||||
exe moses2 : Main.cpp moses2_lib ../probingpt//probingpt ../util//kenutil ../util//rt ../lm//kenlm ;
|
exe moses2 : Main.cpp moses2_lib ../probingpt//probingpt ../util//kenutil ../lm//kenlm ;
|
||||||
|
|
||||||
if [ xmlrpc ] {
|
if [ xmlrpc ] {
|
||||||
echo "Building Moses2" ;
|
echo "Building Moses2" ;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include "ProbingPT.h"
|
#include "ProbingPT.h"
|
||||||
#include "probingpt/querying.hh"
|
#include "probingpt/querying.h"
|
||||||
#include "probingpt/probing_hash_utils.hh"
|
#include "probingpt/probing_hash_utils.h"
|
||||||
#include "util/exception.hh"
|
#include "util/exception.hh"
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
#include "../Scores.h"
|
#include "../Scores.h"
|
||||||
|
@ -27,6 +27,6 @@ lib probingpt :
|
|||||||
deps
|
deps
|
||||||
;
|
;
|
||||||
|
|
||||||
exe CreateProbingPT : CreateProbingPT.cpp probingpt ../util//kenutil ../util//rt ;
|
exe CreateProbingPT : CreateProbingPT.cpp probingpt ../util//kenutil ;
|
||||||
|
|
||||||
alias programs : CreateProbingPT ;
|
alias programs : CreateProbingPT ;
|
||||||
|
Loading…
Reference in New Issue
Block a user