回答編集履歴

1

URLリンク追記

2018/09/22 06:27

投稿

opyon
opyon

スコア1009

test CHANGED
@@ -8,15 +8,35 @@
8
8
 
9
9
  [# 参考URL](https://github.com/ellie-icekler/MeCab-python)
10
10
 
11
+ [mecab-python3](https://github.com/SamuraiT/mecab-python3)
12
+
11
13
 
12
14
 
13
15
  mecabでのリスト作成例
14
16
 
15
17
  ```
16
18
 
19
+ # Python3サンプル
20
+
21
+ import MeCab
22
+
23
+ mecab = MeCab.Tagger ("-Ochasen")
24
+
25
+
26
+
17
27
  text = 'これは日本語の形態素解析のテストです。'
18
28
 
29
+ print(mecab.parse(text))
30
+
31
+
32
+
33
+
34
+
35
+ # ※こちらはPython2のサンプルでした
36
+
19
- parsed = [[chunk.split('\t')[0], tuple(chunk.split('\t')[1].split(','))] for chunk in mecab_tagger.parse(text).splitlines()[:-1]]
37
+ # parsed = [[chunk.split('\t')[0], tuple(chunk.split('\t')[1].split(','))] for chunk in
38
+
39
+ # mecab_tagger.parse(text).splitlines()[:-1]]
20
40
 
21
41
 
22
42