Posts

WordCloud of Last 100 Posts

avatar of @codingdefined
25
@codingdefined
·
0 views
·
2 min read

I have been writing continuously for some time and wanted to know which word I am using the most. I have been writing about Finance related things on LeoFinance so basically, all of my words will revolve around the finance domain itself but anyway wanted to know by myself. It's been a while I have written any code too mainly because of the limited time with office work and a toddler at home and also because my laptop was not working.

So, I wanted to write some code that was long pending along with that I wanted to check what words I am using the most in the last 100 posts. So, what I have done is to get around 100 posts from hive API using the condenser command get_discussions_by_blog and add my account name (codingdefined) as a tag. After around 100 posts, I have taken all the posts as strings and then removed special characters and new line characters (\n) from the string. Once done I have removed the common stop words like I, me, my etc.

After the string is almost cleaned, I have created the string count function which will give me an array of words along with their number. There were a lot of strings, so I have decided that I will take only those strings whose count is equal to or more than 10. And thus created an object array with string value and the count. This object I have sent to another function which actually creates the word cloud using the library WordCloud.js.

So the word cloud looks like this, where you will find most of the words related to finance.

Most of the words revolve around portfolio, investment, personal finance etc. I think it was good because I have touched a lot of topic in last 100 posts 9n which maximum was of finance related.

It did not take me long to code it might be a couple of hours, but this is the maximum time I can get it at the weekends. Might be my next step is to create a small website from where everyone can check their word cloud.

Similarly, I also created the word cloud of the last 200 posts with the tag 'leofinance' and the result of it is, where most used words are time, game, cards, people etc.

Please let me know if you need the word cloud of your account for the last 100 posts, write it in the comment, I will try to create it whenever I get some time.

Posted using LeoFinance Mobile