1
1
mirror of https://github.com/github/semantic.git synced 2025-01-09 00:56:32 +03:00

🔥 editDistanceIfComparable.

This commit is contained in:
Rob Rix 2017-10-23 12:22:14 -04:00
parent 598901b8da
commit 8cd4c596bd

View File

@ -186,15 +186,6 @@ nearestUnmapped canCompare unmapped tree key = listToMaybe (sortOn approximateEd
where candidates = toList (IntMap.intersection unmapped (toMap (fmap snd (kNearest tree defaultL (feature key)))))
approximateEditDistance = editDistanceUpTo defaultM . These (term key) . term
editDistanceIfComparable :: (Foldable syntax, Functor syntax, GAlign syntax)
=> ComparabilityRelation syntax ann1 ann2
-> Term syntax ann1
-> Term syntax ann2
-> Int
editDistanceIfComparable canCompare a b = if canCompareTerms canCompare a b
then editDistanceUpTo defaultM (These a b)
else maxBound
defaultD, defaultL, defaultP, defaultQ, defaultMoveBound :: Int
defaultD = 15
defaultL = 2