Description Usage Arguments Value References Examples
View source: R/replace_word_elongation.R
In informal writing people may use a form of text embellishment to emphasize
or alter word meanings called elongation (a.k.a. "word lengthening"). For
example, the use of "Whyyyyy" conveys frustration. Other times the usage may
be to be more sexy (e.g., "Heyyyy there"). Other times it may be used for
emphasis (e.g., "This is so gooood"). This function uses an augmented form
of Armstrong & Fogarty's (2007) algorithm. The algorithm first attempts to
replace the elongation with known semantic replacements (optional; default is
FALSE
). After this the algorithm locates all places were the same
letter (case insensitive) appears 3 times consecutively. These elements are
then further processed. The matches are replaced via fgsub
by first
taking the elongation to it's canonical form (drop all > 1 consecutive
letters to a single letter) and then replacing with the most common word
used in 2008 in Google's ngram data set that takes the canonical form. If
the canonical form is not found in the Google data set then the canonical
form is used as the replacement.
1 | replace_word_elongation(x, impart.meaning = FALSE, ...)
|
x |
The text variable. |
impart.meaning |
logical. If |
... |
ignored. |
Returns a vector with word elongations replaced.
Armstrong, D. B., Fogarty, G. J., & Dingsdag, D. (2007). Scales measuring
characteristics of small business information systems. Proceedings of the
2011 Conference on Empirical Methods in Natural Language Processing (pp.
562-570). Edinburgh, Scotland. Retrieved from
http://www.aclweb.org/anthology/D11-1052
http://storage.googleapis.com/books/ngrams/books/datasetsv2.html
https://www.theatlantic.com/magazine/archive/2013/03/dragging-it-out/309220
https://english.stackexchange.com/questions/189517/is-there-a-name-term-for-multiplied-vowels
1 2 3 4 5 6 | x <- c('look', 'noooooo!', 'real coooool!', "it's sooo goooood", 'fsdfds',
'fdddf', 'as', "aaaahahahahaha", "aabbccxccbbaa", 'I said heyyy!',
"I'm liiiike whyyyyy me?", "Wwwhhatttt!", NA)
replace_word_elongation(x)
replace_word_elongation(x, impart.meaning = TRUE)
|
[1] "look" "no!" "real cool!" "it's so good"
[5] "fsdfds" "fdf" "as" "ahahahahaha"
[9] "aabbccxccbbaa" "I said hey!" "I'm like why me?" "what!"
[13] NA
[1] "look" "sarcastic!"
[3] "real cool!" "it's so good"
[5] "fsdfds" "fdf"
[7] "as" "ahahahahaha"
[9] "aabbccxccbbaa" "I said hey sexy!"
[11] "I'm like frustration me?" "what!"
[13] NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.