as_sbo_dictionary: Coerce to dictionary

Description Usage Arguments Details Value Author(s) Examples

View source: R/as_sbo_dictionary.R

Description

Coerce objects to sbo_dictionary class.

Usage

1
2
3
4
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.

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.

Value

A sbo_dictionary object.

Author(s)

Valerio Gherardi

Examples

1
dict <- as_sbo_dictionary(c("a","b","c"), .preprocess = tolower, EOS = ".")

sbo documentation built on Dec. 6, 2020, 1:06 a.m.