This function reads an object of the class tokens from a text file, typically
stored with write_tokens(). The text file is assumed to contain one token on
each line and not to have a header.
Arguments
- file
Name of the input file.
- file_encoding
Encoding to read the input file.
- ...
Additional arguments (not implemented).
Value
An object of class tokens.
See also
Other reading functions:
read_assoc(),
read_conc(),
read_fnames(),
read_freqlist(),
read_txt(),
read_types()
Examples
.old_wd <- setwd(tempdir())
(tks <- tokenize("The old man and the sea."))
#> Token sequence of length 6
#> idx token
#> --- -----
#> 1 the
#> 2 old
#> 3 man
#> 4 and
#> 5 the
#> 6 sea
write_tokens(tks, "file_with_tokens.txt")
(tks2 <- read_tokens("file_with_tokens.txt"))
#> Token sequence of length 6
#> idx token
#> --- -----
#> 1 the
#> 2 old
#> 3 man
#> 4 and
#> 5 the
#> 6 sea
setwd(.old_wd)
