In a class, I have to complete a code. It is taking a corpora of tokens and is supposed to provide a dictionnary of keys (bigrams from the corpus used form with nltk.bigrams()) and as values, the probability of that bigram appearing (based on the frequency of the bigram in my corpora). My solution was to do:
a = nltk.FreqDist(nltk.bigrams("aaaaaaacbegdeg"))
I have a dictionnary but it is trap in the following:
FreqDist({('a', 'a'): 6,
('a', 'c'): 1,
('b', 'e'): 1,
('c', 'b'): 1,
('d', 'e'): 1,
('e', 'g'): 2,
('g', 'd'): 1})
How do I take out the FreqDist? Best regard, Bianca