summaryrefslogtreecommitdiff
path: root/training/model1.cc
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-10-01 20:13:48 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-10-01 20:13:48 +0000
commitde3b20fd379a62f8f381990f4d819a732b57a814 (patch)
treef4ee81303ad8d595224087ff6b753680b354ce88 /training/model1.cc
parent597db20b3b38fd0cbb3e3d9a7105b0c3c5c37e84 (diff)
compute obj, fixes for grammar filter
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@668 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'training/model1.cc')
-rw-r--r--training/model1.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/training/model1.cc b/training/model1.cc
index 92a70985..3e27689f 100644
--- a/training/model1.cc
+++ b/training/model1.cc
@@ -29,8 +29,8 @@ int main(int argc, char** argv) {
double denom = 0.0;
int lc = 0;
bool flag = false;
+ string line;
while(true) {
- string line;
getline(in, line);
if (!in) break;
++lc;
@@ -41,8 +41,11 @@ int main(int argc, char** argv) {
Lattice src, trg;
LatticeTools::ConvertTextToLattice(ssrc, &src);
LatticeTools::ConvertTextToLattice(strg, &trg);
- assert(src.size() > 0);
- assert(trg.size() > 0);
+ if (src.size() == 0 || trg.size() == 0) {
+ cerr << "Error: " << lc << "\n" << line << endl;
+ assert(src.size() > 0);
+ assert(trg.size() > 0);
+ }
denom += 1.0;
vector<double> probs(src.size() + 1);
for (int j = 0; j < trg.size(); ++j) {