1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 12:51:52 +03:00

Skip reorders.

This commit is contained in:
Rob Rix 2016-07-07 11:47:17 -04:00
parent ded6e48477
commit 4ea8844b58

View File

@ -33,10 +33,11 @@ rws compare getLabel as bs
kdas = KdTree.build (Vector.toList . feature) fas
featurize index term = UnmappedTerm index (featureVector d (pqGrams p q getLabel term)) term
findNearestNeighbourTo kv@(UnmappedTerm _ _ v) = do
(_, unmapped) <- get
(previous, unmapped) <- get
let (UnmappedTerm i k _) = KdTree.nearest kdas kv
fromMaybe (pure [ (negate 1, insert v) ]) $ do
UnmappedTerm _ _ found <- find ((== k) . feature) unmapped
guard (i < previous)
compared <- compare found v
pure $! do
put (i, List.delete (UnmappedTerm i k found) unmapped)