From dad1bd6127115cda89158c4c8fcf35cc4451218c Mon Sep 17 00:00:00 2001 From: MosesAdmin Date: Thu, 12 Nov 2015 00:00:40 +0000 Subject: [PATCH] daily automatic beautifier --- misc/queryLexicalTable.cpp | 8 ++++---- moses-cmd/LatticeMBRGrid.cpp | 2 +- moses/ChartHypothesis.cpp | 2 +- moses/ChartManager.cpp | 4 ++-- moses/ChartTranslationOptions.cpp | 2 +- moses/Hypothesis.cpp | 12 ++++++------ moses/Parameter.cpp | 22 +++++++++++----------- moses/Parameter.h | 4 ++-- moses/Phrase.cpp | 6 +++--- moses/Phrase.h | 10 +++++----- moses/Sentence.cpp | 2 +- moses/StaticData.h | 8 ++++---- moses/Syntax/KBestExtractor.cpp | 2 +- moses/Syntax/SHyperedge.cpp | 2 +- moses/TranslationOptionCollection.cpp | 4 ++-- moses/TreeInput.cpp | 8 ++++---- moses/TreeInput.h | 8 ++++---- moses/TrellisPath.cpp | 4 ++-- moses/TrellisPath.h | 4 ++-- moses/XmlOption.cpp | 14 +++++++------- moses/XmlOption.h | 8 ++++---- 21 files changed, 68 insertions(+), 68 deletions(-) diff --git a/misc/queryLexicalTable.cpp b/misc/queryLexicalTable.cpp index 09c4e4b7d..b23718720 100644 --- a/misc/queryLexicalTable.cpp +++ b/misc/queryLexicalTable.cpp @@ -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; diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp index 4d283e559..638f31fc6 100644 --- a/moses-cmd/LatticeMBRGrid.cpp +++ b/moses-cmd/LatticeMBRGrid.cpp @@ -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; } } diff --git a/moses/ChartHypothesis.cpp b/moses/ChartHypothesis.cpp index e4d0ae1a4..9143be715 100644 --- a/moses/ChartHypothesis.cpp +++ b/moses/ChartHypothesis.cpp @@ -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()) { diff --git a/moses/ChartManager.cpp b/moses/ChartManager.cpp index 47e1409f3..e4704fe79 100644 --- a/moses/ChartManager.cpp +++ b/moses/ChartManager.cpp @@ -853,8 +853,8 @@ void ChartManager::OutputBestHypo(OutputCollector *collector, const ChartHypothe outPhrase.RemoveWord(0); outPhrase.RemoveWord(outPhrase.GetSize() - 1); - const std::vector outputFactorOrder - = StaticData::Instance().GetOutputFactorOrder(); + const std::vector outputFactorOrder + = StaticData::Instance().GetOutputFactorOrder(); string output = outPhrase.GetStringRep(outputFactorOrder); out << output << endl; } else { diff --git a/moses/ChartTranslationOptions.cpp b/moses/ChartTranslationOptions.cpp index 07202063b..fefad3680 100644 --- a/moses/ChartTranslationOptions.cpp +++ b/moses/ChartTranslationOptions.cpp @@ -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; diff --git a/moses/Hypothesis.cpp b/moses/Hypothesis.cpp index 19bd541f6..78d14f8a1 100644 --- a/moses/Hypothesis.cpp +++ b/moses/Hypothesis.cpp @@ -347,8 +347,8 @@ std::string Hypothesis:: GetTargetPhraseStringRep(const vector 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 placeholders; if (placeholderFactor != NOT_FOUND) { // creates map of target position -> factor for placeholders diff --git a/moses/Parameter.cpp b/moses/Parameter.cpp index 8ab5d7ad2..8d634ee39 100644 --- a/moses/Parameter.cpp +++ b/moses/Parameter.cpp @@ -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++) { diff --git a/moses/Parameter.h b/moses/Parameter.h index 32065885b..c78ddfa1c 100644 --- a/moses/Parameter.h +++ b/moses/Parameter.h @@ -58,8 +58,8 @@ protected: std::map > 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 const& fileExtension=std::vector(1,"")); bool isOption(const char* token); diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index b9776179e..6480b41e9 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -114,9 +114,9 @@ Phrase Phrase::GetSubString(const Range &range, FactorType factorType) const return retPhrase; } -std::string +std::string Phrase:: -GetStringRep(vector const& factorsToPrint, +GetStringRep(vector const& factorsToPrint, AllOptions const* opts) const { if (!opts) opts = &StaticData::Instance().options(); @@ -133,7 +133,7 @@ GetStringRep(vector const& factorsToPrint, } return strme.str(); } - + Word &Phrase::AddWord() { m_words.push_back(Word()); diff --git a/moses/Phrase.h b/moses/Phrase.h index 4842def97..6a3434420 100644 --- a/moses/Phrase.h +++ b/moses/Phrase.h @@ -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 const& factorsToPrint, + //! return a string rep of the phrase; + // w/ factors delimited by FactorDelimiter + std::string + GetStringRep(std::vector const& factorsToPrint, AllOptions const* opts=NULL) const; - + TO_STRING(); diff --git a/moses/Sentence.cpp b/moses/Sentence.cpp index 04deb6a8b..0ba6a2012 100644 --- a/moses/Sentence.cpp +++ b/moses/Sentence.cpp @@ -320,7 +320,7 @@ void Sentence::GetXmlTranslationOptions(std::vector &list, } } -std::vector +std::vector Sentence:: GetXmlChartTranslationOptions(AllOptions const& opts) const { diff --git a/moses/StaticData.h b/moses/StaticData.h index 8c018b377..cd5f59700 100644 --- a/moses/StaticData.h +++ b/moses/StaticData.h @@ -160,9 +160,9 @@ protected: //! load decoding steps void LoadDecodeGraphs(); - void LoadDecodeGraphsOld(const std::vector &mappingVector, + void LoadDecodeGraphsOld(const std::vector &mappingVector, const std::vector &maxChartSpans); - void LoadDecodeGraphsNew(const std::vector &mappingVector, + void LoadDecodeGraphsNew(const std::vector &mappingVector, const std::vector &maxChartSpans); void NoCache(); @@ -245,11 +245,11 @@ public: const std::vector &GetInputFactorOrder() const { return m_options.input.factor_order; } - + const std::vector &GetOutputFactorOrder() const { return m_options.output.factor_order; } - + inline bool GetSourceStartPosMattersForRecombination() const { return m_sourceStartPosMattersForRecombination; } diff --git a/moses/Syntax/KBestExtractor.cpp b/moses/Syntax/KBestExtractor.cpp index 84e9d5e44..b5b4be44d 100644 --- a/moses/Syntax/KBestExtractor.cpp +++ b/moses/Syntax/KBestExtractor.cpp @@ -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); diff --git a/moses/Syntax/SHyperedge.cpp b/moses/Syntax/SHyperedge.cpp index 75dab7b39..976b0f0e3 100644 --- a/moses/Syntax/SHyperedge.cpp +++ b/moses/Syntax/SHyperedge.cpp @@ -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 = diff --git a/moses/TranslationOptionCollection.cpp b/moses/TranslationOptionCollection.cpp index 99835ce74..302b5ba81 100644 --- a/moses/TranslationOptionCollection.cpp +++ b/moses/TranslationOptionCollection.cpp @@ -447,8 +447,8 @@ CreateTranslationOptionsForRange vector::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); } } diff --git a/moses/TreeInput.cpp b/moses/TreeInput.cpp index cbbdb0d45..b6ee0253a 100644 --- a/moses/TreeInput.cpp +++ b/moses/TreeInput.cpp @@ -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 &sourceLabels, - std::vector &xmlOptions) +ProcessAndStripXMLTags(AllOptions const& opts, string &line, + std::vector &sourceLabels, + std::vector &xmlOptions) { //parse XML markup in translation line diff --git a/moses/TreeInput.h b/moses/TreeInput.h index 3bc5f171c..35b683e8c 100644 --- a/moses/TreeInput.h +++ b/moses/TreeInput.h @@ -43,10 +43,10 @@ protected: return m_sourceChart[startPos][endPos - startPos]; } - bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line, - std::vector &sourceLabels, - std::vector &res); - + bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line, + std::vector &sourceLabels, + std::vector &res); + public: TreeInput() : Sentence() { } diff --git a/moses/TrellisPath.cpp b/moses/TrellisPath.cpp index 86fab4d30..20c7f5338 100644 --- a/moses/TrellisPath.cpp +++ b/moses/TrellisPath.cpp @@ -208,8 +208,8 @@ Phrase TrellisPath::GetTargetPhrase() const Phrase TrellisPath::GetSurfacePhrase() const { - const std::vector &outputFactor - = manager().options().output.factor_order; + const std::vector &outputFactor + = manager().options().output.factor_order; // = StaticData::Instance().GetOutputFactorOrder(); Phrase targetPhrase = GetTargetPhrase(); Phrase ret(targetPhrase.GetSize()); diff --git a/moses/TrellisPath.h b/moses/TrellisPath.h index 3367d932d..5a92d54e0 100644 --- a/moses/TrellisPath.h +++ b/moses/TrellisPath.h @@ -47,7 +47,7 @@ class TrellisPath protected: std::vector 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(); } diff --git a/moses/XmlOption.cpp b/moses/XmlOption.cpp index f79ec32d6..31756bc0e 100644 --- a/moses/XmlOption.cpp +++ b/moses/XmlOption.cpp @@ -158,13 +158,13 @@ vector 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 &res, - ReorderingConstraint &reorderingConstraint, - vector< size_t > &walls, - std::vector< std::pair > &placeholders, - int offset, const std::string& lbrackStr, - const std::string& rbrackStr) +bool +ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector &res, + ReorderingConstraint &reorderingConstraint, + vector< size_t > &walls, + std::vector< std::pair > &placeholders, + int offset, const std::string& lbrackStr, + const std::string& rbrackStr) { //parse XML markup in translation line diff --git a/moses/XmlOption.h b/moses/XmlOption.h index f9365eb29..9ddc7d2f2 100644 --- a/moses/XmlOption.h +++ b/moses/XmlOption.h @@ -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 TokenizeXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">"); - - bool ProcessAndStripXMLTags(AllOptions const& opts, - std::string &line, std::vector &res, - ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls, + +bool ProcessAndStripXMLTags(AllOptions const& opts, + std::string &line, std::vector &res, + ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls, std::vector< std::pair > &placeholders, int offset, const std::string& lbrackStr="<", const std::string& rbrackStr=">");