mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 15:00:33 +03:00
daily automatic beautifier
This commit is contained in:
parent
858a509d53
commit
dad1bd6127
@ -110,11 +110,11 @@ int main(int argc, char** argv)
|
||||
std::cerr << "Caching for f\n";
|
||||
table->InitializeForInputPhrase(f);
|
||||
}
|
||||
|
||||
|
||||
std::cerr << "Querying: "
|
||||
<< "f='" << f.GetStringRep(f_mask) <<"' "
|
||||
<< "e='" << e.GetStringRep(e_mask) << "' "
|
||||
<< "c='" << c.GetStringRep(c_mask) << "'\n";
|
||||
<< "f='" << f.GetStringRep(f_mask) <<"' "
|
||||
<< "e='" << e.GetStringRep(e_mask) << "' "
|
||||
<< "c='" << c.GetStringRep(c_mask) << "'\n";
|
||||
std::cerr << table->GetScore(f,e,c) << "\n";
|
||||
//table->DbgDump(&std::cerr);
|
||||
delete table;
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
if (!consumed) {
|
||||
// newargv[newargc] = new char[strlen(argv[i]) + 1];
|
||||
// strcpy(newargv[newargc],argv[i]);
|
||||
newargv[newargc] = argv[i];
|
||||
newargv[newargc] = argv[i];
|
||||
++newargc;
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ ChartHypothesis::~ChartHypothesis()
|
||||
void ChartHypothesis::GetOutputPhrase(Phrase &outPhrase) const
|
||||
{
|
||||
FactorType placeholderFactor = StaticData::Instance().options().input.placeholder_factor;
|
||||
|
||||
|
||||
for (size_t pos = 0; pos < GetCurrTargetPhrase().GetSize(); ++pos) {
|
||||
const Word &word = GetCurrTargetPhrase().GetWord(pos);
|
||||
if (word.IsNonTerminal()) {
|
||||
|
@ -853,8 +853,8 @@ void ChartManager::OutputBestHypo(OutputCollector *collector, const ChartHypothe
|
||||
outPhrase.RemoveWord(0);
|
||||
outPhrase.RemoveWord(outPhrase.GetSize() - 1);
|
||||
|
||||
const std::vector<FactorType> outputFactorOrder
|
||||
= StaticData::Instance().GetOutputFactorOrder();
|
||||
const std::vector<FactorType> outputFactorOrder
|
||||
= StaticData::Instance().GetOutputFactorOrder();
|
||||
string output = outPhrase.GetStringRep(outputFactorOrder);
|
||||
out << output << endl;
|
||||
} else {
|
||||
|
@ -71,7 +71,7 @@ void ChartTranslationOptions::EvaluateWithSourceContext(const InputType &input,
|
||||
if (inputPath.ttask.lock()->options().input.placeholder_factor != NOT_FOUND) {
|
||||
CreateSourceRuleFromInputPath();
|
||||
}
|
||||
|
||||
|
||||
CollType::iterator iter;
|
||||
for (iter = m_collection.begin(); iter != m_collection.end(); ++iter) {
|
||||
ChartTranslationOption &transOpt = **iter;
|
||||
|
@ -347,8 +347,8 @@ std::string
|
||||
Hypothesis::
|
||||
GetTargetPhraseStringRep(const vector<FactorType> factorsToPrint) const
|
||||
{
|
||||
return (m_prevHypo
|
||||
? GetCurrTargetPhrase().GetStringRep(factorsToPrint)
|
||||
return (m_prevHypo
|
||||
? GetCurrTargetPhrase().GetStringRep(factorsToPrint)
|
||||
: "");
|
||||
}
|
||||
|
||||
@ -471,14 +471,14 @@ OutputSurface(std::ostream &out, const Hypothesis &edge,
|
||||
UTIL_THROW_IF2(outputFactorOrder.size() == 0,
|
||||
"Must specific at least 1 output factor");
|
||||
const TargetPhrase& phrase = edge.GetCurrTargetPhrase();
|
||||
bool markUnknown = GetManager().options().unk.mark;
|
||||
bool markUnknown = GetManager().options().unk.mark;
|
||||
// = StaticData::Instance().GetMarkUnknown();
|
||||
if (reportAllFactors == true) {
|
||||
out << phrase;
|
||||
} else {
|
||||
FactorType placeholderFactor
|
||||
= StaticData::Instance().options().input.placeholder_factor;
|
||||
|
||||
FactorType placeholderFactor
|
||||
= StaticData::Instance().options().input.placeholder_factor;
|
||||
|
||||
std::map<size_t, const Factor*> placeholders;
|
||||
if (placeholderFactor != NOT_FOUND) {
|
||||
// creates map of target position -> factor for placeholders
|
||||
|
@ -218,16 +218,16 @@ Parameter::Parameter()
|
||||
AddParam(server_opts,"server-log", "Log destination for moses server");
|
||||
AddParam(server_opts,"serial", "Run server in serial mode, processing only one request at a time.");
|
||||
|
||||
AddParam(server_opts,"server-maxconn",
|
||||
"Max. No of simultaneous HTTP transactions allowed by the server.");
|
||||
AddParam(server_opts,"server-maxconn",
|
||||
"Max. No of simultaneous HTTP transactions allowed by the server.");
|
||||
AddParam(server_opts,"server-maxconn-backlog",
|
||||
"Max. No. of requests the OS will queue if the server is busy.");
|
||||
AddParam(server_opts,"server-keepalive-maxconn",
|
||||
"Max. No. of requests the server will accept on a single TCP connection.");
|
||||
AddParam(server_opts,"server-keepalive-timeout",
|
||||
"Max. number of seconds the server will keep a persistent connection alive.");
|
||||
AddParam(server_opts,"server-timeout",
|
||||
"Max. number of seconds the server will wait for a client to submit a request once a connection has been established.");
|
||||
"Max. No. of requests the OS will queue if the server is busy.");
|
||||
AddParam(server_opts,"server-keepalive-maxconn",
|
||||
"Max. No. of requests the server will accept on a single TCP connection.");
|
||||
AddParam(server_opts,"server-keepalive-timeout",
|
||||
"Max. number of seconds the server will keep a persistent connection alive.");
|
||||
AddParam(server_opts,"server-timeout",
|
||||
"Max. number of seconds the server will wait for a client to submit a request once a connection has been established.");
|
||||
|
||||
// session timeout and session cache size are for moses translation session handling
|
||||
// they have nothing to do with the abyss server (but relate to the moses server)
|
||||
@ -1352,8 +1352,8 @@ FindParam(const string ¶mSwitch, int argc, char const* argv[])
|
||||
* \param argv values of paramters on command line */
|
||||
void
|
||||
Parameter::
|
||||
OverwriteParam(const string ¶mSwitch, const string ¶mName,
|
||||
int argc, char const* argv[])
|
||||
OverwriteParam(const string ¶mSwitch, const string ¶mName,
|
||||
int argc, char const* argv[])
|
||||
{
|
||||
int startPos = -1;
|
||||
for (int i = 0 ; i < argc ; i++) {
|
||||
|
@ -58,8 +58,8 @@ protected:
|
||||
std::map<std::string, std::vector<float> > m_weights;
|
||||
|
||||
std::string FindParam(const std::string ¶mSwitch, int argc, char const* argv[]);
|
||||
void OverwriteParam(const std::string ¶mSwitch, const std::string ¶mName,
|
||||
int argc, char const* argv[]);
|
||||
void OverwriteParam(const std::string ¶mSwitch, const std::string ¶mName,
|
||||
int argc, char const* argv[]);
|
||||
bool ReadConfigFile(const std::string &filePath );
|
||||
bool FilesExist(const std::string ¶mName, int fieldNo, std::vector<std::string> const& fileExtension=std::vector<std::string>(1,""));
|
||||
bool isOption(const char* token);
|
||||
|
@ -114,9 +114,9 @@ Phrase Phrase::GetSubString(const Range &range, FactorType factorType) const
|
||||
return retPhrase;
|
||||
}
|
||||
|
||||
std::string
|
||||
std::string
|
||||
Phrase::
|
||||
GetStringRep(vector<FactorType> const& factorsToPrint,
|
||||
GetStringRep(vector<FactorType> const& factorsToPrint,
|
||||
AllOptions const* opts) const
|
||||
{
|
||||
if (!opts) opts = &StaticData::Instance().options();
|
||||
@ -133,7 +133,7 @@ GetStringRep(vector<FactorType> const& factorsToPrint,
|
||||
}
|
||||
return strme.str();
|
||||
}
|
||||
|
||||
|
||||
Word &Phrase::AddWord()
|
||||
{
|
||||
m_words.push_back(Word());
|
||||
|
@ -201,12 +201,12 @@ public:
|
||||
Phrase GetSubString(const Range &range) const;
|
||||
Phrase GetSubString(const Range &range, FactorType factorType) const;
|
||||
|
||||
//! return a string rep of the phrase;
|
||||
// w/ factors delimited by FactorDelimiter
|
||||
std::string
|
||||
GetStringRep(std::vector<FactorType> const& factorsToPrint,
|
||||
//! return a string rep of the phrase;
|
||||
// w/ factors delimited by FactorDelimiter
|
||||
std::string
|
||||
GetStringRep(std::vector<FactorType> const& factorsToPrint,
|
||||
AllOptions const* opts=NULL) const;
|
||||
|
||||
|
||||
TO_STRING();
|
||||
|
||||
|
||||
|
@ -320,7 +320,7 @@ void Sentence::GetXmlTranslationOptions(std::vector <TranslationOption*> &list,
|
||||
}
|
||||
}
|
||||
|
||||
std::vector <ChartTranslationOptions*>
|
||||
std::vector <ChartTranslationOptions*>
|
||||
Sentence::
|
||||
GetXmlChartTranslationOptions(AllOptions const& opts) const
|
||||
{
|
||||
|
@ -160,9 +160,9 @@ protected:
|
||||
|
||||
//! load decoding steps
|
||||
void LoadDecodeGraphs();
|
||||
void LoadDecodeGraphsOld(const std::vector<std::string> &mappingVector,
|
||||
void LoadDecodeGraphsOld(const std::vector<std::string> &mappingVector,
|
||||
const std::vector<size_t> &maxChartSpans);
|
||||
void LoadDecodeGraphsNew(const std::vector<std::string> &mappingVector,
|
||||
void LoadDecodeGraphsNew(const std::vector<std::string> &mappingVector,
|
||||
const std::vector<size_t> &maxChartSpans);
|
||||
|
||||
void NoCache();
|
||||
@ -245,11 +245,11 @@ public:
|
||||
const std::vector<FactorType> &GetInputFactorOrder() const {
|
||||
return m_options.input.factor_order;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<FactorType> &GetOutputFactorOrder() const {
|
||||
return m_options.output.factor_order;
|
||||
}
|
||||
|
||||
|
||||
inline bool GetSourceStartPosMattersForRecombination() const {
|
||||
return m_sourceStartPosMattersForRecombination;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void KBestExtractor::Extract(
|
||||
Phrase KBestExtractor::GetOutputPhrase(const Derivation &d)
|
||||
{
|
||||
FactorType placeholderFactor = StaticData::Instance().options().input.placeholder_factor;
|
||||
|
||||
|
||||
Phrase ret(ARRAY_SIZE_INCR);
|
||||
|
||||
const TargetPhrase &phrase = *(d.edge->shyperedge.label.translation);
|
||||
|
@ -12,7 +12,7 @@ namespace Syntax
|
||||
Phrase GetOneBestTargetYield(const SHyperedge &h)
|
||||
{
|
||||
FactorType placeholderFactor = StaticData::Instance().options().input.placeholder_factor;
|
||||
|
||||
|
||||
Phrase ret(ARRAY_SIZE_INCR);
|
||||
|
||||
const AlignmentInfo::NonTermIndexMap &targetToSourceMap =
|
||||
|
@ -447,8 +447,8 @@ CreateTranslationOptionsForRange
|
||||
vector<TranslationOption*>::const_iterator c;
|
||||
for (c = partTransOptList.begin() ; c != partTransOptList.end() ; ++c) {
|
||||
TranslationOption *transOpt = *c;
|
||||
if (xml_policy != XmlConstraint ||
|
||||
!ViolatesXmlOptionsConstraint(sPos,ePos,transOpt)) {
|
||||
if (xml_policy != XmlConstraint ||
|
||||
!ViolatesXmlOptionsConstraint(sPos,ePos,transOpt)) {
|
||||
Add(transOpt);
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ namespace Moses
|
||||
* \param reorderingConstraint reordering constraint zones specified by xml
|
||||
* \param walls reordering constraint walls specified by xml
|
||||
*/
|
||||
bool
|
||||
bool
|
||||
TreeInput::
|
||||
ProcessAndStripXMLTags(AllOptions const& opts, string &line,
|
||||
std::vector<XMLParseOutput> &sourceLabels,
|
||||
std::vector<XmlOption*> &xmlOptions)
|
||||
ProcessAndStripXMLTags(AllOptions const& opts, string &line,
|
||||
std::vector<XMLParseOutput> &sourceLabels,
|
||||
std::vector<XmlOption*> &xmlOptions)
|
||||
{
|
||||
//parse XML markup in translation line
|
||||
|
||||
|
@ -43,10 +43,10 @@ protected:
|
||||
return m_sourceChart[startPos][endPos - startPos];
|
||||
}
|
||||
|
||||
bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line,
|
||||
std::vector<XMLParseOutput> &sourceLabels,
|
||||
std::vector<XmlOption*> &res);
|
||||
|
||||
bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line,
|
||||
std::vector<XMLParseOutput> &sourceLabels,
|
||||
std::vector<XmlOption*> &res);
|
||||
|
||||
public:
|
||||
TreeInput() : Sentence() { }
|
||||
|
||||
|
@ -208,8 +208,8 @@ Phrase TrellisPath::GetTargetPhrase() const
|
||||
|
||||
Phrase TrellisPath::GetSurfacePhrase() const
|
||||
{
|
||||
const std::vector<FactorType> &outputFactor
|
||||
= manager().options().output.factor_order;
|
||||
const std::vector<FactorType> &outputFactor
|
||||
= manager().options().output.factor_order;
|
||||
// = StaticData::Instance().GetOutputFactorOrder();
|
||||
Phrase targetPhrase = GetTargetPhrase();
|
||||
Phrase ret(targetPhrase.GetSize());
|
||||
|
@ -47,7 +47,7 @@ class TrellisPath
|
||||
|
||||
protected:
|
||||
std::vector<const Hypothesis *> m_path; //< list of hypotheses/arcs
|
||||
size_t m_prevEdgeChanged;
|
||||
size_t m_prevEdgeChanged;
|
||||
/**< the last node that was wiggled to create this path
|
||||
, or NOT_FOUND if this path is the best trans so consist of only hypos
|
||||
*/
|
||||
@ -60,7 +60,7 @@ protected:
|
||||
|
||||
void InitTotalScore();
|
||||
|
||||
Manager const& manager() const {
|
||||
Manager const& manager() const {
|
||||
UTIL_THROW_IF2(m_path.size() == 0, "zero-length trellis path");
|
||||
return m_path[0]->GetManager();
|
||||
}
|
||||
|
@ -158,13 +158,13 @@ vector<string> TokenizeXml(const string& str, const std::string& lbrackStr, cons
|
||||
* \param lbrackStr xml tag's left bracket string, typically "<"
|
||||
* \param rbrackStr xml tag's right bracket string, typically ">"
|
||||
*/
|
||||
bool
|
||||
ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption*> &res,
|
||||
ReorderingConstraint &reorderingConstraint,
|
||||
vector< size_t > &walls,
|
||||
std::vector< std::pair<size_t, std::string> > &placeholders,
|
||||
int offset, const std::string& lbrackStr,
|
||||
const std::string& rbrackStr)
|
||||
bool
|
||||
ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption*> &res,
|
||||
ReorderingConstraint &reorderingConstraint,
|
||||
vector< size_t > &walls,
|
||||
std::vector< std::pair<size_t, std::string> > &placeholders,
|
||||
int offset, const std::string& lbrackStr,
|
||||
const std::string& rbrackStr)
|
||||
{
|
||||
//parse XML markup in translation line
|
||||
|
||||
|
@ -29,10 +29,10 @@ std::string ParseXmlTagAttribute(const std::string& tag,const std::string& attri
|
||||
std::string TrimXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">") ;
|
||||
bool isXmlTag(const std::string& tag, const std::string& lbrackStr="<", const std::string& rbrackStr=">");
|
||||
std::vector<std::string> TokenizeXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">");
|
||||
|
||||
bool ProcessAndStripXMLTags(AllOptions const& opts,
|
||||
std::string &line, std::vector<XmlOption*> &res,
|
||||
ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls,
|
||||
|
||||
bool ProcessAndStripXMLTags(AllOptions const& opts,
|
||||
std::string &line, std::vector<XmlOption*> &res,
|
||||
ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls,
|
||||
std::vector< std::pair<size_t, std::string> > &placeholders,
|
||||
int offset,
|
||||
const std::string& lbrackStr="<", const std::string& rbrackStr=">");
|
||||
|
Loading…
Reference in New Issue
Block a user