Description Usage Arguments Details Value Examples
If you feed a tagged text object to this function, its text will be transformed into
a format used for cloze deletion tests. That is,
by default every fifth word (or as specified by
every
) will be replaced by a line. You can also set an offset value to specify where
to begin.
1 2 3 4 | clozeDelete(obj, ...)
## S4 method for signature 'kRp.text'
clozeDelete(obj, every = 5, offset = 0, replace.by = "_", fixed = 10)
|
obj |
An object of class |
... |
Additional arguments to the method (as described in this document). |
every |
Integer numeric, setting the frequency of words to be manipulated. By default, every fifth word is being transformed. |
offset |
Either an integer numeric,
sets the number of words to offset the transformations. Or the
special keyword |
replace.by |
Character, will be used as the replacement for the removed words. |
fixed |
Integer numberic,
defines the length of the replacement ( |
The option offset="all"
will not return one single object,
but print the results after iterating
through all possible offset values.
An object of class kRp.text
with the added feature diff
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # code is only run when the english language package can be loaded
if(require("koRpus.lang.en", quietly = TRUE)){
sample_file <- file.path(
path.package("koRpus"), "examples", "corpus", "Reality_Winner.txt"
)
tokenized.obj <- tokenize(
txt=sample_file,
lang="en"
)
tokenized.obj <- clozeDelete(tokenized.obj)
pasteText(tokenized.obj)
# diff stats are now part of the object
hasFeature(tokenized.obj)
diffText(tokenized.obj)
} else {}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.