masked_tokens_pred_tbl | R Documentation |
For each mask, indicated with [MASK]
, in a sentence, get the possible
tokens and their predictability (by default the natural logarithm of the
word probability) using a masked transformer.
masked_tokens_pred_tbl(
masked_sentences,
log.p = getOption("pangoling.log.p"),
model = getOption("pangoling.masked.default"),
checkpoint = NULL,
add_special_tokens = NULL,
config_model = NULL,
config_tokenizer = NULL
)
masked_sentences |
Masked sentences. |
log.p |
Base of the logarithm used for the output predictability values.
If |
model |
Name of a pre-trained model or folder. One should be able to use models based on "bert". See hugging face website. |
checkpoint |
Folder of a checkpoint. |
add_special_tokens |
Whether to include special tokens. It has the same default as the AutoTokenizer method in Python. |
config_model |
List with other arguments that control how the model from Hugging Face is accessed. |
config_tokenizer |
List with other arguments that control how the tokenizer from Hugging Face is accessed. |
A masked language model (also called BERT-like, or encoder model) is a type of large language model that can be used to predict the content of a mask in a sentence.
If not specified, the masked model that will be used is the one set in
specified in the global option pangoling.masked.default
, this can be
accessed via getOption("pangoling.masked.default")
(by default
"bert-base-uncased"). To change the default option
use options(pangoling.masked.default = "newmaskedmodel")
.
A list of possible masked can be found in Hugging Face website
Using the config_model
and config_tokenizer
arguments, it's possible to
control how the model and tokenizer from Hugging Face is accessed, see the
python method
from_pretrained
for details. In case of errors check the status of
https://status.huggingface.co/
A table with the masked sentences, the tokens (token
),
predictability (pred
), and the respective mask number (mask_n
).
See the online article in pangoling website for more examples.
Other masked model functions:
masked_targets_pred()
masked_tokens_pred_tbl("The [MASK] doesn't fall far from the tree.",
model = "bert-base-uncased"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.