analogy has a return type of Option<_> and takes care to return None if it's passed two empty vectors. However, it doesn't bother to check whether vectors.is_empty() and instead ends up returning the top entries from its corpus with scores of NaN as a result.
Fixing this should be as simple as changing this line to if exclude.is_empty() || vectors.is_empty() {.
analogyhas a return type ofOption<_>and takes care to returnNoneif it's passed two empty vectors. However, it doesn't bother to check whethervectors.is_empty()and instead ends up returning the top entries from its corpus with scores ofNaNas a result.Fixing this should be as simple as changing this line to
if exclude.is_empty() || vectors.is_empty() {.