negation handling in R, how can I replace a word following a negation in R?
问题 I'm doing sentiment analysis for financial articles. To enhance the accuracy of my naive Bayes classifier, I'd like to implement negation handling. Specifically, I want to add the prefix "not_" to the word following a "not" or "n't" So if there's something like this in my corpus: x <- "They didn't sell the company." I want to get the following: "they didn't not_sell the company." (the stopword "didn't" will be removed later) I could find only the gsub() function, but it doesn't seem to work