2012年5月3日木曜日

RMeCab (code)


* write.table()

Rの内部にあるデータフレーム x を外部に「テキストファイル」で保存する write.table ( x, "ファイル名.txt" )

> write.table ( x, "サンプルデータ.txt" )

と記述し,Rの内部のデータフレーム x を,「サンプルデータ.txt」のファイル名で,Rの外部の「作業ディレクトリ」に保存する.
http://133.100.216.71/R_analysis/output_write_table00.html




* collocate(), collScores(), write.table()

「心」
> res <- collocate("kokoro1_1.txt", node = "先生", span = 5)
> res2 <- collScores(res, node = "先生", span = 5)
> write.table ( res2, "res1_1.txt" )

> res2 <- collocate("kokoro1_2.txt", node = "先生", span = 5)
> res2b <- collScores(res2, node = "先生", span = 5)
> write.table ( res2b, "res1_2.txt" )

> res3 <- collocate("kokoro1_3.txt", node = "先生", span = 5)
> res3b <- collScores(res3, node = "先生", span = 5)
> write.table ( res3b, "res1_3.txt" )





*docMatrix 品詞の抽出

> res <- docMatrix("bigdata", pos = c("名詞","動詞"), weight = "tf*idf*norm")
> write.table ( res, "bigdata.txt" )

> res <- docMatrix("docMatrix", pos = c("名詞"), weight = "tf*idf*norm")
> write.table ( res, "docMatrix.txt" )

> res <- docMatrix("docMatrix", pos = c("名詞"), weight = "tf*idf*norm")
> write.table ( res, "docMatrix2.txt" )





* メモ 2012.05.03

1)docMatrixで"名詞"、"動詞"を別に品詞を抽出して
2)weight="tf"*"idf"*"norm"を実行したものから
3)"名詞"、"動詞"(、"主体"、"状態"、"状況"、"場所"、"時間")を組み合わせて****を描く

どうやって組み合わせるか、相関係数?共起?手を動かしてみる












0 件のコメント:

コメントを投稿