Perfect title
MAT 259, 2017
Niklas Griessbaum
Concept
How long is an ideal book title in respect to its category? And what words should it contain?
Query
My target is to get the 5 most popular 1st, 2nd .. 5th word of a title for each dewey classes.
As popularity, I defined how many items were checked out e.g. with the word "life" as the 3rd word in the title.
It appeared simpler to (automatically) re-execute the query for each class rather than creating a potentially complicated
SQL query that gets all the values at once. Here the formatable query, in which {wordNum} is the ordinal number of the word in the title, and
{deweyClass} the dewey class.
- Code:
-
SELECT
count(id) AS checkouts,
LEFT(deweyClass, 2) AS deweySub,
{wordNum},
SUBSTRING_INDEX(SUBSTRING_INDEX(title, ' ', {wordNum}),' ', -1) as word
FROM
spl_2016.inraw
WHERE
LEFT(deweyClass, 2) = '{dewey}'
GROUP BY
word
ORDER BY
checkouts DESC
LIMIT
5
Final result
Each word is represented as a circle. It's radius is correlated with the popularity of the word.
The circles experience a repulsing force from each other, which is inversly proportional to the square of their distance to each other.
Additionally, the circles are repulsed by a force from the boundaries, which is inversly proportional to the distance to the boundaries.
There is furthere physical collisions of circles with each other and collisions of the circles with the boundaries implemented.
Finally, the circles experience friction.
With all these forces in place, the circles are intended to eventually arange themself where they
try to maximize the distance to each others, while remaining in the boundaries.
The circles are connected through arcs, which intend to communicate the ordinality of each word (1st words connected to 2nd words, connected to 3rd words ...).
The directionality is displayed through the triangular shape of the arc in which the tip of the triangle is pointing towards the word with the higher ordinality.
The dewey class can be changed by pressing the keys 0 through 9 on the keyboard.
Evaluation/Analysis
The whole animation somewhat looks pleasing and the circles arrange themselves as intended. However there appears to be too much going on, which makes it hard to understand e.g. the order of words. It is not simple enough to spot the staring points which is necessary to construct a perfect title.
Code