nkf python インターフェースのインストール
インストール方法
$ mkdir temp # 作業用ディレクトリの作成 $ cd temp # http://sourceforge.jp/projects/nkf/ から nkf-2.1.1.tar.gz をダウンロード temp$ tar zxvf nkf-2.1.1.tar.gz temp$ cd nkf-2.1.1/ temp/nkf-2.1.1$ wget ftp://city.plala.jp:1221/NkfPython/NKF_python20090602.tgz temp/nkf-2.1.1$ tar zxvf NKF_python20090602.tgz temp/nkf-2.1.1$ cd NKF.python/ temp/nkf-2.1.1/NKF.python$ sudo python setup.py install # Python.h: No such file or directory と表示された場合は、以下を実行する # sudo aptitude install python-dev temp/nkf-2.1.1/NKF.python$ cd ../../../ $ sudo rm -rf temp
使用方法
import nkf flag = '-w' output = nkf.nkf(flag, input_text) input_code = nkf.guess(input_text)