差分
この文書の現在のバージョンと選択したバージョンの差分を表示します。
次のリビジョン | 前のリビジョン | ||
memo:r:rtextmining [2010/05/21 06:48] hasegawa 作成 |
memo:r:rtextmining [2016/07/17 04:22] (現在) |
||
---|---|---|---|
ライン 1: | ライン 1: | ||
- | {{tag>R toolbox memo textmining}} | + | {{tag>R textmining windows osx}} |
====== Rでテキストマイニング ====== | ====== Rでテキストマイニング ====== | ||
===== MeCabとRMeCabのインストール ===== | ===== MeCabとRMeCabのインストール ===== | ||
==== MeCab ==== | ==== MeCab ==== | ||
+ | Windows環境ではバイナリが公開されている. | ||
http://sourceforge.net/projects/mecab/files/ | http://sourceforge.net/projects/mecab/files/ | ||
からmecab-0.98.exe(バージョンは2009/10/15現在)をダウンロードし,インストール(僕はC:\MeCabに入れた). | からmecab-0.98.exe(バージョンは2009/10/15現在)をダウンロードし,インストール(僕はC:\MeCabに入れた). | ||
+ | |||
+ | ____ | ||
+ | 2012/04/28追記 | ||
+ | osx lionでは自分でビルドするか,homebrewでのインストールが便利. | ||
+ | |||
+ | ビルドはgccが使えさえすればマニュアル通りで大丈夫. | ||
+ | |||
+ | homebrewのインストール過程でアンインストールしたので,改めてhomebrewを使ってMeCabをインストールする. | ||
+ | $ brew install mecab | ||
+ | ==> Downloading http://mecab.googlecode.com/files/mecab-0.993.tar.gz | ||
+ | ######################################################################## 100.0% | ||
+ | ==> ./configure --prefix=/usr/local/Cellar/mecab/0.993 | ||
+ | ==> make install | ||
+ | Error: The linking step did not complete successfully | ||
+ | The formula built, but is not symlinked into /usr/local | ||
+ | You can try again using `brew link mecab' | ||
+ | ==> Summary | ||
+ | /usr/local/Cellar/mecab/0.993: 17 files, 2.9M, built in 46 seconds | ||
+ | すごく楽.辞書もインストール | ||
+ | $ brew install mecab-ipadic | ||
+ | Error: You must `brew link mecab' before mecab-ipadic can be installed | ||
+ | 指示に従い実行 | ||
+ | $ brew link mecab | ||
+ | Linking /usr/local/Cellar/mecab/0.993... | ||
+ | Error: Could not symlink file: /usr/local/Cellar/mecab/0.993/etc/mecabrc | ||
+ | Target /usr/local/etc/mecabrc already exists. You may need to delete it. | ||
+ | 前に自分でビルドした時の残骸が残っているみたいだ.はい,消します. | ||
+ | $ rm -f /usr/local/etc/mecabrc | ||
+ | $ brew link mecab | ||
+ | Linking /usr/local/Cellar/mecab/0.993... | ||
+ | Error: Could not symlink file: /usr/local/Cellar/mecab/0.993/bin/mecab-config | ||
+ | Target /usr/local/bin/mecab-config already exists. You may need to delete it. | ||
+ | はい,消します. | ||
+ | $ rm -f /usr/local/bin/mecab-config | ||
+ | 同じ流れで | ||
+ | $ rm -f /usr/local/share/man/man1/mecab.1 | ||
+ | も削除.改めて | ||
+ | $ brew link mecab | ||
+ | Linking /usr/local/Cellar/mecab/0.993... 4 symlinks created | ||
+ | OK.さあ辞書だ | ||
+ | $ brew install mecab-ipadic | ||
+ | ==> Downloading http://downloads.sourceforge.net/project/mecab/mecab-ipadic/2.7. | ||
+ | ######################################################################## 100.0% | ||
+ | ==> ./configure --disable-debug --prefix=/usr/local/Cellar/mecab-ipadic/2.7.0-20 | ||
+ | ==> make install | ||
+ | /usr/local/Cellar/mecab-ipadic/2.7.0-20070801: 5 files, 16K, built in 38 seconds | ||
+ | いやー,楽だ.早速試してみる. | ||
+ | $ mecab | ||
+ | 日本語の文章を形態素解析するとどうなるか?? | ||
+ | 日本語 名詞,一般,*,*,*,*,日本語,ニホンゴ,ニホンゴ | ||
+ | の 助詞,連体化,*,*,*,*,の,ノ,ノ | ||
+ | 文章 名詞,一般,*,*,*,*,文章,ブンショウ,ブンショー | ||
+ | を 助詞,格助詞,一般,*,*,*,を,ヲ,ヲ | ||
+ | 形態素 名詞,一般,*,*,*,*,形態素,ケイタイソ,ケイタイソ | ||
+ | 解析 名詞,サ変接続,*,*,*,*,解析,カイセキ,カイセキ | ||
+ | する 動詞,自立,*,*,サ変・スル,基本形,する,スル,スル | ||
+ | と 助詞,接続助詞,*,*,*,*,と,ト,ト | ||
+ | どう 副詞,助詞類接続,*,*,*,*,どう,ドウ,ドー | ||
+ | なる 動詞,自立,*,*,五段・ラ行,基本形,なる,ナル,ナル | ||
+ | か 助詞,副助詞/並立助詞/終助詞,*,*,*,*,か,カ,カ | ||
+ | ? 記号,一般,*,*,*,*,?,?,? | ||
+ | ? 記号,一般,*,*,*,*,?,?,? | ||
+ | EOS | ||
+ | OK.あ,「ctrl+c」で抜け出せる. | ||
==== RMeCab ==== | ==== RMeCab ==== |