from dictionary import GROUPS, toki_pona_en def main(): rv = ['---group toki pona grouped words'] all_words = dict() for word_dict in toki_pona_en.values(): for word, meanings in word_dict.items(): all_words[word] = meanings.split(',')[0].strip() used_words = set() for group_name in ['BULGARIAN_LIKE', 'ENGLISH_LIKE', 'ELEMENTS', 'COLORS', 'ANIMALS', 'PLANTS', 'DIRECTIONS', 'PEOPLE', 'BODY', 'LOGICAL', 'PRONOUNS', 'VERBS', 'NOUNS', 'ADJECTIVES', 'GRAMMAR', 'INTERJECTIONS']: print('==============') print(group_name) print() rv.append('---group {}'.format(group_name.lower().replace('_', ' '))) for word in GROUPS['GROUP_{}'.format(group_name)]: if word in used_words: continue used_words.add(word) print('{:<16}: {}'.format(word, all_words[word])) rv.append(word) print() rv.append('---PAUSE---') print('==============') print('UNUSED WORDS:') print() rv.append('---group unused words') for word in sorted(set(all_words.keys()) - used_words): print('{:<16}: {}'.format(word, all_words[word])) rv.append(word) rv.append('---group the end') print(rv) if __name__ == '__main__': main()