Assignment #1 Java KWIC
Assignment #1 Java KWIC
Winter 2023
Assignment #1
• Req-1: A KWIC index is formed by sorting and aligning the words within a line to allow each word
to be searchable alphabetically.
• Req-2: The program must read the input lines from a file. We’ll refer to this file as the inputfile.
• Req-3: The program must allow the user to optionally specify using the option -s the name of a file
which contains the words to be ignored. We’ll refer to this file as the stopwords.
• Req-4: The command to execute the program should be of the form: kwic [-s stopwords] inputfile.
Note: the square brackets are not part of the invocation command; rather, they are used to indicate
that the use of -s is optional.
• Req-5: If the inputfile does not exist, the program should report the error message “Error: The file
inputfile does not exist” and terminate.
• Req-6: If the inputfile exists but it is empty, the program should report the error message “Error: The
file inputfile is empty” and terminate.
• Req-7: If the -s option has been specified and the stopwords file does not exist, the program should
report the message “Warning: The file stopwords does not exist” and continue with the execution.
• Req-8: If the -s option has been specified and the stopwords file exists but is empty, the program
should report the error message “Warning: The file stopwords is empty” and continue with the
execution.
• Req-9: The format of the generated output should be similar to that shown as the “Output” on the
lecture slides.
In addition to the program, you should also create a class diagram to document the design.
Please submit your program and the class diagram via Blackboard by Sunday, January 29, 2023,
11:59pm.