【问题标题】:How to replace the past word with the current word如何用当前单词替换过去的单词
【发布时间】:2017-08-17 11:45:25
【问题描述】:

用现在词替换过去词时应该使用什么命令?

得到,得到,(得到)->得到

去,去(去)->去

想 -> 想

购买 -> 购买

我想用这种方式替换为当前单词。

感谢您对我的代码提出建议。

library(tm)
library(XML)
crudeCorp<-VCorpus(VectorSource(readLines(file.choose())))
crudeCorp <- tm_map(crudeCorp, stripWhitespace) 

我知道下面的命令会把过去的动词变成现在的形式。不过,我输入这个命令后,看了看。还有一个过去的词。

crudeCorp <- tm_map(crudeCorp, stemDocument)

【问题讨论】:

  • @G.Grothendieck 谢谢。我修好了。
  • 没有人可以运行您的代码,因为没有提供输入并且预期的输出不清楚。

标签: r text nlp lemmatization


【解决方案1】:

我认为你需要词干:

docs <- tm_map(crudeCorp , PlainTextDocument) 
    tm_map(docs, stemDocument, "english")

【讨论】:

  • 我真的很抱歉我忘了提到问题的例子。您如何处理有关“思考”、“购买”的词语?
猜你喜欢
  • 2020-03-27
  • 1970-01-01
  • 1970-01-01
  • 2019-10-28
  • 1970-01-01
  • 1970-01-01
  • 2021-12-29
  • 1970-01-01
  • 2015-03-02
相关资源
最近更新 更多