<% sentiment_color = (analysis.sentiment_score < 0) ? 'blue' : 'green' %>
Sentiment
Overall <%= analysis.sentiment_label %>
face
<%= (analysis.sentiment_score * 100).round.abs %>

<% modifier = case analysis.sentiment_score * 100 when 0..25 'somewhat' when 26..50 'mostly' when 51..100 'very' else 'generally' end %> This document expresses a <%= modifier %> <%= analysis.sentiment_label %> sentiment throughout.


Your score is based on a scale from 1 to 100 based on how intense this emotion appears to be, where 100 is most intense.

<% if analysis.has_sentiment_scores? %>
Evoked emotions
<% end %> <% entities_in_table = analysis.document_entities .order('relevance desc') .where(entity_type: 'Character') .reject { |e| e.dominant_emotion.first.second.nil? } .reject { |e| e.recessive_emotion.first.second.nil? } %> <% if entities_in_table.any? %>
Character emotions
<% entities_in_table.each do |character| %> <% end %>
Character Dominant emotion Recessive emotion
<%= character.text %>
<%= character.dominant_emotion.first.first.to_s.titleize %> (<%= (character.dominant_emotion.first.second * 100).round %>%)
<%= character.recessive_emotion.first.first.to_s.titleize %> (<%= (character.recessive_emotion.first.second * 100).round %>%)
<% end %>