The goal of this project was to code a program that can generate a concordance from a text file, which is an alphabetical list of the principal words used in a text file, listing every instance of each word with its immediate context (line and line number).
OBS: A version of this program also exists in Python, located in this repo.
-
makefile
: Needed to build the assignment. In order to construct thekwoc3
executable, enter eithermake
ormake kwoc3
. -
kwoc3.c
: The C file containing themain()
function. -
emalloc.[ch]
: Source code and header file for theemalloc
function. This is kept in its own source-code file as it can be used independently in bothkwoc3.c
andlisty.c
. -
listy.[ch]
: Linked-list routines.
Use make
to generate the executable file
Then, use the following to run the program: ./kwoc3 [INPUT-FILE] (-e) [EXCEPTION-FILE]
The tests are described under the TESTS.md
file.
If you want to validate the output is correct, you can compare the input file inXX.txt
with the expected output file outXX.txt
using diff
as follows:
./kwoc3 [INPUT-FILE] (-e) [EXCEPTION-FILE] | diff - [OUTPUT-FILE]
If you get no output, that means the output from the program is the same as the expected output.
Example test command:
./kwoc3 Test_Files/in04.txt -e Test_Files/english.txt | diff - Test_Files/out04.txt