BAD_CHARS = '.!?,\'"'
words = [word.strip(BAD_CHARS) for word in text.strip().split() if len(word
    ) > 4]
word_freq = {}
for word in words:
    word_freq[word] = word_freq.get(word, 0) + 1
tx = [(v, k) for k, v in list(word_freq.items())]
tx.sort(reverse=True)
word_freq_sorted = [(k, v) for v, k in tx]
print(word_freq_sorted)
term_importance = lambda word: 1.0 / word_freq[word]
map(term_importance, list(word_freq.keys()))
генерация тегов из текстового контента