go-sentencepiece

module
v0.0.0-...-e4229d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2023 License: MIT

README

Sentence Piece Encoder

This is pure go implementation of the sentencepiece encoder. Create an encoder for the given sentencepiece model and then use use the Tokenize function to split the input text into tokens.

Example:


import "github.com/vikesh-raj/go-sentencepiece-encoder/sentencepiece"

text := "This is a sample text"
spm, _ := sentencepiece.NewSentencepieceFromFile("spm.model", false)
tokens := spm.Tokenize(text)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL