Skip to content

Latest commit

 

History

History

hnswlib-scala

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Maven Central Scaladoc

hnswlib-scala

Scala wrapper around hnswlib

Example usage

import com.github.jelmerk.knn.scalalike._
import com.github.jelmerk.knn.scalalike.hnsw._

val index = HnswIndex[String, Array[Float], Word, Float](floatCosineDistance, words.size, m = 10)
  
index.addAll(words)

index.findNeighbors("king", k = 10).foreach { case SearchResult(item, distance) => 
  println(s"$item $distance")
}