def present_synonyms(synonym_groups, query):
table = defaultdict(list)
for sg in sorted(synonym_groups.keys()):
synonyms = synonym_groups[sg]
table[sg] = [COLORS[category - 1] + word
for category in sorted(synonyms.keys(), reverse=True)
for word in sorted(synonyms[category])]
table[sg].append(Fore.WHITE + "")
print ">> Results from searching: %s, where the first row denotes the context of where the synonyms are used.\n" % query
print tabulate(table, tablefmt="rst", headers="keys")
评论列表
文章目录