|
C Experiments:
![]()
Text Processing
![]()
Experiment No. 4
![]() |
C Text File Individual Word Counts, 1999-05-27:
We now need to count the number of times each individual word appears in the text document we are studying.
The Word Count program is designed to be run offline on a local machine and was executed with the KJV.TXT file while running under Red Hat Linux 5.2 on my Cyrix 686 machine.
This program is more involved (i.e. takes significantly more time) than the programs in previous experiments (it executed in about 20 minutes) and produced the Individual Word Counts Report linked to here.
Note that I used the older c-style "struct" rather than the c++ "class" for the linked-list of nodes in this program. Knowing how to use the c++ constructions is important: they are necessary for modern object-oriented programming.
But knowing when NOT to use the c++ tools is also important. This program is a one-shot: intended to be run only once. Using a c++ "class" would have required more time to develop, would have consumed more system memory, and would have run slower. And the advantages of c++ (encapsulation, reusability, inheritability, etc.) would not accrue in this one-shot scenario.
It would have been like firing-up Microsoft Word just to write a "Back in 10 minutes" note for your front door!
I have also prepared a Truncated Report, manually adjusted to exclude the counts of Book titles, Chapter headings, and Verse numbers so that only the counts of the words in the actual KJV text remain.
HOME