Question: Using FreqDist in python I get a a dictionary of items with the amount of times it shows up. How do I add all those
Using FreqDist in python I get a a dictionary of items with the amount of times it shows up. How do I add all those numbers up?
Example :
(("The Best deals are available at StripperKing.Com or call James at 702.524.7872 for FREE LIMO PICKUP, ADMISSION AND SEATING! JUST BUY 2 DRINKS! You'll get the best deals available, book now!", 'Stripperking.com has the best deals available! Free limo pickup\\/free entry\\/table packages, with 2 drink minimum. Book online of call James at 702.524.7872 now for priority booking'), 2), I have a bunch of these bigrams and I want to add all the numbers up to see how many there are total.
This is what I have so far
import nltk from nltk.util import ngrams from nltk.collocations import BigramCollocationFinder from nltk.metrics import BigramAssocMeasures
word_fd = nltk.FreqDist(DF['text"]) bigram_fd = nltk.FreqDist(nltk.bigrams(DF["text"])
bigram_fd.most_common()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
