I know how to separately remove punctuation and keep apostrophes:
gsub( "[^[:alnum:]']", " ", db$text )
or how to save a dash in text input mode using the tm package:
removePunctuation(db$text, preserve_intra_word_dashes = TRUE)
but I canβt find a way to do this at the same time. For example, if my initial sentence is:
"Interested in energy/the environment/etc.? Congrats to our new e-board! Ben, Nathan, Jenny, and Adam, y'all are sure to lead the club in a great direction next year! #obama #swag"
I would like to:
"Interested in energy the environment etc Congrats to our new e-board Ben Nathan Jenny and Adam y'all are sure to lead the club in a great direction next year obama swag"
Of course, there will be extra spaces, but I can remove them later.
I would be grateful for your help.
source
share