Created
October 31, 2018 15:53
-
-
Save thebinarypenguin/5f9903f2b81277d07c3244097d156f6c to your computer and use it in GitHub Desktop.
Most Frequent Word Analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getTokens | |
1. convert string to lower case | |
2. split string into array (of words) along word boundaries | |
3. remove any empty strings | |
4. sort the array of words alphabetically | |
mostFrequentWord | |
1. call getTokens to convert text into an array of sorted words | |
2. loop over the words array, building up a frequency distribution object | |
3. loop over the frequency distribution object, looking for the word with the highest frequency | |
4. return the word with the highest frequency |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment