
Last chance! 50% off unlimited learning
Sale ends in
Prepare a data.table of queries and variables for the FMAT.
FMAT_query(
query = "Text with [MASK], optionally with {TARGET} and/or {ATTRIB}.",
MASK = .(),
TARGET = .(),
ATTRIB = .()
)
A data.table of queries and variables.
Query text (should be a character string/vector
with at least one [MASK]
token).
Multiple queries share the same set of
MASK
, TARGET
, and ATTRIB
.
For multiple queries with different
MASK
, TARGET
, and/or ATTRIB
,
please use FMAT_query_bind
to combine them.
A named list of [MASK]
target words.
Must be single words in the vocabulary of a certain masked language model.
For model vocabulary, see, e.g., https://huggingface.co/bert-base-uncased/raw/main/vocab.txt
Infrequent words may be not included in a model's vocabulary,
and in this case you may insert the words into the context by
specifying either TARGET
or ATTRIB
.
A named list of Target/Attribute words or phrases.
If specified, then query
must contain
{TARGET}
and/or {ATTRIB}
(in all uppercase and in braces)
to be replaced by the words/phrases.
FMAT_load
FMAT_query_bind
FMAT_run
FMAT_query("[MASK] is a nurse.", MASK = .(Male="He", Female="She"))
FMAT_query(
c("[MASK] is {TARGET}.", "[MASK] works as {TARGET}."),
MASK = .(Male="He", Female="She"),
TARGET = .(Occupation=c("a doctor", "a nurse", "an artist"))
)
FMAT_query(
"The [MASK] {ATTRIB}.",
MASK = .(Male=c("man", "boy"),
Female=c("woman", "girl")),
ATTRIB = .(Masc=c("is masculine", "has a masculine personality"),
Femi=c("is feminine", "has a feminine personality"))
)
Run the code above in your browser using DataLab