Module

Annoy

Package
purescript-annoy
Repository
Kamirus/purescript-annoy

#get Source

get :: forall s. Nat s => Annoy s -> Int -> Maybe (Vec s Number)

get annoy i returns i-th vector. Performs bounds check.

#unsafeGet Source

unsafeGet :: forall s. Nat s => Annoy s -> Int -> Vec s Number

Similar to get but no bounds checks are performed.

#length Source

length :: forall s. Annoy s -> Int

length annoy returns number of stored vectors

#save Source

save :: forall r s. Annoy s -> String -> Eff (fs :: FS | r) Boolean

save annoy path dumps annoy to the file. Boolean indicates succes or failure.

#unsafeLoad Source

unsafeLoad :: forall o s r. Nat s => { metric :: Metric, size :: s | o } -> String -> Eff (fs :: FS | r) (Maybe (Annoy s))

unsafeLoad { size , metric } path creates STAnnoy using size and metric, then loads annoy using path Unsafe aspect is that it does not check loaded vector sizes against size

#nnsByItem Source

nnsByItem :: forall s. Nat s => Annoy s -> Int -> Int -> ({ searchK :: Int } -> { searchK :: Int }) -> Maybe (Array Int)

nnsByItem a i n update Works like nnsByVec, but requires index instead of vector

#nnsByItem_ Source

nnsByItem_ :: forall s. Nat s => Annoy s -> Int -> Int -> ({ searchK :: Int } -> { searchK :: Int }) -> Maybe { distances :: Array Int, neighbors :: Array Int }

nnsByItem_ a i n update Works like nnsByVec_, but requires index instead of vector

#nnsByVec Source

nnsByVec :: forall s. Nat s => Annoy s -> Vec s Number -> Int -> ({ searchK :: Int } -> { searchK :: Int }) -> Array Int

nnsByVec a v n update Returns n closest items to the v vector. update is used to set search_k parameter. nnsByVec a v n id to use default searchK nnsByVec a v n (_ { searchK = 123 }) to set searchK

#nnsByVec_ Source

nnsByVec_ :: forall s. Nat s => Annoy s -> Vec s Number -> Int -> ({ searchK :: Int } -> { searchK :: Int }) -> { distances :: Array Int, neighbors :: Array Int }

Works like nnsByVec but also returns distances

#distance Source

distance :: forall s. Nat s => Annoy s -> Int -> Int -> Maybe Number

#unsafeDistance Source

unsafeDistance :: forall s. Nat s => Annoy s -> Int -> Int -> Number

#fromVectors Source

fromVectors :: forall o f t s. Nat s => Foldable f => Pos t => { metric :: Metric, trees :: t | o } -> f (Vec s Number) -> Annoy s

fromVectors options@{ trees , metric } vectors Creates new Annoy with metric, adds given vectors and executes build using trees.

#fromVectors_ Source

fromVectors_ :: forall o f s. Nat s => Foldable f => { metric :: Metric, trees :: Int | o } -> f (Vec s Number) -> Maybe (Annoy s)

Similar to fromVectors but trees :: Int.