I found a library called cabocha that can perform dependency analysis, so I tried to play with it for the time being, but if I started touching it with a light feeling, I had a hard time even installing it ... For the time being, I would like to write that I could do this in my environment.
windows 10
VirtualBox 5.1
Ubuntu16.04 LTS
python 3.5.2
Ubuntu is installed in the VM on the windows machine
Execute the following command in the terminal
$ sudo apt-get -y install mecab libmecab-dev mecab-ipadic-utf8 mecab-jumandic-utf8
pip3 install mecab-python3
It seems better to do this just in case
Here Download the latest version from (.tar). Currently it was ver. 0.58. Unzip in a suitable directory. Move.
$ tar zxvf CRF++-0.58.tar.gz
$ cd CRF++-0.58
Fixed because there is a bug
$ vim node.cpp
#include <time.h>(Addition)
Save, close and install
$ ./configure
$ sudo make
$ sudo make install
Download from here. However, the latest version (cabocha-0.69.tar.bz2) failed. There is no choice but to download cabocha-0.60.tar.gz. Unzip in a suitable directory. Move.
$ tar xzvf cabocha-0.60.tar.gz
$ cd cabocha-0.60
Fixed because there is a bug
$ sudo vim /etc/ld.so.conf
include /usr/local/bin (Postscript)
Run
sudo /sbin/ldconfig
Another fix
$ vim src/utils.cpp
utils.cpp
void Unlink(const char *filename) {
#if defined(_WIN32) && !defined(__CYGWIN__)
::DeleteFileA(filename);
#else
//::unlink(filename);Delete
::remove(filename); //Postscript
#endif
}
Save, close and install
$ ./configure --with-mecab-config=`which mecab-config` --with-charset=utf8
$ sudo make clean
$ sudo make
$ sudo make install
$ sudo /sbin/ldconfig
Try running cabocha
$ cabocha
$ (Favorite sentences)
$ sudo apt-get install swig python3-dev
$ cd cabocha-0.60
$ swig -python -shadow -c++ swig/CaboCha.i
$ mv swig/CaboCha.py python/
$ mv swig/CaboCha_wrap.cxx python/
Rewritten to support python3 series
$ cd python
$ vim setup.py
setup.py
def cmd2(str):
#return string.split (cmd1(str))Delete
return cmd1(str).split() #Postscript
Save, close and run
$ sudo python3 setup.py build_ext
$ sudo python3 setup.py install
$ sudo /sbin/ldconfig
$ python3
$ import CaboCha
OK if no error occurs. This completes the installation. Please play appropriately.
Thank you for your hard work. It feels like I touched it lightly, and the accuracy is quite good, and it took some time to install it, but there seems to be a merit worth it. I would like to write a separate article about the results of playing around with it. Let's have a good natural language processing life!
・ Http://taku910.github.io/mecab/ ・ Https://taku910.github.io/cabocha/ ・ Http://qiita.com/nezuq/items/f481f07fc0576b38e81d ・ Http://azwoo.hatenablog.com/entry/2015/10/01/234434 ・ Https://www.trifields.jp/install-cabocha-in-ubuntu-1038
Recommended Posts