Your question is Refactoring in an OOP App. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Build an OOP app where each stage builds on the last, requiring refactors and careful design.
Implement build_reports(documents) using composable stages for normalization, tokenization, and word-frequency reporting. Each stage must expose a consistent processing interface, and the pipeline must pass one stage's output directly to the next without embedding stage-specific logic.
Input is a list of strings. Return one report per input string, where each report contains the token list and a frequency dictionary. Preserve token order and treat words case-insensitively after trimming and collapsing whitespace.
def build_reports(documents):