import json, collections, re with open("content/jokes.json") as f: data = json.load(f) jokes = data["jokes"] words = collections.Counter() for j in jokes: for word in re.findall(r"\b\w+\b", j["setup"].lower() + " " + j["punch"].lower()): if len(word) > 4: words[word] += 1 print(words.most_common(50))