if (FALSE) {
# text_init() # initialize the environment
model = "distilbert-base-cased"
text_unmask("Beijing is the [MASK] of China.", model)
# multiple [MASK]s:
text_unmask("Beijing is the [MASK] [MASK] of China.", model)
# multiple queries:
text_unmask(c("The man worked as a [MASK].",
"The woman worked as a [MASK]."),
model)
# specific targets:
text_unmask("The [MASK] worked as a nurse.", model,
targets=c("man", "woman"))
}
Run the code above in your browser using DataLab