首先在安装Rwordseg之前必须先安装rJava:
install.packages("rJava")
试开URL’http://cran.rstudio.com/bin/macosx/mavericks/contrib/3.1/rJava_0.9-7.tgz‘
Content type ‘application/x-gzip‘ length 600926 bytes (586 Kb)
打开了URL
==================================================
downloaded 586 Kb
The downloaded binary packages are in
/var/folders/mx/jphh0hh52vx60r0tzbkm5qzw0000gn/T//Rtmp5vyeHm/downloaded_packages
library(rJava)
安装Rwordseg,在安装的时候会如下的报警信息出现:
install.packages("Rwordseg", repos = "http://R-Forge.R-project.org", type = "source")
试开URL’http://R-Forge.R-project.org/src/contrib/Rwordseg_0.2-1.tar.gz‘
Content type ‘application/x-gzip‘ length 5445754 bytes (5.2 Mb)
打开了URL
==================================================
downloaded 5.2 Mb
* installing *source* package ‘Rwordseg’ ...
** R
** demo
** inst
** preparing package for lazy loading
警告: package ‘rJava’ was built under R version 3.1.3
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
The downloaded source packages are in
‘/private/var/folders/mx/jphh0hh52vx60r0tzbkm5qzw0000gn/T/Rtmp5vyeHm/downloaded_packages’
警告: package ‘rJava’ was built under R version 3.1.3
2015-9-29 21:16:55 org.ansj.util.MyStaticValue <clinit>
: not find library.properties in classpath use it by default !
2015-9-29 21:16:55 org.ansj.library.UserDefineLibrary loadLibrary
: init userLibrary waring :library/default.dic because : not find that file or can not to read !
2015-9-29 21:16:55 org.ansj.library.UserDefineLibrary initAmbiguityLibrary
: init ambiguity waring :library/ambiguity.dic because : not find that file or can not to read !
2015-9-29 21:16:55 org.ansj.library.UserDefineLibrary loadFile
: init user userLibrary ok path is : /Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rwordseg/config/userdic
2015-9-29 21:16:58 org.ansj.library.InitDictionary init
: init core library ok use time :2436
2015-9-29 21:16:59 org.ansj.library.NgramLibrary <clinit>
: init ngram ok use time :1063
* DONE (Rwordseg)
library(Rwordseg)
# Version: 0.2-1
2015-9-29 21:17:11 org.ansj.util.MyStaticValue <clinit>
: not find library.properties in classpath use it by default !
2015-9-29 21:17:11 org.ansj.library.UserDefineLibrary loadLibrary
: init userLibrary waring :library/default.dic because : not find that file or can not to read !
2015-9-29 21:17:11 org.ansj.library.UserDefineLibrary initAmbiguityLibrary
: init ambiguity waring :library/ambiguity.dic because : not find that file or can not to read !
2015-9-29 21:17:11 org.ansj.library.UserDefineLibrary loadFile
: init user userLibrary ok path is : /Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rwordseg/config/userdic
2015-9-29 21:17:13 org.ansj.library.InitDictionary init
: init core library ok use time :2112
2015-9-29 21:17:14 org.ansj.library.NgramLibrary <clinit>
: init ngram ok use time :1045
验证是否安装成功:
> segmentCN(‘ 花儿为什么这样红‘)
[1] "花儿" "为什么" "这样" "红"