Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created February 19, 2021 07:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
def convert_label(item, name):
items = list(map(float, item.split()))
label = ""
for idx in range(len(items)):
if items[idx] == 1:
label += name[idx] + " "
return label.strip()
emotions = ["joy", 'fear', "anger", "sadness", "disgust", "shame", "guilt"]
X_all = []
y_all = []
for label, text in data:
y_all.append(convert_label(label, emotions))
X_all.append(create_feature(text, nrange=(1, 4)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment