ishida
unread,Aug 28, 2010, 3:28:23 AM8/28/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RCaBoCha
RCaBoCha_0.26Beta公開しました.
かなり大きな変更を加えました.要点は,
1)係り受けをすべて抽出する
2)mecabrcリソースファイルを指定可能に
3)RCaBoCha では 0 オプションでTreeを表示しない
ようにしたことです.
CaBoChaそのものが,かなり遅いので,ファイルが大きくなると
解析にも相応に時間がかかりますので注意してください.
mecabrcファイルの指定する場合,ファイルの設定内容に
十分ご注意ください
#####################################################
# RCaBoCha( 関数)
#####################################################
RCaBoCha("それは面白い本であった。",0)# Tree を出さない
RCaBoCha("それは面白い本であった。",mecabrc="/Users/motohiro/.mecabrc")# mecabrc を指
定
#####################################################
# RCaBoChaDF() 関数
#####################################################
## データフレームから文書ターム行列を作成する。
##
# RCaBoCha_0.25 までの rmT str2 は廃止しました
# 引数 pos =c("記号","助詞") などで抽出する品詞を指定できます
# 引数 minFreq で文書全体を通しての最小頻度を指定できます
dat <- read.csv("H18koe.csv") ## 沖縄観光についての自由意見
res <- RCaBoChaDF(dat[,"opinion"])##やや時間がかかります
nrow(res)
# [1] 2263
head(res[200:205, 1:5])
# TERM POS1 POS2 ROW3 ROW4
#200 どこ+店 名詞+名詞 代名詞+名詞 0 0
#201 どちら+下車 名詞+名詞 代名詞+名詞 0 0
#202 どれ+の 名詞+名詞 代名詞+名詞 0 0
#203 どれ+料理 名詞+名詞 代名詞+名詞 0 0
#204 どれ+沖縄 名詞+名詞 代名詞+名詞 0 0
#205 ない+こと 助動詞+名詞 *+名詞 0 0
res <- RCaBoChaDF(dat[,"opinion"], pos = c("名詞","形容詞","動詞"))###やや時間がかかり
ます
nrow(res)
res <- RCaBoChaDF(dat[,"opinion"], pos = c("名詞","形容詞","動詞"), mecabrc =
"/Users/motohiro/.mecabrc")
#####################################################
# RCaBoChaMx() 関数
#####################################################
## ファイルあるいはディレクトリから文書ターム行列を作成。
# RCaBoCha_0.25 までの rmT str2 は廃止しました
# 引数 pos =c("記号","助詞") などで抽出する品詞を指定できます
# さらに引数 minFreq で文書全体を通しての最小頻度をしてできます
res <- RCaBoChaMx("morikita")
## file_name = morikita/morikita1.txt opened
## file_name = morikita/morikita2.txt opened
## file_name = morikita/morikita3.txt opened
nrow(res)## [1] 66
res[50:55,]
# TERM POS1 POS2 morikita1.txt morikita2.txt
#50 科学+者 名詞+名詞 一般+名詞 0 0
#51 系+化 名詞+名詞 接尾+名詞 1 0
#52 系+特 名詞+名詞 接尾+名詞 1 0
#53 編曲+感じ 名詞+名詞 サ変接続+名詞 0 1
#54 編集+感じ 名詞+名詞 サ変接続+名詞 0 1
#55 者+企業 名詞+名詞 接尾+名詞 0 1
# morikita3.txt
#50 1
#51 0
#52 0
#53 0
#54 0
#55 0
res <- RCaBoChaMx("morikita",pos = c("名詞","形容詞","動詞"))###やや時間がかかります
nrow(res)
#res <- RCaBoChaMx("morikita",pos = c("名詞","形容詞","動詞"), mecabrc = "/
Users/motohiro/mecabrc")