I'd like to have my top k frequent words in my FreqDist. Or words that has a freq > p.
How do I do this?
After viewing the doc, I didn't find anything like threshold
or cut
. Also, the freq() function can only be called for each individual bin.
Of course I can write ad-hoc code like
[(x,f) for x in FreqDist.samples if FreqDist.freq(x) > p]
but it doesn't look elegant.