Description Usage Arguments Value See Also Examples
This function replaces contractions with long form.
1 2 3 | replace_contraction(text.var,
contraction = qdap::contractions, replace = NULL,
ignore.case = TRUE, sent.cap = TRUE)
|
text.var |
The text variable. |
contraction |
A two column key of contractions (column 1) and expanded form replacements (column 2) or a vector of contractions. Default is to use qdap's contractions data set. |
replace |
A vector of expanded form replacements if a data frame is not supplied to the contraction argument. |
ignore.case |
logical. If TRUE replaces without regard to capitalization. |
sent.cap |
logical. If TRUE capitalizes the beginning of every sentence. |
Returns a vector with contractions replaced.
bracketX
, qprep
,
replace_abbreviation
,
replace_number
,
replace_symbol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | x <- c("Mr. Jones isn't going.",
"Check it out what's going on.",
"He's here but didn't go.",
"the robot at t.s. wasn't nice",
"he'd like it if i'd go away")
replace_contraction(x)
#create abbreviation and replacement vectors
abv <- c("isn't", "I'd")
repl <- c("is not", "I would")
replace_abbreviation(x, abv, repl)
(KEY <- rbind(abbreviations, data.frame(abv = abv, rep = repl)))
replace_abbreviation(x, KEY)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.