fix encoding issue

Error that occurred for phrase tables without phrase alignment:

  File "tmcombine.py", line 377, in write_phrase_table
    line = b"%s ||| %s ||| %s 2.718 %s||| %s ||| %s\n" %(src,target,features,origin_features,alignment,comments)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 26: ordinal not in range(128)  File "tmcombine.py", line 377, in write_phrase_table
This commit is contained in:
Rico Sennrich 2012-07-01 20:48:12 +02:00
parent 2025587439
commit ea4d0a4785

View File

@ -294,7 +294,7 @@ class Moses():
sys.stderr.write('Error: unexpected phrase table format. Your current configuration requires alignment information. Make sure you trained your model with -phrase-word-alignment\n')
exit()
self.phrase_pairs[src][target][1] = ['',line[3].lstrip(b'| ')]
self.phrase_pairs[src][target][1] = [b'',line[3].lstrip(b'| ')]
else:
sys.stderr.write('Error: unexpected phrase table format. Are you using a very old/new version of Moses with different formatting?\n')