I have a dictionary of words and the number of times they appear in a given corpus. How can I keep words that appear at least n times (let's say, n=10) ?
dictionary = {
'beryllium': 60,
'inch': 56,
'any': 51,
'such': 31,
'court': 26,
'be': 25,
'by': 23,
'arsenic': 21,
'person': 20,
'land': 20,
'Lapp': 16,
'county': 15,
'Associate_in_Nursing': 15,
'executor': 15,
'information_technology': 14,
'state': 14,
'angstrom': 14,
'not': 14,
'other': 14,
'boundary': 14,
'tree': 13,
'administrator': 12,
'are': 11,
'helium': 11,
'no': 11,
'action': 10,
'rich_person': 10,
'use': 10,
'astatine': 10,
'being': 9,
'tobacco': 9,
'every': 9,
'curse': 9,
'ordain': 8,
'justice': 8,
'one': 8,
'notice': 8,
'law': 8,
'pound': 8,
'debt': 8,
'creditor': 8
}
}
With the dummy example above, it should return a dict that stops at 'astatine', included.
filtered_dict = {key: value for key, value in count_dict.items() if value >= 10}