-4

What commands should I use when replacing a past word with a present word?

got, gotten, (getting) -> get

go, went (going)->go

thought -> think

bought -> buy

I want to replace it with the current word in this way.

I would appreciate your advice on my code.

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

I knew that the following command would change the past verb into the present form. However, after I entered this command, I looked at it. There is still a past word.

crudeCorp <- tm_map(crudeCorp, stemDocument)
Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
jiji
  • 125
  • 1
  • 3
  • 9

1 Answers1

0

I think you need to stem words :

docs <- tm_map(crudeCorp , PlainTextDocument) 
    tm_map(docs, stemDocument, "english")
R.B
  • 482
  • 2
  • 13
  • I am really sorry that I forgot to mention the example of the question. How do you handle words about "think", "buy"? – jiji Aug 17 '17 at 12:08