Sentiment
Overall <%= @analysis.sentiment_label %>
face
<%= (@analysis.sentiment_score * 100).round.abs %>

<% modifier = case @analysis.sentiment_score.abs * 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.


The emotion's intensity is scored on a scale from 1 to 100, where 100 is most intense.

<% if @analysis.has_sentiment_scores? %>
Dominant emotions: <%= @document_dominant_emotion %> & <%= @document_secondary_emotion %>
The primary emotion evoked in this document is <%= @document_dominant_emotion %>.
<%= render partial: 'document_analyses/sentiment/emotion_explanation', locals: { emotion: @document_dominant_emotion } %>
The secondary emotion evoked in this document is <%= @document_secondary_emotion %>.
<%= render partial: 'document_analyses/sentiment/emotion_explanation', locals: { emotion: @document_secondary_emotion } %>
Evoked emotion intensities
<%= bar_chart(@document_emotion_data, colors: [Document.color], min: 0, max: 100) %>
<% end %>
<%= link_to '#', class: "white-text js-link-entity right hoverable btn #{Document.color}", data: { id: -1 } do %> add Link another page <% end %> Entities
<% @analysis.document_entities.includes(:entity, entity: [:image_uploads]).order('entity_type asc, relevance desc').each do |entity| %> <% entity_class = content_class_from_name(entity.entity_type) %>
<%= entity_class.icon %> <%= entity.text %>

Document relevance score: <%= entity.relevance.present? ? (entity.relevance * 100).round(1) : 'Calculating...' %>%

Emotion intensities
    <% [:joy, :sadness, :fear, :disgust, :anger].each do |emotion| %> <% emotion_score = entity.send("#{emotion}_score") %>
  • <%= emotion.to_s.titleize %>: <%= emotion_score.present? ? (100 * emotion_score).round(1) : 'Calculating...' %>
  • <% end %>
  • Overall sentiment: <%= entity.sentiment_label %> (<%= (entity.sentiment_score.present? ? (100 * entity.sentiment_score).round(1) : 'Calculating...') %>)
Emotional range
<% if entity.entity_id %> <% linked_entity_class = entity.entity.class %> <%= link_to polymorphic_path(linked_entity_class.name.downcase, id: entity.entity_id), class: 'blue-text left' do %> <%= linked_entity_class.icon %> View page <% end %> <%= link_to edit_polymorphic_path(linked_entity_class.name.downcase, id: entity.entity_id), class: 'green-text left' do %> <%= linked_entity_class.icon %> Edit page <% end %> <%= link_to "Unlink page", destroy_entity_document_path(entity), class: "#{entity_class.text_color} right" %>
<% else %> <%= link_to new_polymorphic_path(entity_class, document_entity: entity.id), class: entity_class.color + '-text' do %> add New <%= entity_class.name %> <% end %> <%= link_to '#', class: entity_class.color + '-text right js-link-entity', data: { id: entity.id } do %> link Link existing <% end %> <% end %>
<% 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 %>