Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymorphy2
- import sys
- access = 'йцукенгшщзхъфывапролджэячсмитьбю-–— \n'
- morph = pymorphy2.MorphAnalyzer()
- count = 0
- result = list()
- result_l = list()
- result_s = set()
- newdata = ' '
- data = list(map(str.strip, sys.stdin))
- for text in data:
- for i in text:
- if i.lower() not in ' абвгдеёжзийклмнопрстуфхцчшщъыьэюя' or i == '\n' or i == '\v' or i == '\t':
- text = text.replace(i, ' ').lower()
- newdata += text + ' '
- newdata = newdata.split()
- for i in newdata:
- item = morph.parse(i)[0]
- rate = 0
- if 'NOUN' == item.tag.POS and item.score > 0.5:
- result_l.append(item.normal_form)
- result_s.add(item.normal_form)
- for j in result_s:
- result.append([j, result_l.count(j)])
- result.sort(key=lambda x: (x[1], x[0]), reverse=True)
- print(*list(map(lambda x: x[0], result[:10])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement