Fix values for precision and recall in edge cases

If a class label is seen either the reference set or the test set but
not seen in the other, then the denominator of the fraction when
calculating precision and recall can become zero, causing an error. Here
we have added logic to handle those edge cases, and make sure they are
given correct values (not always zero!). This fixes gh-17.

See [this answer](http://stats.stackexchange.com/a/1775/21403) on Stack
Overflow for more information.