public class SimpleTextEmbedding extends java.lang.Object implements TextEmbedding
TextEmbedding that applies a WordEmbedding to each word independently.| Constructor and Description |
|---|
SimpleTextEmbedding(WordEmbedding wordEmbedding)
Constructs a
SimpleTextEmbedding. |
| Modifier and Type | Method and Description |
|---|---|
NDArray |
embedText(NDArray textIndices)
Embeds the text after preprocessed using
TextEmbedding.preprocessTextToEmbed(List). |
long[] |
preprocessTextToEmbed(java.util.List<java.lang.String> text)
Preprocesses the text to embed into an array to pass into the model.
|
java.util.List<java.lang.String> |
unembedText(NDArray textEmbedding)
Returns the closest matching text for a given embedding.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitembedText, embedTextpublic SimpleTextEmbedding(WordEmbedding wordEmbedding)
SimpleTextEmbedding.wordEmbedding - the word embedding to embed each wordpublic long[] preprocessTextToEmbed(java.util.List<java.lang.String> text)
Make sure to call TextEmbedding.embedText(NDManager, long[]) after this.
preprocessTextToEmbed in interface TextEmbeddingtext - the text to embedpublic NDArray embedText(NDArray textIndices) throws EmbeddingException
TextEmbedding.preprocessTextToEmbed(List).embedText in interface TextEmbeddingtextIndices - the indices of text to embedEmbeddingException - if there is an error while trying to embedpublic java.util.List<java.lang.String> unembedText(NDArray textEmbedding)
unembedText in interface TextEmbeddingtextEmbedding - the text embedding to find the matching string text for.