as_sbo_dictionary {sbo}R Documentation

Coerce to dictionary

Description

Coerce objects to sbo_dictionary class.

Usage

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

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

[Package sbo version 0.5.0 Index]