Package ai.djl.modality.nlp.translator
Class SimpleText2TextTranslator
- java.lang.Object
-
- ai.djl.modality.nlp.translator.SimpleText2TextTranslator
-
- All Implemented Interfaces:
PostProcessor<java.lang.String>
,PreProcessor<java.lang.String>
,Translator<java.lang.String,java.lang.String>
public class SimpleText2TextTranslator extends java.lang.Object implements Translator<java.lang.String,java.lang.String>
ATranslator
that performs pre-process and post-processing for a sequence-to-sequence text model.
-
-
Constructor Summary
Constructors Constructor Description SimpleText2TextTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Batchifier
getBatchifier()
Gets theBatchifier
.NDList
processInput(TranslatorContext ctx, java.lang.String input)
Processes the input and converts it to NDList.java.lang.String
processOutput(TranslatorContext ctx, NDList list)
Processes the output NDList to the corresponding output object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ai.djl.translate.Translator
prepare
-
-
-
-
Method Detail
-
processOutput
public java.lang.String processOutput(TranslatorContext ctx, NDList list)
Processes the output NDList to the corresponding output object.- Specified by:
processOutput
in interfacePostProcessor<java.lang.String>
- Parameters:
ctx
- the toolkit used for post-processinglist
- the output NDList after inference- Returns:
- the output object of expected type
-
processInput
public NDList processInput(TranslatorContext ctx, java.lang.String input)
Processes the input and converts it to NDList.- Specified by:
processInput
in interfacePreProcessor<java.lang.String>
- Parameters:
ctx
- the toolkit for creating the input NDArrayinput
- the input object- Returns:
- the
NDList
after pre-processing
-
getBatchifier
public Batchifier getBatchifier()
Gets theBatchifier
.- Specified by:
getBatchifier
in interfaceTranslator<java.lang.String,java.lang.String>
- Returns:
- the
Batchifier
-
-