replace codecs.open with io.open

This commit is contained in:
Yaser Martinez Palenzuela 2016-03-01 14:10:11 +01:00
parent ee4c4f6a77
commit 1a93d7f725
1 changed files with 1 additions and 2 deletions

View File

@ -8,7 +8,6 @@ from os import path
import os import os
import bz2 import bz2
import ujson import ujson
import codecs
from preshed.counter import PreshCounter from preshed.counter import PreshCounter
from joblib import Parallel, delayed from joblib import Parallel, delayed
import io import io
@ -37,7 +36,7 @@ def count_freqs(input_loc, output_loc):
doc = tokenizer(json_comment['body']) doc = tokenizer(json_comment['body'])
doc.count_by(ORTH, counts=counts) doc.count_by(ORTH, counts=counts)
with codecs.open(output_loc, 'w', 'utf8') as file_: with io.open(output_loc, 'w', 'utf8') as file_:
for orth, freq in counts: for orth, freq in counts:
string = tokenizer.vocab.strings[orth] string = tokenizer.vocab.strings[orth]
if not string.isspace(): if not string.isspace():