public class TextData
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TextData.Configuration
The configuration for creating a
TextData value in a Dataset. |
| Constructor and Description |
|---|
TextData(TextData.Configuration config)
Constructs a new
TextData. |
| Modifier and Type | Method and Description |
|---|---|
static TextData.Configuration |
getDefaultConfiguration()
Returns a good default
TextData.Configuration to use for the constructor with defaults. |
ai.djl.ndarray.NDArray |
getEmbedding(ai.djl.ndarray.NDManager manager,
long index)
Gets the text embedding for the given index of the text input.
|
java.util.List<java.lang.String> |
getProcessedText(long index)
Gets the textual input after preprocessing.
|
java.lang.String |
getRawText(long index)
Gets the raw textual input.
|
int |
getSize()
Returns the size of the data.
|
ai.djl.modality.nlp.embedding.TextEmbedding |
getTextEmbedding()
Gets the
TextEmbedding used to embed the data with. |
ai.djl.modality.nlp.Vocabulary |
getVocabulary()
Gets the
SimpleVocabulary built while preprocessing the text data. |
void |
preprocess(ai.djl.ndarray.NDManager manager,
java.util.List<java.lang.String> newTextData)
Preprocess the textData into
NDArray by providing the data from the dataset. |
void |
setEmbeddingSize(int embeddingSize)
Sets the embedding size.
|
void |
setTextEmbedding(ai.djl.modality.nlp.embedding.TextEmbedding textEmbedding)
Sets the textEmbedding to embed the data with.
|
void |
setTextProcessors(java.util.List<ai.djl.modality.nlp.preprocess.TextProcessor> textProcessors)
Sets the text processors.
|
public TextData(TextData.Configuration config)
TextData.config - the configuration for the TextDatapublic static TextData.Configuration getDefaultConfiguration()
TextData.Configuration to use for the constructor with defaults.TextData.Configuration to use for the constructor with defaultspublic void preprocess(ai.djl.ndarray.NDManager manager,
java.util.List<java.lang.String> newTextData)
throws ai.djl.modality.nlp.embedding.EmbeddingException
NDArray by providing the data from the dataset.manager - thenewTextData - the data from the datasetai.djl.modality.nlp.embedding.EmbeddingException - if there is an error while embedding inputpublic void setTextProcessors(java.util.List<ai.djl.modality.nlp.preprocess.TextProcessor> textProcessors)
textProcessors - the new textProcessorspublic void setTextEmbedding(ai.djl.modality.nlp.embedding.TextEmbedding textEmbedding)
textEmbedding - the textEmbeddingpublic ai.djl.modality.nlp.embedding.TextEmbedding getTextEmbedding()
TextEmbedding used to embed the data with.TextEmbeddingpublic void setEmbeddingSize(int embeddingSize)
embeddingSize - the embedding sizepublic ai.djl.modality.nlp.Vocabulary getVocabulary()
SimpleVocabulary built while preprocessing the text data.SimpleVocabularypublic ai.djl.ndarray.NDArray getEmbedding(ai.djl.ndarray.NDManager manager,
long index)
manager - the manager for the embedding arrayindex - the index of the text inputNDArray containing the text embeddingpublic java.lang.String getRawText(long index)
index - the index of the text inputpublic java.util.List<java.lang.String> getProcessedText(long index)
index - the index of the text inputpublic int getSize()