Fix value for F-measure when components are zero

When both the precision and recall of a class for zero, the F-measure
should be zero as well. Previously we did not check for this case, which
resulted in a `ZeroDivisionError` during the calculation.
This closes gh-19.

The solution was to calculate the numerator and denominator separately,
and then only dividing if the denominator is greater than 0. An
alternative that was also tired was to surround the division into a
try-except block, and catching the `ZeroDivisionError`. However,
profiling the two solutions found that the try-except approach was
slower by an order of magnitude, and therefore was not used.