summaryrefslogtreecommitdiff
path: root/extools
diff options
context:
space:
mode:
Diffstat (limited to 'extools')
-rw-r--r--extools/mr_stripe_rule_reduce.cc1
-rw-r--r--extools/sentence_pair.cc6
2 files changed, 5 insertions, 2 deletions
diff --git a/extools/mr_stripe_rule_reduce.cc b/extools/mr_stripe_rule_reduce.cc
index eaf1b6d7..902b6a07 100644
--- a/extools/mr_stripe_rule_reduce.cc
+++ b/extools/mr_stripe_rule_reduce.cc
@@ -73,6 +73,7 @@ int ReadPhraseUntilDividerOrEnd(const char* buf, const int sstart, const int end
if (w == kDIV) return ptr;
p->push_back(w);
}
+ assert(p->size() > 0);
return ptr;
}
diff --git a/extools/sentence_pair.cc b/extools/sentence_pair.cc
index 91286059..5706398f 100644
--- a/extools/sentence_pair.cc
+++ b/extools/sentence_pair.cc
@@ -84,8 +84,10 @@ int AnnotatedParallelSentence::ReadAlignmentPoint(const char* buf,
void AnnotatedParallelSentence::ParseAlignmentPoint(const char* buf, int start, int end) {
short a, b;
ReadAlignmentPoint(buf, start, end, false, &a, &b);
- assert(a < f_len);
- assert(b < e_len);
+ if (a >= f_len || b >= e_len) {
+ cerr << "(" << a << ',' << b << ") is out of bounds. INPUT=\n" << buf << endl;
+ exit(1);
+ }
aligned(a,b) = true;
++f_aligned[a];
++e_aligned[b];