mirror of
https://github.com/github/semantic.git
synced 2024-12-24 07:25:44 +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
|
||||
(p, q) = (2, 2)
|
||||
d = 15
|
||||
fas = zip (featurize <$> as) [0..]
|
||||
fbs = zip (featurize <$> bs) [0..]
|
||||
fas = featurize as
|
||||
fbs = featurize bs
|
||||
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
|
||||
mapped <- get
|
||||
let ((k, nearest), j) = KdTree.nearest kdas kv
|
||||
|
Loading…
Reference in New Issue
Block a user