Tag clouds are good tools to analyze text. They quickly give a good idea of which topics are being approached by an article or a post.
The following are the steps required to build a tag cloud:
The first step, which we won't be explaining in this recipe, is to parse a text and get data of how frequently each word occurs. You will probably want to only use the top 50 words and remove propositions and only use nouns.
Create the data structure for this visualization. In this case it is simply a pairing of a label and occurrences (a count of how many times a word appears in the text).
Once we get this, we can start creating the
TagCloud.as
class.We first have to determine the number that represents the lowest and the highest occurrences by looping through all the data.
With that in hand, we can find the value for
fontRatio
that will be used to assign a font size for each word. The formula is quite...