Skip to content

Instantly share code, notes, and snippets.

@richashworth
Created September 10, 2021 16:19
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 richashworth/b7eb699a75c32bd1eb309f9f5d82a0f1 to your computer and use it in GitHub Desktop.
Save richashworth/b7eb699a75c32bd1eb309f9f5d82a0f1 to your computer and use it in GitHub Desktop.
pos_adjs = ', '.join(get_related_adjectives("climate change", nlp(positive_phrase)))
neg_adjs = ', '.join(get_related_adjectives("climate change", nlp(negative_phrase)))
pos_row = [positive_phrase, pos_adjs, TextBlob(pos_adjs).sentiment[0]]
neg_row = [negative_phrase, neg_adjs, TextBlob(neg_adjs).sentiment[0]]
HTML(DataFrame([pos_row, neg_row], columns=["Text", "Relevant_Adjectives", "Relevant_Sentiment"]).to_html(index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment