Programming Languages Project
You are to write a this program in a language that you are
not familiar with. Notably, you cannot write it in Java or
Python. The program should have the following specifications:
-
I must input the text file that I have provided on the W-drive
named decl_of_indep.txt. You may place this file in the
same folder as your program. You must not change this file in
any way, other than changes between the end-of-line characters
that might occur between Unix, Dos, and MacOS (which will not
make any difference to the results).
-
Your program must keep track of the number of times that a word
appears in the text. This is case insensitive so
The,
the and
THE are the same word.
A word is defined as the longest unbroken string of
alphanumeric characters. Thus,
It's July-the-4th, 1776! has
6 words:
it, s,
july, the,
4th, and 1776.
-
Your program must print the top 20 most frequently used words
in descending order (most to least frequently occurring).
If the 20th word has the same count as next one(s) then continue
printing the 21st, 22nd, and so on, until you reach a less
frequently occuring word.
-
The output should show three columns and they should
line up like columns normally do. The first column should
be a line number (1, 2, 3, ...). The second column should
be the word (printed in lower case). The third column
should be the frequency count for that word.
Example languages you can use are Perl, PHP, JavaScript, Bash script, Forth,
APL, Pascal, or any other unknown language to you. You may need to find a
free compiler or
interpreter to install in order to do this. Be prepared to tell me
what I must download to run (and recompile) your code. You must turn
in your source code and a copy of the output (make sure your name is
included in the comments and output.