summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2009-12-06 23:14:43 -0500
committerChris Dyer <redpony@gmail.com>2009-12-06 23:14:43 -0500
commit0485712e2ccf98efe50f97963438df53af76964c (patch)
treed89b8c0cbecf1ef066911df6563cf271876aeb03
parent2a18010e255810cc2b5bcbe688f3db8eabda23ca (diff)
minor fixes, better logging
-rw-r--r--src/ff_csplit.cc2
-rw-r--r--src/hg_io.cc10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ff_csplit.cc b/src/ff_csplit.cc
index 5d8dfefb..e24d7d1d 100644
--- a/src/ff_csplit.cc
+++ b/src/ff_csplit.cc
@@ -165,7 +165,7 @@ struct ReverseCharLMCSplitFeatureImpl {
}
// cerr << " END sp=" << sp << endl;
sc[sp] = Vocab_None;
- const double startprob = -ngram_.wordProb(kEOS, sc);
+ const double startprob = ngram_.wordProb(kEOS, sc);
// cerr << " PROB=" << startprob << endl;
return startprob;
}
diff --git a/src/hg_io.cc b/src/hg_io.cc
index 629e65f1..beb96aa6 100644
--- a/src/hg_io.cc
+++ b/src/hg_io.cc
@@ -409,6 +409,10 @@ float getFloat(const std::string& in, int &c)
tmp += get(in,c++);
}
eatws(in,c);
+ if (tmp.empty()) {
+ cerr << "Syntax error while reading number! col=" << c << endl;
+ abort();
+ }
return atof(tmp.c_str());
}
@@ -432,7 +436,7 @@ void ReadPLFEdge(const std::string& in, int &c, int cur_node, Hypergraph* hg) {
vector<WordID> ewords(2, 0);
ewords[1] = TD::Convert(getEscapedString(in,c));
TRulePtr r(new TRule(ewords));
- //cerr << "RULE: " << r->AsString() << endl;
+ // cerr << "RULE: " << r->AsString() << endl;
if (get(in,c++) != ',') { assert(!"PCN/PLF parse error: expected , after string\n"); }
size_t cnNext = 1;
std::vector<float> probs;
@@ -441,12 +445,14 @@ void ReadPLFEdge(const std::string& in, int &c, int cur_node, Hypergraph* hg) {
c++;
float val = getFloat(in,c);
probs.push_back(val);
+ // cerr << val << endl; //REMO
}
//if we read more than one prob, this was a lattice, last item was column increment
if (probs.size()>1) {
cnNext = static_cast<size_t>(probs.back());
probs.pop_back();
- if (cnNext < 1) { assert(!"PCN/PLF parse error: bad link length at last element of cn alt block\n"); }
+ if (cnNext < 1) { cerr << cnNext << endl;
+ assert(!"PCN/PLF parse error: bad link length at last element of cn alt block\n"); }
}
if (get(in,c++) != ')') { assert(!"PCN/PLF parse error: expected ) at end of cn alt block\n"); }
eatws(in,c);