Esempio n. 1
0
# coding: utf-8

import mymodule as m

text = open("../data/neko.txt").read()

dict_list = []
for string in text.split():
    c_string = string.replace(" ", "")
    for morph in m.get_morphs(c_string):
        if morph["pos"] == "動詞":
            print morph["base"]
            dict_list.append(morph["base"])


Esempio n. 2
0
# coding: utf-8

import mymodule as m

text = open("../data/neko.txt").read()

dict_list = []
for string in text.split():
    c_string = string.replace(" ", "")
    morphs = m.get_morphs(c_string)
    for i in range(len(morphs) - 2):
        if morphs[i]["pos"] == "名詞" and morphs[
                i + 1]["surface"] == "の" and morphs[i + 2]["pos"] == "名詞":
            print morphs[i]["surface"], morphs[i + 1]["surface"], morphs[
                i + 2]["surface"]
Esempio n. 3
0
# coding: utf-8

import mymodule as m
from operator import itemgetter

text = open("../data/neko.txt").read()

dic = {}
for string in text.split():
    c_string = string.replace(" ", "")
    for morph in m.get_morphs(c_string):
        if dic.has_key(morph["surface"])==False:
            dic[morph["surface"]] = 0
        dic[morph["surface"]] += 1

for d in sorted(dic.items(), key=itemgetter(1), reverse=True):
    print d[0], d[1]
    # k,v = d.items()
    # print k, v
Esempio n. 4
0
# coding: utf-8

import mymodule as m

text = open("../data/neko.txt").read()

dict_list = []
for string in text.split():
    c_string = string.replace(" ", "")
    morphs = m.get_morphs(c_string)
    for dic in morphs:
        print dic["surface"], dic["base"], dic["pos"], dic["pos1"]
    dict_list.append(m.get_morphs(c_string))