[R] Help with stemDocument
Alekseiy Beloshitskiy
abeloshitskiy at velti.com
Thu May 10 18:20:49 CEST 2012
Hi Triss,
If you need to stem just one text in the Corupus use a[[n]]<-stemDocument
Best,
-Alex
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] on behalf of Triss.Ashton [triss.ashton at unt.edu]
Sent: 02 May 2012 21:09
To: r-help at r-project.org
Subject: Re: [R] Help with stemDocument
I am having a problem with stemDocuments also. I can make it work by moving
the data into a Corpus by using:
> a <- Corpus(VectorSource(df$text)) # create corpus object
> a <- tm_map(a, stemDocument, language = "english")
but it is horrably slow. I want to stem outside the Corpus object like:
>df$text <- stemDocument(df$text, language = "english")
but it returns the original text.
In fact, using the example in the tm package documentation does not work
either:
> data("crude")
> crude[[1]]
Diamond Shamrock Corp said that
effective today it had cut its contract prices for crude oil by
1.50 dlrs a barrel.
The reduction brings its posted price for West Texas
Intermediate to 16.00 dlrs a barrel, the copany said.
"The price reduction today was made in the light of falling
oil product prices and a weak crude oil market," a company
spokeswoman said.
Diamond is the latest in a line of U.S. oil companies that
have cut its contract, or posted, prices over the last two days
citing weak oil markets.
Reuter
> stemDocument(crude[[1]], language = "english") # specify language
Diamond Shamrock Corp said that
effective today it had cut its contract prices for crude oil by
1.50 dlrs a barrel.
The reduction brings its posted price for West Texas
Intermediate to 16.00 dlrs a barrel, the copany said.
"The price reduction today was made in the light of falling
oil product prices and a weak crude oil market," a company
spokeswoman said.
Diamond is the latest in a line of U.S. oil companies that
have cut its contract, or posted, prices over the last two days
citing weak oil markets.
Reuter
> stemDocument(crude[[1]]) # language not specified
Diamond Shamrock Corp said that
effective today it had cut its contract prices for crude oil by
1.50 dlrs a barrel.
The reduction brings its posted price for West Texas
Intermediate to 16.00 dlrs a barrel, the copany said.
"The price reduction today was made in the light of falling
oil product prices and a weak crude oil market," a company
spokeswoman said.
Diamond is the latest in a line of U.S. oil companies that
have cut its contract, or posted, prices over the last two days
citing weak oil markets.
Reuter
>
--
View this message in context: http://r.789695.n4.nabble.com/Help-with-stemDocument-tp4554523p4604022.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list