Skip to content

Commit

Permalink
Update remove_words.py
Browse files Browse the repository at this point in the history
encoding for Python 3 only.
  • Loading branch information
yao8839836 authored Oct 11, 2018
1 parent fb096ef commit 546efef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion remove_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
dataset = '20ng'

doc_content_list = []
f = open('data/corpus/' + dataset + '.txt', 'r',encoding="utf8", errors='ignore')
if sys.version_info > (3, 0):
f = open('data/corpus/' + dataset + '.txt', 'r', encoding = 'utf-8', errors='ignore')
else:
f = open('data/corpus/' + dataset + '.txt', 'r')
# f = open('data/wiki_long_abstracts_en_text.txt', 'r')
for line in f.readlines():
doc_content_list.append(line.strip())
Expand Down

0 comments on commit 546efef

Please sign in to comment.