From 6ddaff1341e565dd91dca7ea763d0ea4d897f4c7 Mon Sep 17 00:00:00 2001 From: redpony Date: Thu, 26 Aug 2010 21:49:45 +0000 Subject: some experimental stuff git-svn-id: https://ws10smt.googlecode.com/svn/trunk@625 ec762483-ff6d-05da-a07a-a48fb63a330f --- extools/sentence_pair.cc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'extools/sentence_pair.cc') diff --git a/extools/sentence_pair.cc b/extools/sentence_pair.cc index 55609db4..d5ebe48f 100644 --- a/extools/sentence_pair.cc +++ b/extools/sentence_pair.cc @@ -117,6 +117,14 @@ int AnnotatedParallelSentence::ReadAlignmentPoint(const char* buf, return ch; } +void AnnotatedParallelSentence::Align(const short a, const short b) { + aligned(a,b) = true; + ++f_aligned[a]; + ++e_aligned[b]; + aligns_by_fword[a].push_back(make_pair(a,b)); + // cerr << a << " " << b << endl; +} + void AnnotatedParallelSentence::ParseAlignmentPoint(const char* buf, int start, int end) { short a, b; ReadAlignmentPoint(buf, start, end, false, &a, &b, 0, 0); @@ -124,11 +132,7 @@ void AnnotatedParallelSentence::ParseAlignmentPoint(const char* buf, int start, cerr << "(" << a << ',' << b << ") is out of bounds. INPUT=\n" << buf << endl; exit(1); } - aligned(a,b) = true; - ++f_aligned[a]; - ++e_aligned[b]; - aligns_by_fword[a].push_back(make_pair(a,b)); - // cerr << a << " " << b << endl; + Align(a,b); } void AnnotatedParallelSentence::ParseSpanLabel(const char* buf, int start, int end) { @@ -191,12 +195,5 @@ void AnnotatedParallelSentence::ParseInputLine(const char* buf) { default: cerr << "Can't happen\n"; abort(); } } - if (state < 2) { - cerr << "Not enough fields: " << buf << endl; - abort(); - } - if (e.empty() || f.empty()) { - cerr << "Sentences must not be empty: " << buf << endl; - } } -- cgit v1.2.3