Closed formigone closed 11 years ago
That is true.
What do you suggest to remedy this? RuntimeException ? InvalidArgumentException? return 0?
It currently returns false and issues a warning.
It should throw a UnexpectedValueException. I will work on this next.
UnexpectedValueException php.net Typically this happens when a function calls another function and expects the return value to be of a certain type or value not including arithmetic or buffer related errors
So I am guessing InvalidArgumentException.
NlpTools\Similarity\CosineSimilarity::similarity() can divide by zero if $v1_norm or $v2_norm (or both) are equal to zero.