diff --git a/moses/ChartParser.cpp b/moses/ChartParser.cpp index 242536607..b81360f6e 100644 --- a/moses/ChartParser.cpp +++ b/moses/ChartParser.cpp @@ -47,21 +47,21 @@ ChartParserUnknown::~ChartParserUnknown() // RemoveAllInColl(m_cacheTargetPhraseCollection); } -AllOptions::ptr const& +AllOptions::ptr const& ChartParserUnknown:: -options() const -{ - return m_ttask.lock()->options(); -} +options() const +{ + return m_ttask.lock()->options(); +} -void +void ChartParserUnknown:: Process(const Word &sourceWord, const Range &range, ChartParserCallback &to) { // unknown word, add as trans opt const StaticData &staticData = StaticData::Instance(); - const UnknownWordPenaltyProducer &unknownWordPenaltyProducer - = UnknownWordPenaltyProducer::Instance(); + const UnknownWordPenaltyProducer &unknownWordPenaltyProducer + = UnknownWordPenaltyProducer::Instance(); size_t isDigit = 0; if (options()->unk.drop) { @@ -101,8 +101,8 @@ Process(const Word &sourceWord, const Range &range, ChartParserCallback &to) //const Word &sourceLHS = staticData.GetInputDefaultNonTerminal(); Word *targetLHS = new Word(true); - targetLHS->CreateFromString(Output, options()->output.factor_order, - targetLHSStr, true); + targetLHS->CreateFromString(Output, options()->output.factor_order, + targetLHSStr, true); UTIL_THROW_IF2(targetLHS->GetFactor(0) == NULL, "Null factor for target LHS"); // add to dictionary @@ -142,8 +142,8 @@ Process(const Word &sourceWord, const Range &range, ChartParserCallback &to) //float prob = iterLHS->second; Word *targetLHS = new Word(true); - targetLHS->CreateFromString(Output, staticData.options().output.factor_order, - targetLHSStr, true); + targetLHS->CreateFromString(Output, staticData.options().output.factor_order, + targetLHSStr, true); UTIL_THROW_IF2(targetLHS->GetFactor(0) == NULL, "Null factor for target LHS"); targetPhrase->GetScoreBreakdown().Assign(&unknownWordPenaltyProducer, unknownScore); @@ -300,12 +300,12 @@ long ChartParser::GetTranslationId() const } -AllOptions::ptr const& +AllOptions::ptr const& ChartParser:: -options() const -{ - return m_ttask.lock()->options(); -} +options() const +{ + return m_ttask.lock()->options(); +} } // namespace Moses diff --git a/moses/ChartParser.h b/moses/ChartParser.h index 3229e296b..b9d756abb 100644 --- a/moses/ChartParser.h +++ b/moses/ChartParser.h @@ -57,7 +57,7 @@ public: private: std::vector m_unksrcs; std::list m_cacheTargetPhraseCollection; - AllOptions::ptr const& options() const; + AllOptions::ptr const& options() const; }; class ChartParser @@ -79,7 +79,7 @@ public: return m_unknown.GetUnknownSources(); } - AllOptions::ptr const& options() const; + AllOptions::ptr const& options() const; private: ChartParserUnknown m_unknown; diff --git a/moses/ConfusionNet.h b/moses/ConfusionNet.h index f16493b23..4d15f37b6 100644 --- a/moses/ConfusionNet.h +++ b/moses/ConfusionNet.h @@ -46,8 +46,8 @@ public: const Column& GetColumn(size_t i) const { UTIL_THROW_IF2(i >= data.size(), - "Out of bounds. Trying to access " << i - << " when vector only contains " << data.size()); + "Out of bounds. Trying to access " << i + << " when vector only contains " << data.size()); return data[i]; } const Column& operator[](size_t i) const { diff --git a/moses/FF/SoftSourceSyntacticConstraintsFeature.cpp b/moses/FF/SoftSourceSyntacticConstraintsFeature.cpp index 6f954ef18..6d59c03b1 100644 --- a/moses/FF/SoftSourceSyntacticConstraintsFeature.cpp +++ b/moses/FF/SoftSourceSyntacticConstraintsFeature.cpp @@ -569,8 +569,8 @@ void SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext(const Inpu } if ( treeInputLabelsLHS.size() == 0 ) { scoreBreakdown.PlusEquals(this, - "LHSPAIR_" + targetLHS->GetString().as_string() + "_" - + m_output_default_nonterminal[0]->GetString().as_string(), + "LHSPAIR_" + targetLHS->GetString().as_string() + "_" + + m_output_default_nonterminal[0]->GetString().as_string(), 1); if (!m_targetSourceLHSJointCountFile.empty()) { t2sLabelsScore = TransformScore(m_floor); diff --git a/moses/FF/SourceGHKMTreeInputMatchFeature.cpp b/moses/FF/SourceGHKMTreeInputMatchFeature.cpp index eececa8f8..7561c5ef2 100644 --- a/moses/FF/SourceGHKMTreeInputMatchFeature.cpp +++ b/moses/FF/SourceGHKMTreeInputMatchFeature.cpp @@ -48,10 +48,10 @@ void SourceGHKMTreeInputMatchFeature::EvaluateWithSourceContext(const InputType const StaticData& staticData = StaticData::Instance(); - std::vector newScores(m_numScoreComponents,0.0); + std::vector newScores(m_numScoreComponents,0.0); // m_numScoreComponents == 2 // first fires for matches, second for mismatches - if ( (treeInputLabels.find(lhsLabel) != treeInputLabels.end()) + if ( (treeInputLabels.find(lhsLabel) != treeInputLabels.end()) && (lhsLabel != m_output_default_nonterminal) ) { // match newScores[0] = 1.0; diff --git a/moses/ForestInput.cpp b/moses/ForestInput.cpp index 108012518..68fec17ed 100644 --- a/moses/ForestInput.cpp +++ b/moses/ForestInput.cpp @@ -68,7 +68,7 @@ Read(std::istream &in) assert(topVertices.size() >= 1); } - + const std::vector& factorOrder = m_options->input.factor_order; // Add vertex. @@ -175,7 +175,7 @@ void ForestInput::FindTopVertices(Forest &forest, std::back_inserter(topVertices)); } -void +void ForestInput:: ParseHyperedgeLine(const std::string &line) { diff --git a/moses/HypothesisStackNormal.cpp b/moses/HypothesisStackNormal.cpp index 76ddd3e84..d2ccdb52f 100644 --- a/moses/HypothesisStackNormal.cpp +++ b/moses/HypothesisStackNormal.cpp @@ -74,13 +74,12 @@ pair HypothesisStackNormal::Add(Hypothesi // prune only if stack is twice as big as needed (lazy pruning) size_t toleratedSize = 2*m_maxHypoStackSize-1; // add in room for stack diversity - if (m_minHypoStackDiversity) - { - // so what happens if maxdistortion is negative? - toleratedSize += m_minHypoStackDiversity - << m_manager.options()->reordering.max_distortion; - } - + if (m_minHypoStackDiversity) { + // so what happens if maxdistortion is negative? + toleratedSize += m_minHypoStackDiversity + << m_manager.options()->reordering.max_distortion; + } + if (m_hypos.size() > toleratedSize) { PruneToSize(m_maxHypoStackSize); } else { diff --git a/moses/InputType.cpp b/moses/InputType.cpp index a47c03ff7..53033d1d3 100644 --- a/moses/InputType.cpp +++ b/moses/InputType.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA namespace Moses { - InputType::InputType(AllOptions::ptr const& opts, long translationId) +InputType::InputType(AllOptions::ptr const& opts, long translationId) : m_options(opts) , m_translationId(translationId) { diff --git a/moses/InputType.h b/moses/InputType.h index 1e40c158e..80080a3f2 100644 --- a/moses/InputType.h +++ b/moses/InputType.h @@ -190,10 +190,10 @@ public: //! populate this InputType with data from in stream virtual int - Read(std::istream& in) = 0; - // , - // std::vector const& factorOrder, - // AllOptions const& opts) =0; + Read(std::istream& in) = 0; + // , + // std::vector const& factorOrder, + // AllOptions const& opts) =0; //! Output debugging info to stream out virtual void Print(std::ostream&) const =0; diff --git a/moses/MockHypothesis.cpp b/moses/MockHypothesis.cpp index 226e791dc..78c53c667 100644 --- a/moses/MockHypothesis.cpp +++ b/moses/MockHypothesis.cpp @@ -64,8 +64,8 @@ MockHypothesisGuard m_targetPhrases.back().CreateFromString(Input, factors, *ti, NULL); m_toptions.push_back(new TranslationOption (range,m_targetPhrases.back())); - m_hypothesis = new Hypothesis(*prevHypo, *m_toptions.back(), newBitmap, - m_manager->GetNextHypoId()); + m_hypothesis = new Hypothesis(*prevHypo, *m_toptions.back(), newBitmap, + m_manager->GetNextHypoId()); } diff --git a/moses/Sentence.cpp b/moses/Sentence.cpp index 4faeb3889..c9c69b648 100644 --- a/moses/Sentence.cpp +++ b/moses/Sentence.cpp @@ -151,11 +151,11 @@ aux_interpret_xml(std::string& line, std::vector & xmlWalls, // parse XML markup in translation line using namespace std; if (m_options->input.xml_policy != XmlPassThrough) { - bool OK = ProcessAndStripXMLTags(*m_options, line, - m_xmlOptions, + bool OK = ProcessAndStripXMLTags(*m_options, line, + m_xmlOptions, m_reorderingConstraint, xmlWalls, placeholders); - UTIL_THROW_IF2(!OK, "Unable to parse XML in line: " << line); + UTIL_THROW_IF2(!OK, "Unable to parse XML in line: " << line); } } @@ -170,7 +170,7 @@ init(string line) if (m_options->input.continue_partial_translation) aux_init_partial_translation(line); - + line = Trim(line); aux_interpret_sgml_markup(line); // for " const& FOrder, string const& phraseString) } Sentence:: -Sentence(AllOptions::ptr const& opts, size_t const transId, string stext) +Sentence(AllOptions::ptr const& opts, size_t const transId, string stext) : InputType(opts, transId) { init(stext); diff --git a/moses/Sentence.h b/moses/Sentence.h index 219307218..c2a846762 100644 --- a/moses/Sentence.h +++ b/moses/Sentence.h @@ -115,7 +115,7 @@ public: } - void init(std::string line); + void init(std::string line); std::vector > const& GetDltMeta() const { diff --git a/moses/Syntax/F2S/GlueRuleSynthesizer.h b/moses/Syntax/F2S/GlueRuleSynthesizer.h index b4128c5d7..a07c111b0 100644 --- a/moses/Syntax/F2S/GlueRuleSynthesizer.h +++ b/moses/Syntax/F2S/GlueRuleSynthesizer.h @@ -9,7 +9,7 @@ namespace Moses { - class AllOptions; +class AllOptions; namespace Syntax { namespace F2S @@ -20,8 +20,8 @@ class GlueRuleSynthesizer : public HyperTreeCreator Word m_input_default_nonterminal; Word m_output_default_nonterminal; public: - GlueRuleSynthesizer(Moses::AllOptions const& opts, HyperTree &); - + GlueRuleSynthesizer(Moses::AllOptions const& opts, HyperTree &); + // Synthesize the minimal, monotone rule that can be applied to the given // hyperedge and add it to the rule trie. void SynthesizeRule(const Forest::Hyperedge &); diff --git a/moses/Syntax/T2S/GlueRuleSynthesizer.cpp b/moses/Syntax/T2S/GlueRuleSynthesizer.cpp index 04b5da4e7..6f3082654 100644 --- a/moses/Syntax/T2S/GlueRuleSynthesizer.cpp +++ b/moses/Syntax/T2S/GlueRuleSynthesizer.cpp @@ -12,7 +12,7 @@ namespace Syntax namespace T2S { -void +void GlueRuleSynthesizer:: SynthesizeRule(const InputTree::Node &node) { diff --git a/moses/Syntax/T2S/GlueRuleSynthesizer.h b/moses/Syntax/T2S/GlueRuleSynthesizer.h index 3d9e4f8f9..3930db8c4 100644 --- a/moses/Syntax/T2S/GlueRuleSynthesizer.h +++ b/moses/Syntax/T2S/GlueRuleSynthesizer.h @@ -18,11 +18,11 @@ class GlueRuleSynthesizer : public RuleTrieCreator { Word m_output_default_nonterminal; public: - GlueRuleSynthesizer(RuleTrie &trie, Word dflt_nonterm) + GlueRuleSynthesizer(RuleTrie &trie, Word dflt_nonterm) : m_ruleTrie(trie) , m_output_default_nonterminal(dflt_nonterm) {} - + // Synthesize the minimal, montone rule that can be applied to the given node // and add it to the rule trie. void SynthesizeRule(const InputTree::Node &); diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp index 470d99f60..75df7443b 100644 --- a/moses/TranslationTask.cpp +++ b/moses/TranslationTask.cpp @@ -77,7 +77,7 @@ TranslationTask boost::shared_ptr const& ioWrapper) : m_source(source) , m_ioWrapper(ioWrapper) { - m_options = source->options(); + m_options = source->options(); } TranslationTask::~TranslationTask() @@ -104,7 +104,7 @@ TranslationTask else if (algo == SyntaxS2T) { // new-style string-to-tree decoding (ask Phil Williams) - S2TParsingAlgorithm algorithm = m_options->syntax.s2t_parsing_algo; + S2TParsingAlgorithm algorithm = m_options->syntax.s2t_parsing_algo; if (algorithm == RecursiveCYKPlus) { typedef Syntax::S2T::EagerParserCallback Callback; typedef Syntax::S2T::RecursiveCYKPlusParser Parser; diff --git a/moses/TreeInput.cpp b/moses/TreeInput.cpp index 1c898ea51..445511ed9 100644 --- a/moses/TreeInput.cpp +++ b/moses/TreeInput.cpp @@ -245,7 +245,7 @@ Read(std::istream& in) string line; if (getline(in, line, '\n').eof()) return 0; - + m_labelledSpans.clear(); ProcessAndStripXMLTags(*m_options, line, m_labelledSpans, m_xmlOptions); @@ -253,7 +253,7 @@ Read(std::istream& in) stringstream strme; strme << line << endl; - Sentence::Read(strme); + Sentence::Read(strme); // size input chart size_t sourceSize = GetSize(); @@ -265,7 +265,7 @@ Read(std::istream& in) // do source labels vector::const_iterator iterLabel; - for (iterLabel = m_labelledSpans.begin(); + for (iterLabel = m_labelledSpans.begin(); iterLabel != m_labelledSpans.end(); ++iterLabel) { const XMLParseOutput &labelItem = *iterLabel; const Range &range = labelItem.m_range; @@ -279,7 +279,7 @@ Read(std::istream& in) for (size_t endPos = startPos; endPos < sourceSize; ++endPos) { NonTerminalSet &list = GetLabelSet(startPos, endPos); if (list.size() == 0 || ! only4empty ) { - AddChartLabel(startPos, endPos, m_options->syntax.input_default_non_terminal); + AddChartLabel(startPos, endPos, m_options->syntax.input_default_non_terminal); } } } @@ -300,7 +300,7 @@ TranslationOptionCollection* TreeInput::CreateTranslationOptionCollection() cons return NULL; } -void +void TreeInput:: AddChartLabel(size_t startPos, size_t endPos, const Word &label) { @@ -324,14 +324,14 @@ AddChartLabel(size_t startPos, size_t endPos, const Word &label) } } -void +void TreeInput:: AddChartLabel(size_t startPos, size_t endPos, const string &label) { const std::vector& fOrder = m_options->input.factor_order; Word word(true); - const Factor *factor - = FactorCollection::Instance().AddFactor(Input, fOrder[0], label, true); + const Factor *factor + = FactorCollection::Instance().AddFactor(Input, fOrder[0], label, true); // TODO - no factors word.SetFactor(0, factor); AddChartLabel(startPos, endPos, word); diff --git a/moses/XmlOption.cpp b/moses/XmlOption.cpp index da1339b95..8a517386f 100644 --- a/moses/XmlOption.cpp +++ b/moses/XmlOption.cpp @@ -159,7 +159,7 @@ vector TokenizeXml(const string& str, const std::string& lbrackStr, cons * \param rbrackStr xml tag's right bracket string, typically ">" */ bool -ProcessAndStripXMLTags(AllOptions const& opts, string &line, +ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector &res, ReorderingConstraint &reorderingConstraint, vector< size_t > &walls, diff --git a/moses/XmlOption.h b/moses/XmlOption.h index d5f399763..00bebc2e6 100644 --- a/moses/XmlOption.h +++ b/moses/XmlOption.h @@ -32,8 +32,8 @@ std::vector TokenizeXml(const std::string& str, const std::string& bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line, std::vector &res, - ReorderingConstraint &reorderingConstraint, - std::vector< size_t > &walls, + ReorderingConstraint &reorderingConstraint, + std::vector< size_t > &walls, std::vector< std::pair > &placeholders); diff --git a/phrase-extract/ExtractedRule.h b/phrase-extract/ExtractedRule.h index 2eeed1d30..adbde43e8 100644 --- a/phrase-extract/ExtractedRule.h +++ b/phrase-extract/ExtractedRule.h @@ -70,7 +70,7 @@ public: , startS(sS) , endS(eS) , count(0) - , pcfgScore(0.0) + , pcfgScore(0.0) , l2rOrientation(PhraseOrientation::REO_CLASS_UNKNOWN) , r2lOrientation(PhraseOrientation::REO_CLASS_UNKNOWN) { } diff --git a/phrase-extract/extract-rules-main.cpp b/phrase-extract/extract-rules-main.cpp index 3dc3210c0..62dbbbf0e 100644 --- a/phrase-extract/extract-rules-main.cpp +++ b/phrase-extract/extract-rules-main.cpp @@ -1210,7 +1210,8 @@ void collectWordLabelCounts( SentenceAlignmentWithSyntax &sentence ) } } -void writeUnknownWordLabel(const string & fileName) { +void writeUnknownWordLabel(const string & fileName) +{ ofstream outFile; outFile.open(fileName.c_str()); typedef map::const_iterator I; @@ -1234,7 +1235,7 @@ void writeUnknownWordLabel(const string & fileName) { outFile.close(); } -void writePhraseOrientationPriors(const string &fileName) +void writePhraseOrientationPriors(const string &fileName) { ofstream outFile; outFile.open(fileName.c_str());