mirror of
https://github.com/github/semantic.git
synced 2024-12-24 07:25:44 +03:00
Skip reorders.
This commit is contained in:
parent
ded6e48477
commit
4ea8844b58
@ -33,10 +33,11 @@ rws compare getLabel as bs
|
|||||||
kdas = KdTree.build (Vector.toList . feature) fas
|
kdas = KdTree.build (Vector.toList . feature) fas
|
||||||
featurize index term = UnmappedTerm index (featureVector d (pqGrams p q getLabel term)) term
|
featurize index term = UnmappedTerm index (featureVector d (pqGrams p q getLabel term)) term
|
||||||
findNearestNeighbourTo kv@(UnmappedTerm _ _ v) = do
|
findNearestNeighbourTo kv@(UnmappedTerm _ _ v) = do
|
||||||
(_, unmapped) <- get
|
(previous, unmapped) <- get
|
||||||
let (UnmappedTerm i k _) = KdTree.nearest kdas kv
|
let (UnmappedTerm i k _) = KdTree.nearest kdas kv
|
||||||
fromMaybe (pure [ (negate 1, insert v) ]) $ do
|
fromMaybe (pure [ (negate 1, insert v) ]) $ do
|
||||||
UnmappedTerm _ _ found <- find ((== k) . feature) unmapped
|
UnmappedTerm _ _ found <- find ((== k) . feature) unmapped
|
||||||
|
guard (i < previous)
|
||||||
compared <- compare found v
|
compared <- compare found v
|
||||||
pure $! do
|
pure $! do
|
||||||
put (i, List.delete (UnmappedTerm i k found) unmapped)
|
put (i, List.delete (UnmappedTerm i k found) unmapped)
|
||||||
|
Loading…
Reference in New Issue
Block a user