Class 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>
    A Translator that performs pre-process and post-processing for a sequence-to-sequence text model.
    • Constructor Detail

      • SimpleText2TextTranslator

        public SimpleText2TextTranslator()
    • 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 interface PostProcessor<java.lang.String>
        Parameters:
        ctx - the toolkit used for post-processing
        list - 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 interface PreProcessor<java.lang.String>
        Parameters:
        ctx - the toolkit for creating the input NDArray
        input - the input object
        Returns:
        the NDList after pre-processing