Help implementing Markov Chains


#1

Hi, I’m david.

The link for my exercise: https://www.codecademy.com/final_project/learn-python

I’m having trouble using the markov chains element (allthough I read the file instructions)
which I dowloaded from here:

I’m supposed to make a markov chain object, and then call the generate_text() function on a string (or text file). The problem is I can’t quite understand how to do so.
These is my code:

from markov_python.cc_markov import MarkovChain
#Song is my text file
from fetch_data import song
mc = MarkovChain
#This is what’s not working
mc.generate_text(song)

The error i’m getting: unbound method generate_text() must be called with MarkovChain instance as first argument (got string instead)