Skip to content

Commit 4948103

Browse files
committed
Use UTF8 encoding for brat output.
1 parent 00899f7 commit 4948103

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/parserindexer/json2brat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Kiri Wagstaff
77
# July 31, 2017
88

9-
import sys, os, shutil
9+
import sys, os, shutil, io
1010
import json
1111
from ioutils import read_jsonlines
1212

@@ -31,7 +31,7 @@ def convert_json_to_brat(jsonfile, outdir):
3131
ners = d['metadata']['ner']
3232
outfn = os.path.join(outdir,
3333
d['metadata']['resourceName'][:-4] + '.ann')
34-
outf = open(outfn, 'w')
34+
outf = io.open(outfn, 'w', encoding='utf8')
3535
print 'Writing to', outfn
3636
for (t, n) in enumerate(ners):
3737
outf.write('T%d\t%s %s %s\t%s\n' % \

0 commit comments

Comments
 (0)