Class TrainableTextEmbedding

    • Method Detail

      • preprocessTextToEmbed

        public long[] preprocessTextToEmbed​(java.util.List<java.lang.String> text)
        Preprocesses the text to embed into an array to pass into the model.

        Make sure to call TextEmbedding.embedText(NDManager, long[]) after this.

        Specified by:
        preprocessTextToEmbed in interface TextEmbedding
        Parameters:
        text - the text to embed
        Returns:
        the indices of text that is ready to embed
      • unembedText

        public java.util.List<java.lang.String> unembedText​(NDArray textEmbedding)
        Returns the closest matching text for a given embedding.
        Specified by:
        unembedText in interface TextEmbedding
        Parameters:
        textEmbedding - the text embedding to find the matching string text for.
        Returns:
        text similar to the passed in embedding
      • initializeChildBlocks

        public void initializeChildBlocks​(NDManager manager,
                                          DataType dataType,
                                          Shape... inputShapes)
        Initializes the Child blocks of this block. You need to override this method if your subclass has child blocks. Used to determine the correct input shapes for child blocks based on the requested input shape for this block.
        Overrides:
        initializeChildBlocks in class AbstractBaseBlock
        Parameters:
        manager - the manager to use for initialization
        dataType - the requested data type
        inputShapes - the expected input shapes for this block
      • getOutputShapes

        public Shape[] getOutputShapes​(Shape[] inputShapes)
        Returns the expected output shapes of the block for the specified input shapes.
        Specified by:
        getOutputShapes in interface Block
        Parameters:
        inputShapes - the shapes of the inputs
        Returns:
        the expected output shapes of the block