Created
June 26, 2018 20:03
-
-
Save BridgeNB/a28dfa94ddcb99638099edaf1f654e6c to your computer and use it in GitHub Desktop.
find most frequent word
This file contains 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
1. getToken function takes a raw string converted to an array consisted words. | |
All words in that array are in lower cases, no punctuations and falsy items, sorted by alphabetical order. | |
2. mostFrequentWord function takes a raw string and use getToken to covert it to tokens. | |
Then build a dictionary (hash map) to count all words' frequency. Then use a loop to find the most frequent word. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment