Not able to make the original source code work with or without a different parser.

I was attempting to follow this code, and early on I was getting parser errors. So I installed html5lib and it would give me the error/s:

To get rid of this warning, change this:

BeautifulSoup([your markup])

to this:

BeautifulSoup([your markup], "html5lib")

markup_type=markup_type))

I looked through the Beautiful Soup documentation and it didn't help much. I changed thesoup = BeautifulSoup(source_code) to

BeautifulSoup([source_code], "html5lib")

markup_type=markup_type))

after installing html5lib. But it still gave me the above error in a different format; stopping at the last )) at the end.

So I have 2 questions:

1) Why wouldn't the original source code work?2) If I install the html5lib parser and change the code as I suggest, what is wrong with it at the end.

In other words, why can't I get this to work. I have seen it partially work; but, in the end, come up with errors after printing out many of the words. I never got to the point where it would count the frequencies of each word though.