def counter(): words = list() c = Counter() for sent in mod030.mapping(): for dic in sent: words.append(dic["surface"]) c = Counter(words) return c.most_common()
#034.py # -*- coding: utf-8 -*- import sys import mod030 for sent in mod030.mapping(): for i in range(len(sent)-1): dic_no = sent[i] if dic_no["pos1"] == "連体化": dic_a = sent[i-1] dic_b = sent[i+1] print dic_a["surface"] + dic_no["surface"] + dic_b["surface"] """ python 034.py < neko.txt.mecab 彼の掌 掌の上 書生の顔 はずの顔 顔の真中 穴の中 """
#033.py # -*- coding: utf-8 -*- import sys import mod030 for i in mod030.mapping(): for j in i: if j["pos1"] == "サ変接続": print j["surface"] # print "\n-------------------" """ mecab neko.txt > neko.txt.mecab | python 033.py 見当 記憶 話 装飾 突起 運転 記憶 """