summaryrefslogtreecommitdiff
path: root/progs/a261.py
blob: b5592b11060dbd59a1b94d93f0072f49e491839d (plain)
1
2
3
4
5
6
from collections import Counter
import re
def n_common_words(text,n):
  words = re.findall('\w+',text)
  n_common_words= Counter(words).most_common(n)
  return list(n_common_words)