0
你好:我如何获得R键来替换“无”与“不是”,但不能代替“不”与“诺特”匹配的原话与stri_replace_all_fixed
下面的代码工作得很好,我现在的词典,但不与另一个字典,用一些标准化的词取代否定词。
#patterns
replace<-('no')
#replacements
with<-c('not')
#data frame
neg<-data.frame(replace=replace, with=with)
#text to modify
out<-c('not acceptable no good')
#current code
stri_replace_all_fixed(out, neg$replace, neg$with, vectorize_all=FALSE)
我需要担心在文本周围“不”的空白?或者这个词边界帐户呢? – spindoctor
字边界是不消耗文本的零宽度断言,不应该有空白问题。 –