mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
DRY up the computation of indexed, feature-assigned lists.
This commit is contained in:
parent
53cfdb8f15
commit
457082ba6f
@ -28,10 +28,10 @@ rws compare getLabel as bs
|
|||||||
replace = (pure .) . Replace
|
replace = (pure .) . Replace
|
||||||
(p, q) = (2, 2)
|
(p, q) = (2, 2)
|
||||||
d = 15
|
d = 15
|
||||||
fas = zip (featurize <$> as) [0..]
|
fas = featurize as
|
||||||
fbs = zip (featurize <$> bs) [0..]
|
fbs = featurize bs
|
||||||
kdas = KdTree.build (Vector.toList . fst . fst) fas
|
kdas = KdTree.build (Vector.toList . fst . fst) fas
|
||||||
featurize = featureVector d . pqGrams p q getLabel &&& identity
|
featurize a = zip ((featureVector d . pqGrams p q getLabel &&& identity) <$> a) ([0..] :: [Integer])
|
||||||
findNearestNeighbourTo kv@((_, v), i) = do
|
findNearestNeighbourTo kv@((_, v), i) = do
|
||||||
mapped <- get
|
mapped <- get
|
||||||
let ((k, nearest), j) = KdTree.nearest kdas kv
|
let ((k, nearest), j) = KdTree.nearest kdas kv
|
||||||
|
Loading…
Reference in New Issue
Block a user