Skip to content

Instantly share code, notes, and snippets.

@jtauber
Created November 2, 2015 22:57
Show Gist options
  • Save jtauber/d05bbe3ee9536bf59147 to your computer and use it in GitHub Desktop.
Save jtauber/d05bbe3ee9536bf59147 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from collections import defaultdict
from pysblgnt import morphgnt_rows
count_by_item = defaultdict(int)
total_item_count = 0
for book_num in range(1, 28):
for row in morphgnt_rows(book_num):
item = row["lemma"] # "lemma" or "norm"
count_by_item[item] += 1
total_item_count += 1
cummulative_count = 0
items_learnt = 0
for item, count in sorted(count_by_item.items(), key=lambda element: element[1], reverse=True):
print(item, count)
cummulative_count += count
items_learnt += 1
if cummulative_count > total_item_count * 0.50: # @@@
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment