View source: R/sentencepiece.R
sentencepiece_load_model | R Documentation |
Load a Sentencepiece model which either was trained with sentencepiece
or which you have found in the wild.
sentencepiece_load_model(file = "sentencepiece.model")
file |
path to the file containing the Sentencepiece model |
an object of class sentencepiece
which is a list with elements
model: an Rcpp pointer to the model
model_path: the path to the model
vocab_size: the size of the Sentencepiece vocabulary
vocabulary: the Sentencepiece vocabulary which is a data.frame with columns id and subword
model <- system.file(package = "sentencepiece", "models", "nl-fr-dekamer.model") model <- sentencepiece_load_model(file = model) txt <- c("De eigendomsoverdracht aan de deelstaten is ingewikkeld.", "On est d'accord sur le prix de la biere?") sentencepiece_encode(model, x = txt, type = "subwords") sentencepiece_encode(model, x = txt, type = "ids")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.