Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created February 19, 2021 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/633adf9dd1b736bc82f7848671caedff to your computer and use it in GitHub Desktop.
Save amankharwal/633adf9dd1b736bc82f7848671caedff to your computer and use it in GitHub Desktop.
l = ["joy", 'fear', "anger", "sadness", "disgust", "shame", "guilt"]
l.sort()
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