Skip to content

Commit

Permalink
Tooltip for language tone, updates to text for social tone
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhasinghal committed Jul 13, 2016
1 parent cc902be commit f766c81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
21 changes: 16 additions & 5 deletions public/js/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function App(documentTones, sentences, thresholds, selectedSample) { // eslint-d
_thresholds = thresholds,
_isHoveringOriginalText = false,
_socialToneHoverTexts,
_languageToneHoverTexts,
_toneHash,
TONE_CATEGORIES_RESET = [{
tones: [{
Expand Down Expand Up @@ -368,11 +369,17 @@ function App(documentTones, sentences, thresholds, selectedSample) { // eslint-d
_cleanSentences(_rankedSentences);
_originalSentences = _rankedSentences.slice(0);
_socialToneHoverTexts = {
'Agreeableness': 'The tendency to be compassionate and cooperative towards others.',
'Emotional Range': 'The extent a person\'s emotion is sensitive to the environment.',
'Openness': 'The extent a person is open to experience a variety of activities.',
'Conscientiousness': 'The tendency to act in an organized or thoughtful way.',
'Extraversion': 'The tendency to seek stimulation in the company of others.'
'Agreeableness': 'Higher value, writer more likely to be perceived as, compassionate and cooperative towards others.',
'Emotional Range': 'Higher value, writer likely to be perceived as someone sensitive to the environment.',
'Openness': 'Higher value, writer more likely to be perceived as open to experiences for a variety of activities.',
'Conscientiousness': 'Higher value, the writer likely to be percieved as someone who would act in an organized or thoughtful way.',
'Extraversion': 'Higher value, the writer is likely to be perceived as someone who would seek stimulation in the company of others.'
};

_languageToneHoverTexts = {
'Analytical': 'A writer\'s reasoning and analytical attitude about things. Higher value, more likely to be perceived as intellectual, rational, systematic, emotionless, or impersonal.',
'Confident': 'A writer\'s degree of certainty. Higher value, more likely to be perceived as assured, collected, hopeful, or egotistical.',
'Tentative': 'A writer\'s degree of inhibition. Higher value, more likely to be perceived as questionable, doubtful, limited, or debatable.'
};

// Constructing the _toneHash hashmap
Expand Down Expand Up @@ -400,6 +407,10 @@ function App(documentTones, sentences, thresholds, selectedSample) { // eslint-d
if (curVal.category_name === 'Social Tone') {
prevVal2[curVal2.tone_name].tooltip = _socialToneHoverTexts[curVal2.tone_name];
}

if (curVal.category_name === 'Language Tone') {
prevVal2[curVal2.tone_name].tooltip = _languageToneHoverTexts[curVal2.tone_name];
}
return prevVal2;
}, prevVal);
reducedPrevVal[curVal.category_name] = {
Expand Down
3 changes: 2 additions & 1 deletion public/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ function allReady(thresholds, sampleText) {
function writingMap(item) {
return {
label: item.tone_name,
score: app.percentagify(item.score, 'Language Tone')
score: app.percentagify(item.score, 'Language Tone'),
tooltip: app.toneHash()[item.tone_name].tooltip
};
}

Expand Down

0 comments on commit f766c81

Please sign in to comment.