Skip to content

Commit

Permalink
feat: use the square root to get a wider range of intensities
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepinho committed Apr 27, 2017
1 parent 55e4f56 commit 26ab9d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/helpers/intensity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export function intensity(tweet: string): number {
const { length } = tweet.replace(/\s/g, '');
const intenseCharacters = (tweet.match(/[A-Z\!]/g) || []).length;

return intenseCharacters / length;
// Use the square root to get a wider range of intensities.
return Math.sqrt(intenseCharacters / length);
}

0 comments on commit 26ab9d9

Please sign in to comment.