Question: Java please Design and code a program that reads a text file, and counts the number of times each word that it contains appears. For
Java please
Design and code a program that reads a text file, and counts the number of times each word that it contains appears. For example, if the file contained the line ("Design and code a program that reads a text file, and counts the number of times each word that it contains appears 100), the programs output might look something like this:
design 1
code 1
program 1
that 2
reads 1
text 1
file 1
counts 1
number 1
times 1
each 1
word 1
contains 1
appears 1
Notice that the number 100 should not appear in the output, thus, implies a need to determine if a string is numeric or not.
For purposes of this program, define a word by the following rules:
A word is any group of contiguous letters from the file. In other words, spaces, punctuation, and other non-letter characters separate words, and are not words themselves. This rule also means that numbers written as strings of digits (e.g., 100) are not counted as words
Contractions are counted as two words separated by an apostrophe. For simplicity, you can assume your files contain only words, spaces, digits and newlines.
Capitalization alone does not make words different. For example, Design and design should be considered the same word.
It is usual in programs that index or analyze text to ignore trivial words such as a, the, etc. For this exercise, consider any word with 3 or fewer letters in it to be trivial.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
