【发布时间】:2014-07-03 09:59:43
【问题描述】:
我知道如何分别去掉标点和保留撇号:
gsub( "[^[:alnum:]']", " ", db$text )
或如何在 tm 包中保留字内破折号:
removePunctuation(db$text, preserve_intra_word_dashes = TRUE)
但我找不到同时做这两个的方法。例如如果我的原句是:
"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"
我希望它是:
"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"
当然,会有多余的空格,但我可以稍后删除它们。
我会很感激你的帮助。
【问题讨论】: