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

Martin Breuss
2 min readDec 19, 2016

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:

the and i a to some my text for az using of that as it in

; )

--

--