protected class Embedding.DefaultItem extends java.lang.Object implements AbstractIndexedEmbedding<T>
| Constructor and Description |
|---|
DefaultItem(T defaultItem) |
| Modifier and Type | Method and Description |
|---|---|
T |
decode(byte[] byteArray)
Decodes the given byte array into an object of input parameter type.
|
NDArray |
embed(NDManager manager,
T[] items)
Embeds an array of items.
|
long |
embed(T item)
Embeds an item.
|
byte[] |
encode(T input)
Encodes an object of input type into a byte array.
|
boolean |
hasItem(T item)
Returns whether an item is in the embedding.
|
java.util.Optional<T> |
unembed(long index)
Returns the item corresponding to the given index.
|
public DefaultItem(T defaultItem)
public byte[] encode(T input) throws java.io.IOException
Embedding objects.encode in interface AbstractIndexedEmbedding<T>input - the input object to be encodedjava.io.IOException - if there is an error while encodingpublic T decode(byte[] byteArray) throws java.io.IOException
decode in interface AbstractIndexedEmbedding<T>byteArray - the byte array to be decodedjava.io.IOException - if there was an error while decodingpublic boolean hasItem(T item)
hasItem in interface AbstractEmbedding<T>item - the item to testpublic NDArray embed(NDManager manager, T[] items)
embed in interface AbstractEmbedding<T>manager - the manager for the new embeddingsitems - the items to embedNDArray of Shape(items.length, embeddingSize)public long embed(T item)
embed in interface AbstractIndexedEmbedding<T>item - the item to embedpublic java.util.Optional<T> unembed(long index)
unembed in interface AbstractIndexedEmbedding<T>index - the index