I don't know if it's actually the strongest, but the way I think it's this
It works by copying to the code cell of Google Colab (probably). It will take some time for make
, so let's have a cup of coffee and wait ☕️
google_colab.ipynb
%%bash
#mecab and mecab-Install python3 dependencies
apt-get install mecab swig libmecab-dev mecab-ipadic-utf8
# mecab-python installation
pip install mecab-python3
#crfpp download(cabocha dependencies)
curl -sL -o CRF++-0.58.tar.gz "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7QVR6VXJ5dWExSTQ"
tar -zxf CRF++-0.58.tar.gz
#crfpp installation
cd CRF++-0.58
./configure && make && make install && ldconfig
cd ..
#cabocha download
url="https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7SDd1Q1dUQkZQaUU"
curl -sc /tmp/cookie ${url} >/dev/null
code="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -sLb /tmp/cookie ${url}"&confirm=${code}" -o cabocha-0.69.tar.bz2
tar -jxf cabocha-0.69.tar.bz2
#cabocha installation
cd cabocha-0.69
./configure -with-charset=utf-8 && make && make check && make install && ldconfig
# cabocha-python installation
pip install python/
cd ..
%%bash
mecab -v
pip show mecab-python3 | grep -e Name -e Version && echo
cabocha -v && echo
pip show cabocha-python | grep -e Name -e Version
output
mecab of 0.996
Name: mecab-python3
Version: 0.996.5
cabocha of 0.69
Name: cabocha-python
Version: 0.69
import MeCab
tagger = MeCab.Tagger()
print(tagger.parse("The customer next door is a customer who often eats persimmons"))
output
Neighboring noun,General,*,*,*,*,next to,Tonari,Tonari
Particles,Attributive,*,*,*,*,of,No,No
Customer noun,General,*,*,*,*,Customer,Cuck,Cuck
Is a particle,Particle,*,*,*,*,Is,C,Wow
Often adverbs,General,*,*,*,*,Often,Yoku,Yoku
Persimmon noun,General,*,*,*,*,persimmon,Oyster,Oyster
Eating verb,Independence,*,*,Godan / Wa line reminder,Uninflected word,Eat,Ku,Ku
Customer noun,General,*,*,*,*,Customer,Cuck,Cuck
Auxiliary verb,*,*,*,Special,Uninflected word,Is,Da,Da
EOS
import CaboCha
cp = CaboCha.Parser()
print(cp.parseToString("The customer next door is a customer who often eats persimmons"))
output
next to-D
Customers-------D
Often---D |
persimmon-D |
Eat-D
It's a customer
EOS
Recommended Posts