This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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