Help us understand the problem. What is going on with this article?

root権限なしでCaboChaをインストールする.

More than 3 years have passed since last update.

root権限がない状況でCaboCha1をインストールする方法です.Cabochaをインストールするためには

  • CRF++ (0.55以降)2
  • MeCab (0.993以降)3

が必要なので事前に併せてインストールしています.

検証環境

  • Ubuntu 16.04.3 LTS

インストール場所の作成

CRF++,MeCab,CaboChaをインストールするための場所を~/usrに作ります.

echo "export PATH=$HOME/usr/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=${HOME}/usr/lib" >> ~/.bashrc
source ~/.bashrc
mkdir $HOME/usr

CRF++のインストール

wget 'https://docs.google.com/uc?export=download&id=0B4y35FiV1wh7QVR6VXJ5dWExSTQ' -O CRF++-0.58.tar.gz
tar xf CRF++-0.58.tar.gz
cd CRF++-0.58/
./configure --prefix=$HOME/usr
make
make install

MeCabのインストール

git clone https://github.com/taku910/mecab.git
cd mecab/mecab
./configure --prefix=$HOME/usr --with-charset=UTF8 
make
make install

IPA辞書のダウンロード

wget 'https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM' -O mecab-ipadic-2.7.0-20070801.tar.gz
tar xvzf mecab-ipadic-2.7.0-20070801.tar.gz
cd mecab-ipadic-2.7.0-20070801/
./configure --with-mecab-config=$HOME/usr/bin/mecab-config --with-charset=UTF8 --prefix=$HOME/usr 
make
make install

動作確認

$ echo "すもももももももものうち" | ~/usr/bin/mecab
すもも   名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも  名詞,一般,*,*,*,*,もも,モモ,モモ
も 助詞,係助詞,*,*,*,*,も,モ,モ
もも  名詞,一般,*,*,*,*,もも,モモ,モモ
の 助詞,連体化,*,*,*,*,の,ノ,ノ
うち  名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
EOS

CaboChaのインストール

cabocha-0.69.tar.bz2をダウンロードします.最新版をダウンロードしたい場合は下記から探してください.

https://drive.google.com/drive/u/1/folders/0B4y35FiV1wh7cGRCUUJHVTNJRnM

curl -sc /tmp/gcokie "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7SDd1Q1dUQkZQaUU" > /dev/null
getcode="$(awk '/_warning_/ {print $NF}' /tmp/gcokie)"  
curl -Lb /tmp/gcokie "https://drive.google.com/uc?export=download&confirm=${getcode}&id=0B4y35FiV1wh7SDd1Q1dUQkZQaUU" -o cabocha-0.69.tar.bz2
tar xvf cabocha-0.69.tar.bz2
cd cabocha-0.69
export LDFLAGS="-L$HOME/usr/lib"
export CPPFLAGS="-I$HOME/usr/include"
./configure --with-mecab-config=$HOME/usr/bin/mecab-config --with-charset=UTF8 --prefix=$HOME/usr
make
make install
cd python
python setup.py build
python setup.py --user install

動作確認

$ echo "貴社の記者が汽車で帰社した" | cabocha
  貴社の-D    
    記者が---D
      汽車で-D
      帰社した
EOS

References

namakemono
MNES Engineer Kaggle Expert
https://www.mnes.org/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした