[PYTHON] Install CaboCha without root privileges.

This is a method to install CaboCha [^ 1] without root privileges. To install Cabocha

--CRF ++ (0.55 or later) [^ 2] --MeCab (0.993 or later) [^ 3]

Is required, so it is installed together in advance.

Verification environment

Create installation location

Create a location in ~ / usr to install CRF ++, MeCab, CaboCha.

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

CRF ++ installation

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

Install MeCab

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

Download IPA dictionary

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

Operation check

$ echo "Of the thighs and thighs" | ~/usr/bin/mecab
Plum noun,General,*,*,*,*,Plum,Plum,Plum
Also particles,Particle,*,*,*,*,Also,Mo,Mo
Peach noun,General,*,*,*,*,Peaches,peach,peach
Also particles,Particle,*,*,*,*,Also,Mo,Mo
Peach noun,General,*,*,*,*,Peaches,peach,peach
Particles,Attributive,*,*,*,*,of,No,No
Noun,Non-independent,Adverbs possible,*,*,*,home,Uchi,Uchi
EOS

Install CaboCha

Download cabocha-0.69.tar.bz2. If you want to download the latest version, please search from the following.

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

Operation check

$ echo "Your reporter returned by train" | cabocha
Your company-D    
Reporter---D
By train-D
Returned to work
EOS

References

[^ 1]: Kudo et al., CaboCha / Pumpkin: Yet Another Japanese Dependency Structure Analyzer

Recommended Posts

Install CaboCha without root privileges.
Install pgcli at FreeBSD without root
[Linux] Install Python 3 without administrator privileges
Install the python module with pip on a server without root privileges
Stray build Python-3.8.5 on CentOS without root privileges
Install openblas (without apt-get)
Installation from python, numpy, scipy sources without root privileges on Linux
Install AWS CLI v2 without sudo
Install PyStan on Windows without Anaconda
How to install MeCab (v0.996) and libraries for Python without administrator privileges