dkpro / dkpro-similarity

Word and text similarity measures
https://dkpro.github.io/dkpro-similarity
Other
53 stars 22 forks source link

PathLengthComparator may return -1 instead of NO_PATH #67

Closed reckart closed 6 years ago

reckart commented 6 years ago
java.lang.AssertionError: expected:<-2.0> but was:<-1.0>
    at org.dkpro.similarity.algorithms.lsr.path.PathLengthComparatorTest.testWordNet(PathLengthComparatorTest.java:87)
reckart commented 6 years ago

I expect this is relate to underlying code hitting an empty path and the length of this path being calculated as something like nodesInPath.size()-1.

Fixing this by letting PathLengthComparator return NO_PATH whenever the underlying code returns a negative path length.

reckart commented 6 years ago

Looking into the code, I get the impression that all LexSemResourceComparators should return NOT_FOUND (-1.0) if the similarity cannot be determined, even if the underlying measure provides more detail, e.g. why the similarity cannot be determined. Hence, changing the unit test to expect NOT_FOUND.