Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Federmann <cfedermann@dfki.de>2012-05-10 16:48:51 +0400
committerChristian Federmann <cfedermann@dfki.de>2012-05-10 16:48:51 +0400
commit4ccab958085426fa9cd60f24fea26272844140ef (patch)
tree35e78e722718e7c088ebeb010e539ada71dfd752 /scripts/ems
parent4448df377b70c61a75c731390d042ded80ba08ed (diff)
Merged in fixes for compiler warnings regarding comparing signed and unsigned integer expressions.
Diffstat (limited to 'scripts/ems')
-rw-r--r--scripts/ems/biconcor/Alignment.cpp2
-rw-r--r--scripts/ems/biconcor/Mismatch.cpp4
-rw-r--r--scripts/ems/biconcor/PhrasePair.cpp46
-rw-r--r--scripts/ems/biconcor/PhrasePairCollection.cpp8
-rw-r--r--scripts/ems/biconcor/SuffixArray.cpp12
5 files changed, 36 insertions, 36 deletions
diff --git a/scripts/ems/biconcor/Alignment.cpp b/scripts/ems/biconcor/Alignment.cpp
index ee5418893..e73e18840 100644
--- a/scripts/ems/biconcor/Alignment.cpp
+++ b/scripts/ems/biconcor/Alignment.cpp
@@ -68,7 +68,7 @@ void Alignment::Create(const string& fileName)
SAFE_GETLINE((*fileP), line, LINE_MAX_LENGTH, '\n');
if (fileP->eof()) break;
vector<string> alignmentSequence = Tokenize( line );
- for(int i=0; i<alignmentSequence.size(); i++) {
+ for(size_t i=0; i<alignmentSequence.size(); i++) {
int s,t;
// cout << "scaning " << alignmentSequence[i].c_str() << endl;
if (! sscanf(alignmentSequence[i].c_str(), "%d-%d", &s, &t)) {
diff --git a/scripts/ems/biconcor/Mismatch.cpp b/scripts/ems/biconcor/Mismatch.cpp
index d43b2af8f..31140b200 100644
--- a/scripts/ems/biconcor/Mismatch.cpp
+++ b/scripts/ems/biconcor/Mismatch.cpp
@@ -44,8 +44,8 @@ Mismatch::Mismatch( SuffixArray *sa, TargetCorpus *tc, Alignment *a, INDEX sente
m_num_alignment_points =
m_alignment->GetNumberOfAlignmentPoints( sentence_id );
for(INDEX ap=0; ap<m_num_alignment_points; ap++) {
- m_source_unaligned[ m_alignment->GetSourceWord( sentence_id, ap ) ] = false;
- m_target_unaligned[ m_alignment->GetTargetWord( sentence_id, ap ) ] = false;
+ m_source_unaligned[ (int)m_alignment->GetSourceWord( sentence_id, ap ) ] = false;
+ m_target_unaligned[ (int)m_alignment->GetTargetWord( sentence_id, ap ) ] = false;
}
for(int i = source_start; i <= source_end; i++) {
if (!m_source_unaligned[ i ]) {
diff --git a/scripts/ems/biconcor/PhrasePair.cpp b/scripts/ems/biconcor/PhrasePair.cpp
index e66044ff5..9c16be77c 100644
--- a/scripts/ems/biconcor/PhrasePair.cpp
+++ b/scripts/ems/biconcor/PhrasePair.cpp
@@ -14,11 +14,11 @@ void PhrasePair::Print( ostream* out, int width ) const
// source
int sentence_start = m_source_position - m_source_start;
- int source_width = (width-3)/2;
+ size_t source_width = (width-3)/2;
string source_pre = "";
string source = "";
string source_post = "";
- for( int space=0; space<source_width/2; space++ ) source_pre += " ";
+ for( size_t space=0; space<source_width/2; space++ ) source_pre += " ";
for( char i=0; i<m_source_start; i++ ) {
source_pre += " " + m_suffixArray->GetWord( sentence_start + i );
}
@@ -31,12 +31,12 @@ void PhrasePair::Print( ostream* out, int width ) const
if (i>m_source_end+1) source_post += " ";
source_post += m_suffixArray->GetWord( sentence_start + i );
}
- for( int space=0; space<source_width/2; space++ ) source_post += " ";
+ for( size_t space=0; space<source_width/2; space++ ) source_post += " ";
- int source_pre_width = (source_width-source.size()-2)/2;
- int source_post_width = (source_width-source.size()-2+1)/2;
+ size_t source_pre_width = (source_width-source.size()-2)/2;
+ size_t source_post_width = (source_width-source.size()-2+1)/2;
- if (source.size() > width) {
+ if (source.size() > (size_t)width) {
source_pre_width = 0;
source_post_width = 0;
}
@@ -46,11 +46,11 @@ void PhrasePair::Print( ostream* out, int width ) const
<< source_post.substr( 0, source_post_width ) << " | ";
// target
- int target_width = (width-3)/2;
+ size_t target_width = (width-3)/2;
string target_pre = "";
string target = "";
string target_post = "";
- for( int space=0; space<target_width/2; space++ ) target_pre += " ";
+ for( size_t space=0; space<target_width/2; space++ ) target_pre += " ";
for( char i=0; i<m_target_start; i++ ) {
target_pre += " " + m_targetCorpus->GetWord( m_sentence_id, i);
}
@@ -63,10 +63,10 @@ void PhrasePair::Print( ostream* out, int width ) const
target_post += m_targetCorpus->GetWord( m_sentence_id, i);
}
- int target_pre_width = (target_width-target.size()-2)/2;
- int target_post_width = (target_width-target.size()-2+1)/2;
+ size_t target_pre_width = (target_width-target.size()-2)/2;
+ size_t target_post_width = (target_width-target.size()-2+1)/2;
- if (target.size() > width) {
+ if (target.size() > (size_t)width) {
target_pre_width = 0;
target_post_width = 0;
}
@@ -131,7 +131,7 @@ void PhrasePair::PrintClippedHTML( ostream* out, int width ) const
// source
int sentence_start = m_source_position - m_source_start;
- int source_width = (width+1)/2;
+ size_t source_width = (width+1)/2;
string source_pre = "";
string source = "";
string source_post = "";
@@ -147,16 +147,16 @@ void PhrasePair::PrintClippedHTML( ostream* out, int width ) const
if (i>m_source_end+1) source_post += " ";
source_post += m_suffixArray->GetWord( sentence_start + i );
}
- int source_pre_width = (source_width-source.size())/2;
- int source_post_width = (source_width-source.size()+1)/2;
+ size_t source_pre_width = (source_width-source.size())/2;
+ size_t source_post_width = (source_width-source.size()+1)/2;
// if phrase is too long, don't show any context
- if (source.size() > width) {
+ if (source.size() > (size_t)width) {
source_pre_width = 0;
source_post_width = 0;
}
// too long -> truncate and add "..."
- if (source_pre.size()>source_pre_width) {
+ if (source_pre.size() > source_pre_width) {
// first skip up to a space
while(source_pre_width>0 &&
source_pre.substr(source_pre.size()-source_pre_width,1) != " ") {
@@ -181,12 +181,12 @@ void PhrasePair::PrintClippedHTML( ostream* out, int width ) const
<< "</td>";
// target
- int target_width = width/2;
+ size_t target_width = width/2;
string target_pre = "";
string target = "";
string target_post = "";
- int target_pre_null_width = 0;
- int target_post_null_width = 0;
+ size_t target_pre_null_width = 0;
+ size_t target_post_null_width = 0;
for( char i=0; i<m_target_start; i++ ) {
WORD word = m_targetCorpus->GetWord( m_sentence_id, i);
target_pre += " " + word;
@@ -206,10 +206,10 @@ void PhrasePair::PrintClippedHTML( ostream* out, int width ) const
}
}
- int target_pre_width = (target_width-target.size())/2;
- int target_post_width = (target_width-target.size()+1)/2;
+ size_t target_pre_width = (target_width-target.size())/2;
+ size_t target_post_width = (target_width-target.size()+1)/2;
- if (target.size() > width) {
+ if (target.size() > (size_t)width) {
target_pre_width = 0;
target_post_width = 0;
}
@@ -246,7 +246,7 @@ void PhrasePair::PrintClippedHTML( ostream* out, int width ) const
}
if (m_post_null) {
//cerr << endl << "target_post_width=" << target_post_width << ", target_post_null_width=" << target_post_null_width << ", target_post.size()=" << target_post.size() << endl;
- if (target_post_null_width>target_post.size()) {
+ if (target_post_null_width > target_post.size()) {
target_post_null_width = target_post.size();
}
target_post = "<span class=\"null_aligned\">"
diff --git a/scripts/ems/biconcor/PhrasePairCollection.cpp b/scripts/ems/biconcor/PhrasePairCollection.cpp
index 4574bbcc0..17c95d24a 100644
--- a/scripts/ems/biconcor/PhrasePairCollection.cpp
+++ b/scripts/ems/biconcor/PhrasePairCollection.cpp
@@ -89,7 +89,7 @@ bool PhrasePairCollection::GetCollection( const vector< string >& sourceString )
}
cerr << endl;
- if (found > m_max_lookup) {
+ if (found > (INDEX)m_max_lookup) {
i += found/m_max_lookup-1;
}
}
@@ -172,7 +172,7 @@ void PhrasePairCollection::PrintHTML() const
if (singleton) cout << "</table></div>\n";
else if (pp_target > 9) cout << "</div>";
- int max_mismatch = m_max_pp/3;
+ size_t max_mismatch = m_max_pp/3;
// unaligned phrases
if (m_unaligned.size() > 0) {
cout << "<p class=\"pp_singleton_header\">unaligned"
@@ -181,7 +181,7 @@ void PhrasePairCollection::PrintHTML() const
int step_size = 1;
if (m_unaligned.size() > max_mismatch)
step_size = (m_unaligned.size()+max_mismatch-1) / max_mismatch;
- for(int i=0;i<m_unaligned.size();i+=step_size)
+ for(size_t i=0;i<m_unaligned.size();i+=step_size)
m_unaligned[i]->PrintClippedHTML( &cout, 160 );
cout << "</table>";
}
@@ -194,7 +194,7 @@ void PhrasePairCollection::PrintHTML() const
int step_size = 1;
if (m_mismatch.size() > max_mismatch)
step_size = (m_mismatch.size()+max_mismatch-1) / max_mismatch;
- for(int i=0;i<m_mismatch.size();i+=step_size)
+ for(size_t i=0;i<m_mismatch.size();i+=step_size)
m_mismatch[i]->PrintClippedHTML( &cout, 160 );
cout << "</table>";
}
diff --git a/scripts/ems/biconcor/SuffixArray.cpp b/scripts/ems/biconcor/SuffixArray.cpp
index f9425abe0..15e6b47b0 100644
--- a/scripts/ems/biconcor/SuffixArray.cpp
+++ b/scripts/ems/biconcor/SuffixArray.cpp
@@ -122,10 +122,10 @@ void SuffixArray::Sort(INDEX start, INDEX end)
Sort( mid, end );
// merge
- int i = start;
- int j = mid;
- int k = 0;
- int length = end-start+1;
+ INDEX i = start;
+ INDEX j = mid;
+ INDEX k = 0;
+ INDEX length = end-start+1;
while( k<length ) {
if (i == mid ) {
m_buffer[ k++ ] = m_index[ j++ ];
@@ -174,7 +174,7 @@ int SuffixArray::Count( const vector< WORD > &phrase )
bool SuffixArray::MinCount( const vector< WORD > &phrase, INDEX min )
{
INDEX dummy;
- return LimitedCount( phrase, min, dummy, dummy, 0, m_size-1 ) >= min;
+ return (INDEX)LimitedCount( phrase, min, dummy, dummy, 0, m_size-1 ) >= min;
}
bool SuffixArray::Exists( const vector< WORD > &phrase )
@@ -192,7 +192,7 @@ int SuffixArray::LimitedCount( const vector< WORD > &phrase, INDEX min, INDEX &f
{
// cerr << "FindFirst\n";
INDEX start = search_start;
- INDEX end = (search_end == -1) ? (m_size-1) : search_end;
+ INDEX end = (search_end == (INDEX)-1) ? (m_size-1) : search_end;
INDEX mid = FindFirst( phrase, start, end );
// cerr << "done\n";
if (mid == m_size) return 0; // no matches