Skip to content

Instantly share code, notes, and snippets.

Created Feb 19, 2021
What would you like to do?
l = ["joy", 'fear', "anger", "sadness", "disgust", "shame", "guilt"]
label_freq = {}
for label, _ in data:
label_freq[label] = label_freq.get(label, 0) + 1
# print the labels and their counts in sorted order
for l in sorted(label_freq, key=label_freq.get, reverse=True):
print("{:10}({}) {}".format(convert_label(l, emotions), l, label_freq[l]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment