0

The title speaks for itself, but here is a bit more in-depth explanation. While my check() function runs, it always skips the last word in whatever file it is checking out. The source code for my issue is below with all its debug lines to (hopefully) help you all in helping me:

** removed code per academic honesty **

Here is the testfile.txt I use to test this:

Alpha, Butterfly Cat Charlie Crying Beard

Here is my small dictionary

alpha
cat
caterpillar

Here is the output when run using this dictionary and test file

~/pset5/speller/ $ ./speller dictionaries/small texts/testfile.txt
load function running...
End of Dictionary file Reached.....
load function terminated.

MISSPELLED WORDS

Check Function Running.....
Hash Complete: 0
Matching cursor to table value....
Table[index]->word = alpha
Comparison Running...
Comparing Alpha to alpha...
Comparison Complete! Alpha = alpha
Check Function Running.....
Hash Complete: 1
The letter 'B' has no words associated with it
Butterfly
Check Function Running.....
Hash Complete: 2
Matching cursor to table value....
Table[index]->word = caterpillar
Comparison Running...
Comparing Cat to caterpillar...
Comparison Complete! Cat != caterpillar
Cat
Check Function Running.....
Hash Complete: 2
Matching cursor to table value....
Table[index]->word = caterpillar
Comparison Running...
Comparing Charlie to caterpillar...
Comparison Complete! Charlie != caterpillar
Charlie
Check Function Running.....
Hash Complete: 2
Matching cursor to table value....
Table[index]->word = caterpillar
Comparison Running...
Comparing Crying to caterpillar...
Comparison Complete! Crying != caterpillar
Crying
Could not unload dictionaries/small.```

1 Answer 1

1

speller.c is responsible for sending the words to your check function. So it's not your code. Notice that speller only recognizes a word if it ends in punctuation or whitespace.

Your test text's last word doesn't, so it's not sent to check.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .