Skip to content

Instantly share code, notes, and snippets.

@buhii
Last active January 3, 2016 18:09
Show Gist options
  • Save buhii/8500746 to your computer and use it in GitHub Desktop.
Save buhii/8500746 to your computer and use it in GitHub Desktop.
#!/bin/bash
mecab="mecab-0.996"
mecab_python="mecab-python-0.996"
mecab_googlecode="https://mecab.googlecode.com/files/"
if ! type curl > /dev/null; then
downloader='wget '
else
downloader='curl -O '
fi
# Download
if [ ! -f "${mecab}.tar.gz" ]; then
eval "${downloader}${mecab_googlecode}${mecab}.tar.gz"
# Expand, compile and install
tar -zxvf "${mecab}.tar.gz"
cd ${mecab}
./configure --enable-utf8-only --with-charset=utf8
make
sudo make install
sudo ldconfig
cd ".."
fi
if [ ! -f "${mecab_python}.tar.gz" ]; then
eval "${downloader}${mecab_googlecode}${mecab_python}.tar.gz"
# Expand, compile and install
tar -zxvf "${mecab_python}.tar.gz"
cd ${mecab_python}
python setup.py install
sudo ldconfig
cd ".."
fi
# ipadic
mecab_ipadic="mecab-ipadic-2.7.0-20070801"
if [ ! -f "${mecab_ipadic}.tar.gz" ]; then
eval "${downloader}${mecab_googlecode}${mecab_ipadic}.tar.gz"
tar zxvf "${mecab_ipadic}.tar.gz"
cd "${mecab_ipadic}"
./configure --with-charset=utf-8
make
sudo make install
cd ".."
fi
# mecab-dic-overdrive
if [ ! -f "jawiki-latest-page.sql.gz" ]; then
eval "${downloader}http://dumps.wikimedia.org/jawiki/latest/jawiki-latest-page.sql.gz"
fi
sudo cpan install Text::MeCab Unicode::Normalize Unicode::RecursiveDowngrade HTML::Entities DBI Path::Class Log::Log4perl
# git clone https://github.com/nabokov/mecab-dic-overdrive
# !!! change paths in emacs etc/config.pl
# cd mecab-dic-overdrive
# bin/initialize_dic.pl
# !!! move jawiki-latest-page.sql.gz to misc/dic
# bin/generate_dic.pl --target=wikipedia_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment