2014-05-07 40 views
1

我使用stemDocument爲制止在R.示例代碼使用tm包文本文檔:Snowball&SnowballC軟件包在R中有何不同?

data("crude") 
crude[[1]] 
stemDocument(crude[[1]]) 

我得到一個錯誤信息:

錯誤loadNamespace(名稱):沒有呼包'雪球'

我安裝了SnowballC包並找不到雪球包。以下是我的sessionInfo()

R version 2.15.3 (2013-03-01) 
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) 

locale: 
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 

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

other attached packages: 
[1] SnowballC_0.5 tm_0.5-8.3 

loaded via a namespace (and not attached): 
[1] slam_0.1-31 tools_2.15.3 

是否需要其他包裝或雪球?

+2

你應該看看[這個問題](http://stackoverflow.com/questions/23379961/alternatives-to-snowball-for-stemming-text-in-r?rq=1)。評論表明可能需要更新'tm'。 – Joe

回答

5

您有舊版本的pkg:tm。當前版本的tm有一個描述文件,它將SnowballC列爲「建議」。較早的版本建議雪球。

Package: tm 
Title: Text Mining Package 
Version: 0.5-10 
Date: 2014-01-07 
[email protected]: c(person("Ingo", "Feinerer", role = c("aut", "cre"), 
        email = "[email protected]"), 
      person("Kurt", "Hornik", role = "aut"), 
      person("Artifex Software, Inc.", role = c("ctb", "cph"), 
        comment = "pdf_info.ps taken from GPL Ghostscript")) 
Depends: R (>= 2.14.0) 
Imports: parallel, slam (>= 0.1-31) 
Suggests: filehash, proxy, Rcampdf, Rgraphviz, Rpoppler, SnowballC, XML 

這是你目前從CRAN得到消息:你應該更新的tm當前版本

Package ‘Snowball’ was removed from the CRAN repository. 

Formerly available versions can be obtained from the archive. 

Archived on 2014-03-16 at the request of the maintainer. 

。試試這個:

update.packages("tm", checkBuilt = TRUE) 
+0

感謝您的建議。這真的很有幫助。更新tm軟件包沒有用。但是將R從2.15.3更新到3.1,然後安裝tm包和SnowballC確實有效。 – Ram

3

只是嘗試將SnowballC包安裝至R

install.packages("SnowballC") 

library(SnowballC) 

它應該工作。