toki_pona/get_categories.py
2023-10-08 18:27:27 +02:00

19 lines
457 B
Python

from collections import defaultdict
from pprint import pprint
from dictionary import GROUPS, toki_pona_en
def main():
counter = dict()
for word in toki_pona_en.keys():
counter[word] = []
for group_name, words in GROUPS.items():
for word in words:
counter[word].append(group_name.split('GROUP_')[1])
pprint(sorted(counter.items(), key=lambda x: len(x[1]), reverse=True))
if __name__ == '__main__':
main()