View source: R/sentencepiece.R
sentencepiece_decode | R Documentation |
Decode a sequence of Sentencepiece ids into text again
sentencepiece_decode(model, x)
model |
an object of class |
x |
an integer vector of Sentencepiece id's or a list of these |
a character vector of detokenised text or if you encoded with nbest
, a list of these
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?") x <- sentencepiece_encode(model, x = txt, type = "subwords") sentencepiece_decode(model, x) x <- sentencepiece_encode(model, x = txt, type = "ids") sentencepiece_decode(model, x) model <- system.file(package = "sentencepiece", "models", "nl-fr-dekamer-unigram.model") model <- sentencepiece_load_model(file = model) x <- sentencepiece_encode(model, x = txt, type = "subwords", nbest = 3) sentencepiece_decode(model, x) x <- sentencepiece_encode(model, x = txt, type = "subwords", nbest = 3, alpha = 0.1) sentencepiece_decode(model, x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.