Data Science, Towards Data Science, Markov Chains, Monte Carlo, Simulation.
generator object instead of actually filling up our memory with every pair of words: def make_pairs(corpus): for i in range(len(corpus)-1): yield (corpus[i], corpus[i+1]) pairs = make_pairs(corpus) Then we instantiate an empty dictionary, and fill it words from our pairs. If the first word of the