Install CaboCha in Ubuntu environment and call it with Python.

Overview

Install the Japanese dependency parser CaboCha on Linux Mint 13 (Ubuntu 12.04) and install it. Make it callable in Python.

Pre-work

Install MeCab / MeCab dictionary

Install with make

I was allowed to refer to the following site.

-> MeCab / MeCab dictionary download page -> MeCab / MeCab dictionary installation procedure page

Install with apt-get

sudo apt-get install mecab libmecab-dev mecab-utils mecab-ipadic-utf8

work

Install CaboCha

Install with make

I was allowed to refer to the following site.

-> Install yamcha & Cabocha on Ubuntu for forgetful memories

Install with apt-get

I was allowed to refer to the following site.

-> Easy way to install UTF-8 version of cabocha on Ubuntu --Syo-Takasaki's diary

※Caution -The part of "/etc/apt/source.list" may be "/etc/apt/sources.list". ・ After completing the work on the above site, issue the following command.

sudo apt-get install libcabocha-dev

Install CaboCha Python bindings

Move to the installation folder

Find the installation folder for CaboCha. Search the drive for "CaboCha.py" and move to the folder containing the file.

find / -name CaboCha.py

※Caution -If you installed with make, the installation source folder will also be hit in the search.

Run setup.py

Issue the following command and execute setup.py.

sudo python setup.py install

Call CaboCha from Python

Call Cabocha.py


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import CaboCha
c = CaboCha.Parser()
sent = 'After passing through a long tunnel on the border, it was a snow country. The bottom of the night turned white. The train stopped at the signal box.'
print c.parseToString(sent)
Border---D                
long-D                
Tunnel-D              
When you exit-D            
It was a snow country.-----D      
At night-D |      
The bottom is-D      
It turned white.-----D
At the signal box---D
The train-D
Stopped.
EOS

Website that I used as a reference

-> MeCab: Yet Another Part-of-Speech and Morphological Analyzer -> cabocha - Yet Another Japanese Dependency Structure Analyzer - Google Project Hosting -> Install yamcha & Cabocha on Ubuntu for forgetful memories -> Easy way to install UTF-8 version of cabocha on Ubuntu --Syo-Takasaki's diary

Recommended Posts

Install CaboCha in Ubuntu environment and call it with Python.
Install lp_solve on Mac OS X and call it with python.
Install python package in personal environment on Ubuntu
Install Python environment with Anaconda
Build python3 environment with ubuntu 16.04
Install selenium on Mac and try it with python
Install Ubuntu 20.04 with GUI and prepare the development environment
Install Python 2.7.9 and Python 3.4.x with pip.
Install scrapy in python anaconda environment
install tensorflow in anaconda + python3.5 environment
Put Ubuntu in Raspi, put Docker on it, and control GPIO with python from the container
How to install OpenCV on Cloud9 and run it in Python
Install mecab on Sakura shared server and call it from python
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Build Python3 and OpenCV environment on Ubuntu 18.04
Steps to install Python environment on Ubuntu
Dealing with "years and months" in Python
Tweet analysis with Python, Mecab and CaboCha
Call sudo in Python and autofill password
Clean python environment with pythonz and virtualenv
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Call APIGateWay with APIKey in python requests
Introduced sip-4.14 in python3.2.2 environment with MacOS 10.7.4
[Python] I introduced Word2Vec and played with it.
Ubuntu18.04.05 Creating a python virtual environment in LTS
Build python environment with pyenv on EC2 (ubuntu)
Building a python environment with virtualenv and direnv
Create a virtual environment with conda in Python
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
Install pip and pandas with Ubuntu or VScode
Install the python package in an offline environment
Install Python 3.5.1 + numpy + scipy + α in Windows environment
Install gensim in conda environment (and also install mecab)
Work in a virtual environment with Python virtualenv.
Use Python in Anaconda environment with VS Code
POST JSON in Python and receive it in PHP
[Python] Dealing with multiple call errors in ray.init
Install MongoDB on Ubuntu 16.04 and operate via python
Build PyPy and Python execution environment with Docker
[Python] How to save the installed package and install it in a new environment at once Mac environment
virtual environment in python
Python environment with docker-compose
Install python with pyenv
Install Python 3.3 on Ubuntu 12.04
Development environment in Python
Virtual environment with Python 3.6
Periodically execute python script with cron in venv environment
Operate mongoDB from python in ubuntu environment ① Introduction of mongoDB
Japanese can be used with Python in Docker environment
Build a python virtual environment with virtualenv and virtualenvwrapper
I made a Python3 environment on Ubuntu with direnv.
Build a python virtual environment with virtualenv and virtualenvwrapper
Install the latest stable Python with pyenv (both 2 and 3)
Get mail from Gmail and label it with Python3
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Read json file with Python, format it, and output json
Manage Python runtime packages and development environment packages with Poetry
Start numerical calculation in Python (with Homebrew and pip)
Until you install TensorFlow-GPU with pip in Windows environment
Install tweepy with pip and use it for API 1.1
Make it easy to install the ROS2 development environment with pip install on Python venv