summaryrefslogtreecommitdiff
path: root/src/hg_io.cc
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 /src/hg_io.cc
parent2a18010e255810cc2b5bcbe688f3db8eabda23ca (diff)
minor fixes, better logging
Diffstat (limited to 'src/hg_io.cc')
-rw-r--r--src/hg_io.cc10
1 files changed, 8 insertions, 2 deletions
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);