Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Feb 19, 2021
Embed
What would you like to do?
emoji_dict = {"joy":"😂", "fear":"😱", "anger":"😠", "sadness":"😢", "disgust":"😒", "shame":"😳", "guilt":"😳"}
t1 = "This looks so impressive"
t2 = "I have a fear of dogs"
t3 = "My dog died yesterday"
t4 = "I don't love you anymore..!"
texts = [t1, t2, t3, t4]
for text in texts:
features = create_feature(text, nrange=(1, 4))
features = vectorizer.transform(features)
prediction = clf.predict(features)[0]
print( text,emoji_dict[prediction])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment