You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import os
files_path = '/Users/xxx/Desktop/Test_SP/'
for filename in os.listdir(files_path):
# only care the txt files
if filename.endswith(".txt"):
#load data
file = open("{}/{}".format(files_path,filename))
text = file.read()
file.close()
# split into words
from nltk.tokenize import word_tokenize
tokens = word_tokenize(text)
# run the .py code
import EFZP
porter = EFZP()
stemmed = [porter.stem(word) for word in tokens]
# write on the same file with input
with open("{}/{}".format(files_path,filename), 'w') as fout:
fout.write(stemmed[:20])
The text was updated successfully, but these errors were encountered:
import os
files_path = '/Users/xxx/Desktop/Test_SP/'
for filename in os.listdir(files_path):
# only care the txt files
if filename.endswith(".txt"):
#load data
file = open("{}/{}".format(files_path,filename))
text = file.read()
file.close()
# split into words
from nltk.tokenize import word_tokenize
tokens = word_tokenize(text)
# run the .py code
import EFZP
porter = EFZP()
stemmed = [porter.stem(word) for word in tokens]
# write on the same file with input
with open("{}/{}".format(files_path,filename), 'w') as fout:
fout.write(stemmed[:20])
The text was updated successfully, but these errors were encountered: