Skip to content

Commit

Permalink
fix unicode encoding error
Browse files Browse the repository at this point in the history
  • Loading branch information
spyysalo committed Jan 20, 2014
1 parent 0ecc357 commit f5b38c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/conllXtostandoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def process(fn):
# 8 DEPREL Dependency relation to the HEAD.
fields = l.split('\t')

assert len(fields) == 10, "Format error on line %d in %s: %s" % (ln, fn, l)
assert len(fields) == 10, "Format error on line %d in %s: expected 10 fields, got %d: %s" % (ln, fn, len(fields), l)

ID, form, POS = fields[0], fields[1], fields[4]
head, rel = fields[6], fields[7]
Expand Down Expand Up @@ -191,7 +191,8 @@ def main(argv):
try:
process(fn)
except Exception, e:
print >> sys.stderr, "Error processing %s: %s" % (fn, e)
m = unicode(e).encode(OUTPUT_ENCODING)
print >> sys.stderr, "Error processing %s: %s" % (fn, m)
fail_count += 1

if fail_count > 0:
Expand Down

0 comments on commit f5b38c0

Please sign in to comment.