Skip to content

Instantly share code, notes, and snippets.

@bluedistro
Created January 1, 2019 19:27
Show Gist options
  • Save bluedistro/9a4d7e6cac6814a2ed169447c6f78f58 to your computer and use it in GitHub Desktop.
Save bluedistro/9a4d7e6cac6814a2ed169447c6f78f58 to your computer and use it in GitHub Desktop.
Scale polarity
def review_rating(score, decoded_review):
if float(score) >= 0.9:
print('Review: {}\nSentiment: Strongly Positive\nScore: {}'.format(decoded_review, score))
elif float(score) >= 0.7 and float(score) < 0.9:
print('Review: {}\nSentiment: Positive\nScore: {}'.format(decoded_review, score))
elif float(score) >= 0.5 and float(score) < 0.7:
print('Review: {}\nSentiment: Okay\nScore: {}'.format(decoded_review, score))
else:
print('Review: {}\nSentiment: Negative\nScore: {}'.format(decoded_review, score))
print('\n\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment