fixed the end of line bug
This commit is contained in:
@@ -21,7 +21,7 @@ def scan(str_data, func):
|
|||||||
|
|
||||||
def remove_stop_words(word_list, func):
|
def remove_stop_words(word_list, func):
|
||||||
with open('../stop_words.txt') as f:
|
with open('../stop_words.txt') as f:
|
||||||
stop_words = f.read().split(',')
|
stop_words = f.read().strip('\n').split(',')
|
||||||
# add single-letter words
|
# add single-letter words
|
||||||
stop_words.extend(list(string.ascii_lowercase))
|
stop_words.extend(list(string.ascii_lowercase))
|
||||||
func([w for w in word_list if not w in stop_words], sort)
|
func([w for w in word_list if not w in stop_words], sort)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def scan(str_data):
|
|||||||
|
|
||||||
def remove_stop_words(word_list):
|
def remove_stop_words(word_list):
|
||||||
with open('../stop_words.txt') as f:
|
with open('../stop_words.txt') as f:
|
||||||
stop_words = f.read().split(',')
|
stop_words = f.read().strip('\n').split(',')
|
||||||
# add single-letter words
|
# add single-letter words
|
||||||
stop_words.extend(list(string.ascii_lowercase))
|
stop_words.extend(list(string.ascii_lowercase))
|
||||||
return [w for w in word_list if not w in stop_words]
|
return [w for w in word_list if not w in stop_words]
|
||||||
|
|||||||
Reference in New Issue
Block a user