python2.7でのSyntaxErrorについてです。
Mecabを用いて、形態素解析を行おうとしたところ、下記のエラーが出ております。
python
1>>> import MeCab 2>>> s = u"形態素解析にはMeCabを使っているので上のプログラムを動かすには事前にインストールが必要です" 3>>> tagger = MeCab.Tagger('-Ochasen') 4>>> node = tagger.parseToNode(s.encode('utf-8')) 5>>> wordList = [] 6>>> while node: 7... if node.feature.split(",")[0] == "名詞": 8... wordList.append(node.surface) 9... node = node.next 10... for word in wordList: 11 File "<stdin>", line 5 12 for word in wordList: 13 ^ 14SyntaxError: invalid syntax 15>>> print word.decode('utf-8') 16 File "<stdin>", line 1 17 print word.decode('utf-8') 18 ^ 19IndentationError: unexpected indent 20>>>
ご助力の程、宜しくお願い致します。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/06 08:16
2016/12/06 10:22