Class SentencePieceLibrary


  • public final class SentencePieceLibrary
    extends java.lang.Object
    A class containing utilities to interact with the SentencePiece Engine's JNI layer.
    • Method Detail

      • createSentencePieceProcessor

        public long createSentencePieceProcessor()
      • loadModel

        public void loadModel​(long handle,
                              java.lang.String filePath)
      • loadModelFromBytes

        public void loadModelFromBytes​(long handle,
                                       byte[] bytes)
      • deleteSentencePieceProcessor

        public void deleteSentencePieceProcessor​(long handle)
      • tokenize

        public java.lang.String[] tokenize​(long handle,
                                           java.lang.String text)
      • encode

        public int[] encode​(long handle,
                            java.lang.String text)
      • detokenize

        public java.lang.String detokenize​(long handle,
                                           java.lang.String[] tokens)
      • decode

        public java.lang.String decode​(long handle,
                                       int[] ids)
      • idToPiece

        public java.lang.String idToPiece​(long handle,
                                          int id)
      • pieceToId

        public int pieceToId​(long handle,
                             java.lang.String piece)