diff options
author | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-05-13 13:05:43 +0300 |
---|---|---|
committer | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-05-13 13:05:43 +0300 |
commit | 0859e9a844cc23ff04b09b4ac3d580da9197d1a1 (patch) | |
tree | 413793a630870bca4d27077d3193786ce9a1dee7 | |
parent | 87e1f1351fdebc8d65d3ebe6ee726dccc765006e (diff) |
Remove trailing whitespace from C++ files.
-rw-r--r-- | moses/BaseManager.cpp | 16 | ||||
-rw-r--r-- | moses/ChartManager.cpp | 2 | ||||
-rw-r--r-- | moses/ExportInterface.cpp | 2 | ||||
-rw-r--r-- | moses/HypergraphOutput.cpp | 16 | ||||
-rw-r--r-- | moses/IOWrapper.cpp | 22 | ||||
-rw-r--r-- | moses/Manager.cpp | 4 | ||||
-rw-r--r-- | moses/Parameter.cpp | 4 | ||||
-rw-r--r-- | moses/TranslationModel/UG/mmsapt.cpp | 2 | ||||
-rw-r--r-- | moses/TranslationTask.cpp | 2 | ||||
-rw-r--r-- | moses/parameters/ContextParameters.cpp | 14 |
10 files changed, 42 insertions, 42 deletions
diff --git a/moses/BaseManager.cpp b/moses/BaseManager.cpp index 70bacdede..291b813f0 100644 --- a/moses/BaseManager.cpp +++ b/moses/BaseManager.cpp @@ -36,7 +36,7 @@ OutputSearchGraphAsHypergraph(std::ostream& out) const UTIL_THROW2("Not implemented."); } -void +void BaseManager:: OutputSearchGraphAsHypergraph(std::string const& fname, size_t const precision) const { @@ -44,12 +44,12 @@ OutputSearchGraphAsHypergraph(std::string const& fname, size_t const precision) if (! boost::filesystem::exists(odir)) boost::filesystem::create_directory(odir); UTIL_THROW_IF2(!boost::filesystem::is_directory(odir), - "Cannot output hypergraphs to " << odir + "Cannot output hypergraphs to " << odir << " because that path exists but is not a directory."); - // not clear why we need to output the weights every time we dump a search + // not clear why we need to output the weights every time we dump a search // graph into a file again, but that's what the old code did. - + string weightsFile = odir + "/weights"; TRACE_ERR("The weights file is " << weightsFile << "\n"); ofstream weightsOut; @@ -60,23 +60,23 @@ OutputSearchGraphAsHypergraph(std::string const& fname, size_t const precision) // (or the translation task) StaticData::Instance().GetAllWeights().Save(weightsOut); weightsOut.close(); - + boost::iostreams::filtering_ostream file; if (boost::ends_with(fname, ".gz")) file.push(boost::iostreams::gzip_compressor()); else if (boost::ends_with(fname, ".bz2")) file.push( boost::iostreams::bzip2_compressor() ); file.push( boost::iostreams::file_sink(fname, ios_base::out) ); - if (file.is_complete() && file.good()) + if (file.is_complete() && file.good()) { file.setf(std::ios::fixed); file.precision(precision); this->OutputSearchGraphAsHypergraph(file); file.flush(); } - else + else { - TRACE_ERR("Cannot output hypergraph for line " + TRACE_ERR("Cannot output hypergraph for line " << this->GetSource().GetTranslationId() << " because the output file " << fname << " is not open or not ready for writing" diff --git a/moses/ChartManager.cpp b/moses/ChartManager.cpp index 9170b2a7c..d59b68cc8 100644 --- a/moses/ChartManager.cpp +++ b/moses/ChartManager.cpp @@ -291,7 +291,7 @@ void ChartManager::FindReachableHypotheses( } } -void +void ChartManager:: OutputSearchGraphAsHypergraph(std::ostream& out) const { diff --git a/moses/ExportInterface.cpp b/moses/ExportInterface.cpp index 790196edd..0ceeceec1 100644 --- a/moses/ExportInterface.cpp +++ b/moses/ExportInterface.cpp @@ -228,7 +228,7 @@ batch_run() // set up task of translating one sentence boost::shared_ptr<TranslationTask> task = TranslationTask::create(source, ioWrapper); - if (source->GetContext()) + if (source->GetContext()) task->SetContextString(*source->GetContext()); else task->SetContextString(context_string); diff --git a/moses/HypergraphOutput.cpp b/moses/HypergraphOutput.cpp index 412f92578..470d35ba2 100644 --- a/moses/HypergraphOutput.cpp +++ b/moses/HypergraphOutput.cpp @@ -47,9 +47,9 @@ namespace Moses template class HypergraphOutput<Manager>; template class HypergraphOutput<ChartManager>; -void +void ChartSearchGraphWriterMoses:: -WriteHypos(const ChartHypothesisCollection& hypos, +WriteHypos(const ChartHypothesisCollection& hypos, const map<unsigned, bool> &reachable) const { @@ -62,20 +62,20 @@ WriteHypos(const ChartHypothesisCollection& hypos, } const ChartArcList *arcList = mainHypo.GetArcList(); - if (arcList) + if (arcList) { ChartArcList::const_iterator iterArc; - for (iterArc = arcList->begin(); iterArc != arcList->end(); ++iterArc) + for (iterArc = arcList->begin(); iterArc != arcList->end(); ++iterArc) { const ChartHypothesis &arc = **iterArc; - if (reachable.find(arc.GetId()) != reachable.end()) + if (reachable.find(arc.GetId()) != reachable.end()) (*m_out) << m_lineNumber << " " << arc << endl; } } } } -void +void ChartSearchGraphWriterHypergraph:: WriteHeader(size_t winners, size_t losers) const { @@ -83,7 +83,7 @@ WriteHeader(size_t winners, size_t losers) const (*m_out) << winners << " " << (winners+losers) << endl; } -void +void ChartSearchGraphWriterHypergraph:: WriteHypos(const ChartHypothesisCollection& hypos, const map<unsigned, bool> &reachable) const @@ -113,7 +113,7 @@ WriteHypos(const ChartHypothesisCollection& hypos, } } (*m_out) << edges.size() << endl; - for (vector<const ChartHypothesis*>::const_iterator ei = edges.begin(); + for (vector<const ChartHypothesis*>::const_iterator ei = edges.begin(); ei != edges.end(); ++ei) { const ChartHypothesis* hypo = *ei; const TargetPhrase& target = hypo->GetCurrTargetPhrase(); diff --git a/moses/IOWrapper.cpp b/moses/IOWrapper.cpp index 3e7b916ca..1e93d868d 100644 --- a/moses/IOWrapper.cpp +++ b/moses/IOWrapper.cpp @@ -97,12 +97,12 @@ IOWrapper::IOWrapper() // context buffering for context-sensitive decoding m_look_ahead = staticData.GetContextParameters().look_ahead; m_look_back = staticData.GetContextParameters().look_back; - + m_inputType = staticData.GetInputType(); UTIL_THROW_IF2((m_look_ahead || m_look_back) && m_inputType != SentenceInput, "Context-sensitive decoding currently works only with sentence input."); - + m_currentLine = staticData.GetStartTranslationId(); m_inputFactorOrder = &staticData.GetInputFactorOrder(); @@ -223,7 +223,7 @@ IOWrapper::IOWrapper() std::string& fmt = m_hypergraph_output_filepattern; // first, determine the output directory if (p && p->size() > 2) fmt = p->at(2); - else if (nBestFilePath.size() && nBestFilePath != "-" && + else if (nBestFilePath.size() && nBestFilePath != "-" && ! boost::starts_with(nBestFilePath, "/dev/stdout")) { fmt = boost::filesystem::path(nBestFilePath).parent_path().string(); @@ -233,7 +233,7 @@ IOWrapper::IOWrapper() if (*fmt.rbegin() != '/') fmt += "/"; std::string extension = (p && p->size() > 1 ? p->at(1) : std::string("txt")); UTIL_THROW_IF2(extension != "txt" && extension != "gz" && extension != "bz2", - "Unknown compression type '" << extension + "Unknown compression type '" << extension << "' for hypergraph output!"); fmt += string("%d.") + extension; @@ -278,10 +278,10 @@ IOWrapper:: GetBufferedInput() { switch(m_inputType) { - case SentenceInput: - return BufferInput<Sentence>(); - case ConfusionNetworkInput: - return BufferInput<ConfusionNet>(); + case SentenceInput: + return BufferInput<Sentence>(); + case ConfusionNetworkInput: + return BufferInput<ConfusionNet>(); case WordLatticeInput: return BufferInput<WordLattice>(); case TreeInputType: @@ -294,7 +294,7 @@ GetBufferedInput() TRACE_ERR("Unknown input type: " << m_inputType << "\n"); return boost::shared_ptr<InputType>(); } - + } boost::shared_ptr<InputType> @@ -304,7 +304,7 @@ IOWrapper::ReadInput() boost::lock_guard<boost::mutex> lock(m_lock); #endif boost::shared_ptr<InputType> source = GetBufferedInput(); - if (source) + if (source) { source->SetTranslationId(m_currentLine++); this->set_context_for(*source); @@ -313,7 +313,7 @@ IOWrapper::ReadInput() return source; } -void +void IOWrapper:: set_context_for(InputType& source) { diff --git a/moses/Manager.cpp b/moses/Manager.cpp index 9d56d4cfa..7580b4e6e 100644 --- a/moses/Manager.cpp +++ b/moses/Manager.cpp @@ -1982,10 +1982,10 @@ void Manager::OutputSearchGraphSLF() const // static char const* key = "output-search-graph-hypergraph"; // PARAM_VEC const* p = staticData.GetParameter().GetParam(key); // ScoreComponentCollection const& weights = staticData.GetAllWeights(); -// string const& nBestFile = staticData.GetNBestFilePath(); +// string const& nBestFile = staticData.GetNBestFilePath(); // HypergraphOutput<Manager> hypergraphOutput(PRECISION, p, nBestFile, weights); // hypergraphOutput.Write(*this); - + // } void Manager::OutputLatticeMBRNBest(std::ostream& out, const vector<LatticeMBRSolution>& solutions,long translationId) const diff --git a/moses/Parameter.cpp b/moses/Parameter.cpp index 2f04e90d3..599d70938 100644 --- a/moses/Parameter.cpp +++ b/moses/Parameter.cpp @@ -240,9 +240,9 @@ Parameter::Parameter() AddParam(misc_opts,"feature-name-overwrite", "Override feature name (NOT arguments). Eg. SRILM-->KENLM, PhraseDictionaryMemory-->PhraseDictionaryScope3"); AddParam(misc_opts,"feature", "All the feature functions should be here"); - AddParam(misc_opts,"context-string", + AddParam(misc_opts,"context-string", "A (tokenized) string containing context words for context-sensitive translation."); - AddParam(misc_opts,"context-window", + AddParam(misc_opts,"context-window", "Context window (in words) for context-sensitive translation: {+|-|+-}<number>."); // Compact phrase table and reordering table. diff --git a/moses/TranslationModel/UG/mmsapt.cpp b/moses/TranslationModel/UG/mmsapt.cpp index 2b11da968..7eac93b38 100644 --- a/moses/TranslationModel/UG/mmsapt.cpp +++ b/moses/TranslationModel/UG/mmsapt.cpp @@ -217,7 +217,7 @@ namespace Moses m_bias_log = &std::cerr; else if (m_bias_logfile == "/dev/stdout") m_bias_log = &std::cout; - else + else { m_bias_logger.reset(new ofstream(m_bias_logfile.c_str())); m_bias_log = m_bias_logger.get(); diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp index 0b425ef23..190bb0b7e 100644 --- a/moses/TranslationTask.cpp +++ b/moses/TranslationTask.cpp @@ -178,7 +178,7 @@ void TranslationTask::Run() // Output search graph in hypergraph format for Kenneth Heafield's // lazy hypergraph decoder; writes to stderr - if (StaticData::Instance().GetOutputSearchGraphHypergraph()) + if (StaticData::Instance().GetOutputSearchGraphHypergraph()) { size_t transId = manager->GetSource().GetTranslationId(); string fname = io->GetHypergraphOutputFileName(transId); diff --git a/moses/parameters/ContextParameters.cpp b/moses/parameters/ContextParameters.cpp index 541fd344e..b88945878 100644 --- a/moses/parameters/ContextParameters.cpp +++ b/moses/parameters/ContextParameters.cpp @@ -17,27 +17,27 @@ init(Parameter& params) std::string context_window; params.SetParameter(context_window, "context-window", std::string("")); - if (context_window == "") + if (context_window == "") return; size_t p = context_window.find_first_of("0123456789"); - if (p == 0) + if (p == 0) look_back = look_ahead = atoi(context_window.c_str()); - if (p == 1) + if (p == 1) { - if (context_window[0] == '-') + if (context_window[0] == '-') look_back = atoi(context_window.substr(1).c_str()); - else if (context_window[0] == '+') + else if (context_window[0] == '+') look_ahead = atoi(context_window.substr(1).c_str()); else UTIL_THROW2("Invalid specification of context window."); } - if (p == 2) + if (p == 2) { if (context_window.substr(0,2) == "+-" || context_window.substr(0,2) == "-+") look_back = look_ahead = atoi(context_window.substr(p).c_str()); - else + else UTIL_THROW2("Invalid specification of context window."); } } |