From be50bb319568ce93dbfd6ac9e7f5ca9e5009e7e1 Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Wed, 19 Feb 2014 23:33:10 +0000 Subject: [PATCH] output rules --- .../ConsistentPhrases.cpp | 20 +++++++++++++++---- .../extract-mixed-syntax/ConsistentPhrases.h | 2 ++ .../extract-mixed-syntax/Rule.cpp | 6 ++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.cpp b/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.cpp index adbb54be6..ebc2fb0b4 100644 --- a/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.cpp +++ b/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.cpp @@ -9,6 +9,13 @@ using namespace std; +void PhrasePairRange::Debug(std::ostream &out) const +{ + out << "[" << sourceTarget.first.first << "-" << sourceTarget.first.second << "][" + << sourceTarget.second.first << "-" << sourceTarget.second.second << "]"; +} + +////////////////////////////////////////////////////////////////////// ConsistentPhrases::ConsistentPhrases() { // TODO Auto-generated constructor stub @@ -51,10 +58,15 @@ const ConsistentPhrase *ConsistentPhrases::Find( void ConsistentPhrases::Debug(std::ostream &out) const { out << "m_rangeToColl=" << m_rangeToColl.size() - << " m_coll=" << m_coll.size() <Debug(out); out << endl; } } diff --git a/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.h b/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.h index e1f5065ff..9803f8181 100644 --- a/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.h +++ b/contrib/other-builds/extract-mixed-syntax/ConsistentPhrases.h @@ -28,6 +28,8 @@ struct PhrasePairRange } + void Debug(std::ostream &out) const; + inline bool operator<(const PhrasePairRange &other) const { return sourceTarget < other.sourceTarget; } diff --git a/contrib/other-builds/extract-mixed-syntax/Rule.cpp b/contrib/other-builds/extract-mixed-syntax/Rule.cpp index 79f8cacac..12947ba65 100644 --- a/contrib/other-builds/extract-mixed-syntax/Rule.cpp +++ b/contrib/other-builds/extract-mixed-syntax/Rule.cpp @@ -65,6 +65,8 @@ void Rule::Fillout(const ConsistentPhrases &consistentPhrases, const ConsistentRange &targetRange = sourceRange->GetOtherRange(); if (lastTargetRange.Overlap(targetRange)) { + cerr << "NOT VALID1"; + Debug(cerr); m_isValid = false; m_canExtend = false; return; @@ -92,6 +94,8 @@ void Rule::Fillout(const ConsistentPhrases &consistentPhrases, m_consistentPhrase = consistentPhrases.Find(sourceStart, sourceEnd, targetStart, targetEnd); if (m_consistentPhrase == NULL) { + cerr << "NOT VALID2"; + Debug(cerr); m_isValid = false; return; } @@ -110,6 +114,8 @@ void Rule::Fillout(const ConsistentPhrases &consistentPhrases, } if (targetNonTerms.size() > params.maxNonTerm) { + cerr << "NOT VALID3"; + Debug(cerr); m_isValid = false; return; }