mirror of
https://github.com/github/semantic.git
synced 2025-01-03 21:16:12 +03:00
Rename key to term.
This commit is contained in:
parent
91778d90a3
commit
3d01c91341
@ -106,9 +106,9 @@ mostSimilarMatching :: (Foldable syntax, Functor syntax, GAlign syntax)
|
||||
-> KdMap.KdMap Double FeatureVector (Int, Term syntax ann1) -- ^ The k-d map to look up nearest neighbours within.
|
||||
-> Term syntax (Record (FeatureVector ': fields2)) -- ^ The term to find the nearest neighbour to.
|
||||
-> Maybe (Int, Term syntax ann1) -- ^ The most similar term matched by the predicate, if any.
|
||||
mostSimilarMatching isEligible tree key = listToMaybe (sortOn approximateEditDistance candidates)
|
||||
where candidates = filter (uncurry isEligible) (snd <$> KdMap.kNearest tree defaultL (rhead (extract key)))
|
||||
approximateEditDistance = editDistanceUpTo defaultM key . snd
|
||||
mostSimilarMatching isEligible tree term = listToMaybe (sortOn approximateEditDistance candidates)
|
||||
where candidates = filter (uncurry isEligible) (snd <$> KdMap.kNearest tree defaultL (rhead (extract term)))
|
||||
approximateEditDistance = editDistanceUpTo defaultM term . snd
|
||||
|
||||
defaultD, defaultL, defaultM, defaultP, defaultQ :: Int
|
||||
defaultD = 15
|
||||
|
Loading…
Reference in New Issue
Block a user