MCPcopy Create free account
hub / github.com/comaps/comaps / GetSimilarity

Method GetSimilarity

libs/search/locality_scorer.cpp:311–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311double LocalityScorer::GetSimilarity(QueryVec & qv, IdfMap & docIdfs, vector<DocVec> & dvc) const
312{
313 double constexpr kScale = 1e6;
314
315 double similarity = 0;
316 for (auto & dv : dvc)
317 similarity = max(similarity, qv.Similarity(docIdfs, dv));
318
319 // We need to scale similarity here to prevent floating-point
320 // artifacts, and to make sorting by similarity more robust, as 1e-6
321 // is good enough for our purposes.
322 return round(similarity * kScale);
323}
324
325string DebugPrint(LocalityScorer::ExLocality const & el)
326{

Callers

nothing calls this directly

Calls 1

SimilarityMethod · 0.80

Tested by

no test coverage detected