Difference between R tm package stemDocument function behavior and original Porter stemming algorithm

517 views Asked by At

Using R's stemDocument function from the tm package (see session info below) I get:

library(tm)
stemDocument("cmos")
[1] "cmos"

However when using this implementation in Java and when using this "online Porter stemmer" the result of stemming "cmos" would be: "cmo".

Also in the original article the Step 1a rule says:

Step 1a

SSES -> SS                         caresses  ->  caress
IES  -> I                          ponies    ->  poni
                                   ties      ->  ti
SS   -> SS                         caress    ->  caress
S    ->                            cats      ->  cat

Meaning that a string "cmos" ending with "s" should be stemmed to "cmo", deleting the "s".

So why is R's stemDocument function behavior different?

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tm_0.6    NLP_0.1-5

loaded via a namespace (and not attached):
[1] parallel_3.1.2  slam_0.1-32     SnowballC_0.5.1 tools_3.1.2
0

There are 0 answers