as_sbo_dictionary(x,...)## S3 method for class 'character'as_sbo_dictionary(x, .preprocess = identity, EOS ="",...)
Arguments
x: object to be coerced.
...: further arguments passed to or from other methods.
.preprocess: a function for corpus preprocessing.
EOS: a length one character vector listing all (single character) end-of-sentence tokens.
Returns
A sbo_dictionary object.
Details
This function is an S3 generic for coercing existing objects to sbo_dictionary class objects. Currently, only a method for character vectors is implemented, and this will be described below.
Character vector input: Calling as_sbo_dictionary(x) simply decorates the character vector x with the class sbo_dictionary attribute, and with customizable .preprocess and EOS attributes.
Examples
dict <- as_sbo_dictionary(c("a","b","c"), .preprocess = tolower, EOS =".")