Skip to content

Complete: WordCount - Kaitlyn Flynn#7

Open
kaitlynflynn wants to merge 3 commits intobloominstituteoftechnology:masterfrom
kaitlynflynn:kaitlyn-flynn
Open

Complete: WordCount - Kaitlyn Flynn#7
kaitlynflynn wants to merge 3 commits intobloominstituteoftechnology:masterfrom
kaitlynflynn:kaitlyn-flynn

Conversation

@kaitlynflynn
Copy link
Copy Markdown

@kaitlynflynn kaitlynflynn commented Feb 6, 2019

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(" +");

@kaitlynflynn kaitlynflynn changed the title WIP: WordCount - Kaitlyn Flynn Complete: WordCount - Kaitlyn Flynn Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant