splitter | R Documentation |
A utility function for use with n-gram modeling. This function splits a string based on various options.
splitter( string, split.char = FALSE, split.space = TRUE, spacesep = "_", split.punct = FALSE )
string |
An input string. |
split.char |
Logical; should a split occur after every character? |
split.space |
Logical; determines if spaces should be preserved as characters in
the n-gram tokenization. The character(s) used for spaces are
determined by the |
spacesep |
The character(s) to represent a space in the case that
|
split.punct |
Logical; determines if splits should occur at punctuation. |
Note that choosing split.char=TRUE
necessarily implies
split.punct=TRUE
as well — but not necessarily that
split.space=TRUE
.
A string.
x = "watch out! a snake!" splitter(x, split.char=TRUE) splitter(x, split.space=TRUE, spacesep="_") splitter(x, split.punct=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.