mecabのbuild
repository がgithubに移行。 ipadic をconfigureする時に、--with-mecab-config="xxx"が必要。
$ git clone https://github.com:taku910/mecab.git $ cd mecab/mecab $ ./configure --with-charset=utf8 --enable-utf8-only $ make $ make check $ sudo make install $ cd ../.. $ wget http://sourceforge.net/projects/mecab/files/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz $ tar zxvf mecab-ipadic-2.7.0-20070801.tar.gz $ cd mecab-ipadic-2.7.0-20070801 $ which mecab-config /usr/local/bin/mecab-config $ ./configure --with-mecab-config=/usr/local/bin/mecab-config --with-charset=utf8 $ make $ sudo make install
import ( "io" "os/exec" ) func mecabCmd(w io.Writer, r io.Reader, dic string) error { cmd := exec.Command("mecab", "-d", dic) cmd.Stdin = r cmd.Stdout = w err := cmd.Run() if err != nil { return err } return nil }