@@ -288,27 +288,26 @@ def choose_parser():
288
288
289
289
290
290
if six .PY3 :
291
- with open (input_file_path , encoding = 'UTF-8' ) as input_file :
292
- with open (input_file_path ) as input_file :
293
- with open (output_file_path , 'w' ) as output_file :
294
- for i , l in enumerate (input_file .readlines ()):
295
- parser = choose_parser ()
296
- #print(parser.__name__ == "pos_replace_parser")
297
- if i % 1000 == 0 :
298
- log .debug ('parsing line %d' % i )
299
- print (l .strip (), file = output_file )
300
-
301
- for k in range (args .aug_times ):
302
- cols = l .strip ().split ('\t ' )
303
- for j in col_nums :
304
- if parser .__name__ == "pos_replace_parser" :
305
- cols [j - 1 ] = parser (cols [j - 1 ], pos_dict [j - 1 ])
306
- counter [parser .__name__ ] += 1
307
- else :
308
- cols [j - 1 ] = parser (cols [j - 1 ])
309
- counter [parser .__name__ ] += 1
310
- new_line = '\t ' .join (cols )
311
- print (new_line , file = output_file )
291
+ with open (input_file_path , 'r' , encoding = 'UTF-8' ) as input_file :
292
+ with open (output_file_path , 'w' , encoding = 'UTF-8' ) as output_file :
293
+ for i , l in enumerate (input_file .readlines ()):
294
+ parser = choose_parser ()
295
+ #print(parser.__name__ == "pos_replace_parser")
296
+ if i % 1000 == 0 :
297
+ log .debug ('parsing line %d' % i )
298
+ print (l .strip (), file = output_file )
299
+
300
+ for k in range (args .aug_times ):
301
+ cols = l .strip ().split ('\t ' )
302
+ for j in col_nums :
303
+ if parser .__name__ == "pos_replace_parser" :
304
+ cols [j - 1 ] = parser (cols [j - 1 ], pos_dict [j - 1 ])
305
+ counter [parser .__name__ ] += 1
306
+ else :
307
+ cols [j - 1 ] = parser (cols [j - 1 ])
308
+ counter [parser .__name__ ] += 1
309
+ new_line = '\t ' .join (cols )
310
+ print (new_line , file = output_file )
312
311
313
312
elif six .PY2 :
314
313
with open (input_file_path ) as input_file :
0 commit comments