How ken-jeong/ds-word-counter works
This repository is a C command-line word-frequency counter. Its main workflow validates a requested word and positive frequency, reads and counts whitespace-separated tokens, then prints totals and sorted summaries plus matching-word and matching-frequency results. The counter uses uthash for accumulation and word lookup; qsort and a linear scan support the two reporting views. The benchmark program is a separate research artifact, not part of the user-facing runtime workflow. Runtime relationships are based on wordCount.c and the README’s design description.
Main entry points: wordCount.c Argument Validation · uthash.h Hash Table · tom-word-list.txt Word List
Components 11
Input Handling
- Argument Validation
wordCount.c - Word List
words/tom-word-list.txt
Frequency Counting
- Token Counting
wordCount.c - Hash Table
uthash.h
Reports And Search
- Count Summary
wordCount.c - Word-Sorted View
wordCount.c - Word Lookup
wordCount.c - Frequency-Sorted View
wordCount.c - Frequency Lookup
wordCount.c
Other components
- CLI User
- Terminal Output
Connections 16
- CLI User → Argument Validation: provides arguments
wordCount.c - Argument Validation → Word List: selects input
wordCount.c - Word List → Token Counting: supplies tokens
wordCount.c - Token Counting → Hash Table: finds and adds
wordCount.c - Token Counting → Count Summary: reports totals
wordCount.c - Hash Table → Word-Sorted View: copies entries
wordCount.c - Argument Validation → Word Lookup: provides search word
wordCount.c - Word Lookup → Hash Table: finds word
wordCount.c - Hash Table → Frequency-Sorted View: provides entries
wordCount.c - Argument Validation → Frequency Lookup: provides target frequency
wordCount.c - Frequency-Sorted View → Frequency Lookup: scans sorted entries
wordCount.c - Count Summary → Terminal Output: prints totals
wordCount.c - Word-Sorted View → Terminal Output: prints report
wordCount.c - Word Lookup → Terminal Output: prints match
wordCount.c - Frequency-Sorted View → Terminal Output: prints report
wordCount.c - Frequency Lookup → Terminal Output: prints matches
wordCount.c