I did it and it works as intended but it seemed very inefficient. I made the string a list, then I standardize it (removing accents, commas and points). After that, I count every word using a dictionary, then sort it in a loop.
Is there a better way to do it?
Edit - Thanks to you both, with your tips I managed to improve the code a lot, it's much faster and efficient now: https://pastebin.com/EN74daBG
import unidecode
from operator import itemgetter
def word_counter(text):
counter = {}
for word in text.lower().replace(",", "").replace(".", "").split():
standardize = unidecode.unidecode(word)
if standardize.isalnum():
counter.setdefault(standardize, 0)
counter[standardize] += 1
for key, value in sorted(counter.items(), key=itemgetter(1), reverse=True):
print("{} = {}".format(key, value))
word_counter('''text here''')