com.github.jelmerk.knn.examples.Word Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hnswlib-examples-java Show documentation
Show all versions of hnswlib-examples-java Show documentation
Examples for the core java library
package com.github.jelmerk.knn.examples;
import com.github.jelmerk.knn.Item;
import java.util.Arrays;
public class Word implements Item {
private static final long serialVersionUID = 1L;
private final String id;
private final float[] vector;
public Word(String id, float[] vector) {
this.id = id;
this.vector = vector;
}
@Override
public String id() {
return id;
}
@Override
public float[] vector() {
return vector;
}
@Override
public int dimensions() {
return vector.length;
}
@Override
public String toString() {
return "Word{" +
"id='" + id + '\'' +
", vector=" + Arrays.toString(vector) +
'}';
}
}