All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jelmerk.knn.examples.Word Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
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) +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy