1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

■【Google Colaboratory】形態素解析(MeCab)を使う

Last updated at Posted at 2020-05-20

#1. MeCabインストール方法
MeCabを pipでインストール

!pip install mecab-python

#2. MeCabで形態素解析

import MeCab
# Example 1
s = MeCab.Tagger('-Ochasen')
print(s.parse('にわにはにわにわとりがいる'))

image.png

# Example 2
s = MeCab.Tagger('-Ochasen')
print(s.parse('庭には二羽ニワトリがいる'))

image.png

#3. MeCabとjanomeの形態素解析結果比較
##3.1 漢字・ひらがな・カタカナ
Result of Analysis by MeCab(mecab-python3-0.996.5)
image.png

Result of Analysis by janome(janome-0.3.10)
image.png

##3.2 ひらがな
『ワニ』と『ハニワ』と『ニワトリ』によるコラボになった

Result of Analysis by MeCab(mecab-python3-0.996.5)
image.png

Result of Analysis by janome(janome-0.3.10)
image.png

Reference

■【Google Colaboratory】 Preprocessing of Natural Language Processing & 形態素解析(janome)
■【Google Colaboratory】形態素解析(janome)を使う
ソースからPythonをインストール
configure, make, make install とは何か
自分でソフトウェアをビルド・インストールするときに/usrや/usr/localへインストールしない

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?