Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created February 19, 2021 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amankharwal/2f4508e0907d46cd75efa2fc32e4593f to your computer and use it in GitHub Desktop.
Save amankharwal/2f4508e0907d46cd75efa2fc32e4593f to your computer and use it in GitHub Desktop.
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