I have the following code: This goes through a directory with a file and reads it, the stopwords and the dots are removed, I also want to remove the accents but I get an error: 'list' object has no attribute 'encode'
path = 'C:\\Users\\Example\\Desktop\\Example\\x'
ficheros = os.listdir(path)
docu = []
for namefi in fi:
if os.path.isfile(os.path.join(path, namefi)):
fich = open(os.path.join(path, namefi), "r",encoding='utf-8')
text = fich.read()
documentos.append(text)
tokens=word_tokenize(text)
clean=[w.lower() for w in tokens if not w in stopwords]
n_p= [item.replace('.','') for item in clean]
n_a= unidecode.unidecode(n_p)
print(n_p)
I have used unidecode.unidecode but it seems to be invalid with lists.