macにYamChaをインストール

YamChaが必要になったので,今からインストールする.

YamChaとは...

YamCha is a generic, customizable, and open source text chunker oriented toward a lot of NLP tasks, such as POS tagging, Named Entity Recognition, base NP chunking, and Text Chunking. YamCha is using a state-of-the-art machine learning algorithm called Support Vector Machines (SVMs), first introduced by Vapnik in 1995.

TinySVMのインストール

YamChaには,TinySVMというものが必要らしい.
ソースを拾ってきて,configureの後,makeしてみる...が,エラー.

c++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -mieee-fp -c param.cpp -fno-common -DPIC -o .libs/param.lo
./getopt.h:131: error: declaration of C function 'int getopt()' conflicts with
/usr/include/unistd.h:454: error: previous declaration 'int getopt(int, char* const*, const char*)' here

ググってみると,./src/getopt.hの131行目を以下のように修正しないといけないらしい.

/* extern int getopt (); */ /* こちらが元の */
extern int getopt (int argc, char *const *argv, const char *shortopts);

それと,./libtoolのL184の\$CCをg++に変更.
そしたら,問題なくインストールできましたとさ.

YamChaのインストール

さて,次は本題のYamCha.
./configureをすると,以下のエラーが出た.

configure: error: svm_learn (TinySVM or SVM^light) required for training

TinySVMの場所が分からなかったらしい.
後は,下のコマンドを順に実行したらすんなりといけた.

./configure --with-svm-learn=/usr/local/bin
make
sudo make install