Search

Word Cloud Version 2.0

When I migrated the blog to Wix, all of the articles were able to be shifted across seamlessly. All of them except the one where I'd tried to be too cute. I wrote a post which took the words from all of the other articles in the blog, computed frequencies and created a word cloud visualization. Now that was easy when I had my own Python-based blogging platform. Recreating it using Javascript and the Wix API's is proving to be far more difficult, if not impossible.


What I think I need to do now is pretty involved:


1. Add a back-end function to grab the raw text data from the database and do some pre-processing

2. Add some front-end code to the 'Posts' page in the editor and checks if the URL is for this particular post

3. If so, call the back-end function to return the data to the front-end

4. Send the data to an HTML frame via Wix's messaging system

5. Use this library to render the layout in HTML frame.


Unfortunately, all of this is really difficult to test in Wix Preview mode, as the URL's are temporary and the comparison in step 2 fails. Looks like this might be a very much work-in-progress post.


As of this moment, according to this Wix forum post, the functionality I need (ability to programmatically access my own database of blog posts) doesn't exist. If/when this changes, I'll update this post to include a live version of the word cloud. One solution I've thought about is adding a webhook to the post "Publish" button that takes the text content and dumps it into a separate database that I do have access to, but that seems like a complex workaround to account for functionality that should already exist. For now, you'll have to be satisfied with a static version which I painstakingly created by cutting-n-pasting the content of every post into a text file and ran that file through some Python code.


Anyway, without further ado, here is the static, non-interactive version of the word cloud (as at late-March-ish 2019). Code I used to generate it can be found here.





3 views

©2019 by Grumpy Old Nerd

  • GitHub-Mark-120px-plus