since 2012-01-30
Natural Language Toolkit
python ベースのパッケージ。
Mac OS X 10.6.8 マシンで macports 環境を構築。
sudo port install python27 sudo port install py27-nltk
python2.7 という実行ファイルの中で import nltk できるようになる:
$ which python /usr/bin/python $ which python2.7 /opt/local/bin/python2.7 $ python Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import nltk Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named nltk $ python2.7 Python 2.7.2 (default, Jan 13 2012, 17:11:09) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import nltk >>>
nltk.downloader() で book を選んだらエラーになった。下記のやり方で成功した:
$ python2.7 -m nltk.downloader book ... [nltk_data] | [nltk_data] Done downloading collection 'book'
調子に乗って sudo port install py27-scipy したら gcc44 を入れ始めた。重そうである。。
nltk.classify