diff options
author | phikoehn <pkoehn@inf.ed.ac.uk> | 2013-04-05 14:26:00 +0400 |
---|---|---|
committer | phikoehn <pkoehn@inf.ed.ac.uk> | 2013-04-05 14:26:00 +0400 |
commit | c016b6e04b9a0c6eddc423b0b839021f00599bbe (patch) | |
tree | 0f3d3bd32fb4d00d5c7d619db2a0d5027549b15f /biconcor/PhrasePair.cpp | |
parent | ac82be3120ac0b143039e2e36dff8b8538bdcb68 (diff) |
extended display options for biconcor
Diffstat (limited to 'biconcor/PhrasePair.cpp')
-rw-r--r-- | biconcor/PhrasePair.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/biconcor/PhrasePair.cpp b/biconcor/PhrasePair.cpp index 9c16be77c..038fa3a31 100644 --- a/biconcor/PhrasePair.cpp +++ b/biconcor/PhrasePair.cpp @@ -8,7 +8,42 @@ using namespace std; -void PhrasePair::Print( ostream* out, int width ) const +void PhrasePair::Print( ostream* out ) const +{ + // source + int sentence_start = m_source_position - m_source_start; + char source_length = m_suffixArray->GetSentenceLength( m_suffixArray->GetSentence( m_source_position ) ); + + for( char i=0; i<source_length; i++ ) { + if (i>0) *out << " "; + *out << m_suffixArray->GetWord( sentence_start + i ); + } + + // target + *out << " |||"; + for( char i=0; i<m_target_length; i++ ) { + *out << " " << m_targetCorpus->GetWord( m_sentence_id, i); + } + + // source span + *out << " ||| " << (int)m_source_start << " " << (int)m_source_end; + + // target span + *out << " ||| " << (int)m_target_start << " " << (int)m_target_end; + + // word alignment + *out << " |||"; + + INDEX ap_points = m_alignment->GetNumberOfAlignmentPoints( m_sentence_id ); + for( INDEX i=0; i<ap_points; i++) { + *out << " " << m_alignment->GetSourceWord( m_sentence_id, i ) + << "-" << m_alignment->GetTargetWord( m_sentence_id, i ); + } + + *out << endl; +} + +void PhrasePair::PrintPretty( ostream* out, int width ) const { vector< WORD_ID >::const_iterator t; |