Skip to content

feat: add word_freq.py CLI tool - #4

Open
raajkumars wants to merge 1 commit into
mainfrom
feat/word-freq-issue4
Open

feat: add word_freq.py CLI tool#4
raajkumars wants to merge 1 commit into
mainfrom
feat/word-freq-issue4

Conversation

@raajkumars

Copy link
Copy Markdown
Owner

Relates to http://localhost:3000/agentflow/agentflow/issues/4

Summary

Adds word_freq.py, a stdlib-only CLI that reads a text file and prints the top-N most frequent words (case-insensitive, punctuation stripped). Refines the existing implementation on main: consolidates word counting into a single word_freq() function, expands the word-character regex to include apostrophes, and tightens argument help strings.

Files changed

  • word_freq.py: consolidated implementation (~45 lines)

Tests

Smoke-tested manually:

  • Basic top-10 output: pass
  • --top 3 override: pass
  • Missing file → clear error message: pass
  • --top 0 → argparse error (N must be >= 1): pass

Deviations from plan

None.

Follow-ups

None.

@raajkumars

Copy link
Copy Markdown
Owner Author

Reviewer note (self-authored — cannot formally approve):

Code looks correct. One nit for the next person or the author to address:

  • word_freq.py:25re.findall(r"[a-zA-Z']+", text.lower()): the [A-Z] range is dead code because .lower() has already been applied. Suggest r"[a-z']+" for clarity. Non-blocking.

Everything else (consolidated word_freq(), sys.exit(msg) idiom, error messages) is idiomatic and clean. Needs an external reviewer to formally approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant