Write a Java program called WordMatch.java. This program takes four command-line
arguments. For example:
java WordMatch in1.txt out1.txt in2.txt out2.txt
1. The first is the name of a text file that contains the names of AT LEAST TWO text files
from which the words are to be read to build the lexicon (The argument is to specify the
input files).
2. The second is the name of a text file to which the words in the lexicon are to be written
(The argument is to specify the file containing the words and the neighbors in the lexicon).
3. The third is the name of a text file that contains ONLY ONE matching pattern (The
argument is to specify the file containing the matching pattern).
4. The fourth is the name of the text file that contains the result of the matching for the given
pattern (The argument specifies the file containing the output).
For this version, the efficiency with which the program performs various operations is a major
concern, i.e. the sooner the program performs (correctly), the better.
For example, the files read in can be quite long and the lexicon of words can grow to be quite
lengthy. Time to insert the words will be critical here and you will need to carefully consider
which algorithms and data structures you use.
You can use any text files for input to this program. A good source of long text files is at the
Gutenberg project (www.gutenberg.com) which is a project aimed to put into electronic form
older literary works that are in the public domain. The extract from Jane Austen’s book Pride and
Prejudice used as the sample text file above was sourced from this web site. You should choose
files of lengths suitable for providing good information about the efficiency of your program.
A selection of test files have been posted on LMS for your efficiency testing. You can consider
additional test files if you wish.
#Sales Offer!| Get upto 25% Off: