Added checks to prevent divide by zero errors.

I'm using this in a situation where I'm processing large amounts of text. Rather than testing the string each time I pass something in, I've added checks on each score to prevent divide by zero errors.