Skip to content

Instantly share code, notes, and snippets.

@timoteoponce
Created August 1, 2017 15:27
Show Gist options
  • Save timoteoponce/8a8aee9d3038947810a031f21f4889bb to your computer and use it in GitHub Desktop.
Save timoteoponce/8a8aee9d3038947810a031f21f4889bb to your computer and use it in GitHub Desktop.
Exercise: Word-count-1

Word count

TLDR: The program to write must calculate words frequency from a given file.

We will provide you a file with some text on it, and you have to open it and find the frequencies of all words in it having the following requirements:

  • Assume a valid UTF-8 input file
  • All words must be processed in lower case (ignore case) Output must be sorted by word alphabetically
  • Output must have one entry per word, having its frequency next to it

Example input:

Once upon a midnight dreary, while I pondered weak and we ary,
Over many a quaint and curious volume of forgotten lore ....

## Example output:

a 2
and 1 
dreary 1
... 

Resources

Exercise requirements

  • No UI interfaces are required, you can make a command-line application from it (e.g. java -jar myprogram.jar words.txt)
  • Use Java-8 as target environment
  • Create a README.txt file with a short guide for running the code
  • Optional: Use a build tool for the project (Maven or Ant or Gradle)
  • Optional: Create a GIT repository for the project at github.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment