πŸŒ³πŸ“–πŸ’»#3:🌳 β€” Word Frequenctrees

Martin Breuss
Dec 19, 2016 Β· 2 min read

Get yourself some literature and watch this great introduction, because inspired by the following beautiful bash line:

$ tr -s β€˜A-Z’ β€˜a-z’ < shakes.txt | tr -sc β€˜a-z’ β€˜\n’ | sort | uniq -c | sort -n -r | less

I spent most of my day building a mini-website:

(here’s the code)

It was also a practice in JavaScript, and an approach to make RegEx do small tasks for me. The site is another one-day-hack.

I wrote all of the functions myself β€” except for the final `sortWords()`. It was once again interesting to see how using code I didn’t fully understand broke my flow and had me backtrack a few times until figuring my way around. I doubt that using something has even half as much learning effect as making something.

While taking a break, I also realized that I will now probably suspend creating small webapps and instead focus on learning to use python’s NLTK.

I might have already watched enough basic NLP concepts in the beginning videos of my courses, so that it starts to make sense to learn to use a powerful toolset, such as NLTK.

Useful Bits

  • Taking text input and keeping some formatting by transforming the newline characters into <p>
  • Creating and hiding DOM Elements
  • Using JavaScript for simple text processing

And here is some Inception for you:

; )

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium β€” and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store