Learn R Programming

sbo (version 0.5.0)

as_sbo_dictionary: Coerce to dictionary

Description

Coerce objects to sbo_dictionary class.

Usage

as_sbo_dictionary(x, ...)

# S3 method for 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.

Value

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

Run this code
# NOT RUN {
dict <- as_sbo_dictionary(c("a","b","c"), .preprocess = tolower, EOS = ".")
# }

Run the code above in your browser using DataLab