Complete: WordCount - Kaitlyn Flynn#7
Open
kaitlynflynn wants to merge 3 commits intobloominstituteoftechnology:masterfrom
Open
Complete: WordCount - Kaitlyn Flynn#7kaitlynflynn wants to merge 3 commits intobloominstituteoftechnology:masterfrom
kaitlynflynn wants to merge 3 commits intobloominstituteoftechnology:masterfrom
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Received some help after class from @harrisonbrock who helped me better understand some of the methods I was not grasping on my own. Still need to practice with this more, but his explanations of this implementation truly helped. Grateful to have this as some resource code 😄
TO DO
From the string, make a HashMap of each unique word and the frequency it appears in the text.
A word is delimited by a space or punctuation mark(s).
The spaces and punctuation marks do NOT appear in the word list.
The word list is NOT case sensitive: Lambda / lambda will count as the same word.
Words such as co-operation that contain a hyphen are considered one word.
A hyphen alone does not separate words. Numbers count as one word, so 23 is a word.
Print to the console the top 50 appearing words along with their counts.
Remember that HashMaps are not sorted not easily sortable.
You could convert the HashMap to an array list and then sort the array list.
Alternatively, you can find the most common word, print it, remove it, and repeat the process.
Note:
Below are two snippets of code you might find useful for this afternoon. Of course if you do not find them useful please ignore. You are NOT required to use this code.
myStr.replaceAll("[[\\.\\?\\!\\,\\;\\:\\{\\}\\(\\)\\']]", ""); String[] words = myStr.split(" +");