summaryrefslogtreecommitdiff
path: root/decoder/bottom_up_parser.cc
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-09-20 18:50:30 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-09-20 18:50:30 +0000
commit46d6e1fd3dbe0bc116a46fdab91b40fe2ecd6803 (patch)
tree9caca4c1878a58b183e214ecf4caa225987bc8e7 /decoder/bottom_up_parser.cc
parentcf36f7d66ad19331da109f5a81ea3ea5844deb1c (diff)
support turning off verbose logging
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@652 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/bottom_up_parser.cc')
-rw-r--r--decoder/bottom_up_parser.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/decoder/bottom_up_parser.cc b/decoder/bottom_up_parser.cc
index 88514b82..2d945222 100644
--- a/decoder/bottom_up_parser.cc
+++ b/decoder/bottom_up_parser.cc
@@ -10,6 +10,7 @@
#include "hg.h"
#include "array2d.h"
#include "tdict.h"
+#include "verbose.h"
using namespace std;
@@ -17,7 +18,7 @@ struct ParserStats {
ParserStats() : active_items(), passive_items() {}
void Reset() { active_items=0; passive_items=0; }
void Report() {
- cerr << " ACTIVE ITEMS: " << active_items << "\tPASSIVE ITEMS: " << passive_items << endl;
+ if (!SILENT) cerr << " ACTIVE ITEMS: " << active_items << "\tPASSIVE ITEMS: " << passive_items << endl;
}
int active_items;
int passive_items;
@@ -172,7 +173,7 @@ PassiveChart::PassiveChart(const string& goal,
for (int i = 0; i < grammars_.size(); ++i)
act_chart_[i] = new ActiveChart(forest, *this);
if (!kGOAL) kGOAL = TD::Convert("Goal") * -1;
- cerr << " Goal category: [" << goal << ']' << endl;
+ if (!SILENT) cerr << " Goal category: [" << goal << ']' << endl;
}
void PassiveChart::ApplyRule(const int i,
@@ -241,9 +242,9 @@ bool PassiveChart::Parse() {
for (int gi = 0; gi < grammars_.size(); ++gi)
act_chart_[gi]->SeedActiveChart(*grammars_[gi]);
- cerr << " ";
+ if (!SILENT) cerr << " ";
for (int l=1; l<input_.size()+1; ++l) {
- cerr << '.';
+ if (!SILENT) cerr << '.';
for (int i=0; i<input_.size() + 1 - l; ++i) {
int j = i + l;
for (int gi = 0; gi < grammars_.size(); ++gi) {
@@ -278,7 +279,7 @@ bool PassiveChart::Parse() {
}
}
}
- cerr << endl;
+ if (!SILENT) cerr << endl;
if (GoalFound())
forest_->PruneUnreachable(forest_->nodes_.size() - 1);