Added perplexity -- not right

Attempted to add perplexity. Doesn't seem to be calculating correctly. Did some refactoring to make code
more general. Slowed it down by a small amount. Used simple Laplace and count to calculate probabilities.