Massive renaming!
This commit is contained in:
14
20-plugins/plugins-src/words1.py
Normal file
14
20-plugins/plugins-src/words1.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import sys, re, string
|
||||
|
||||
def extract_words(path_to_file):
|
||||
with open(path_to_file) as f:
|
||||
str_data = f.read()
|
||||
pattern = re.compile('[\W_]+')
|
||||
word_list = pattern.sub(' ', str_data).lower().split()
|
||||
|
||||
with open('../stop_words.txt') as f:
|
||||
stop_words = f.read().split(',')
|
||||
stop_words.extend(list(string.ascii_lowercase))
|
||||
|
||||
return [w for w in word_list if not w in stop_words]
|
||||
|
||||
Reference in New Issue
Block a user